A Swift library to enable lightweight interaction with the Algorand blockchain.

Overview

AlgorandKit

A Swift library to enable lightweight interaction with the Algorand blockchain.

Embed this library to easily create and share Algorand Payment Prompt URIs and stylized QR codes.

Swift 5 Swift Package Manager MIT license

Algorand Screenshot

Requirements

  • Xcode 12.0 or higher.
  • iOS 13.0 or higher.

Installation

The Swift Package Manager is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.

To integrate AlgorandKit into your Xcode project using Xcode 12, specify it in File > Swift Packages > Add Package Dependency...:

https://github.com/computerbluemonday/AlgorandKit

Or, manually add the dependency to your Package.swift:

.package(url: https://github.com/computerbluemonday/AlgorandKit, from: "1.1.0")

AlgorandURI

A utility for constructing Algorand Payment Prompt URIs, as defined by the specification:

https://developer.algorand.org/docs/reference/payment_prompts/

Per the spec, this URI represents "a standardized way for applications and websites to send requests and information through deeplinks, QR codes, etc." On iOS, these URIs can be handled by the official Algorand Wallet app to delegate transaction processing on Algorand:

https://developer.algorand.org/articles/payment-prompts-with-algorand-mobile-wallet/

AlgorandURI is an immutable Swift struct which enforces business logic rules through its interface definition upon initialization. All URIs constructed via AlgorandURI should be semantically valid. (AlgorandURI does not validate addresses or transaction validity.)

The object definition lends itself to quick visual inspection in the debugger -- for instance:

▿ AlgorandURI
  - uriScheme : "algorand"
  ▿ receiver : Receiver
    - address : "4AOJ5QITUBWZGO4K5AF77H5GED5A4QDBB6DOQGI63QE2GU6KD2XNETBBJE"
    ▿ label : Optional<String>
      - some : "Bob"
  ▿ assetAmount : AssetAmount
    ▿ algo : 1 element
      - microAlgos : 50
  ▿ note : Optional<note>
    ▿ some : note
      ▿ readonly : 1 element
        - xnote : "Transfer"

A suite of test cases is included for regression verification.

Usage Examples

let algoURI = AlgorandURI(
      receiver: AlgorandURI.Receiver(address: "4AOJ5QITUBWZGO4K5AF77H5GED5A4QDBB6DOQGI63QE2GU6KD2XNETBBJE", label: "Barclay"),
      assetAmount: .algo(microAlgos: 100),
      note: .readonly(xnote: "Transporter Insurance"))
      
let asaURI = AlgorandURI(
      receiver: AlgorandURI.Receiver(address: "4AOJ5QITUBWZGO4K5AF77H5GED5A4QDBB6DOQGI63QE2GU6KD2XNETBBJE", label: "Lanel"),
      assetAmount: .ASA(assetID: 1000000, amount: 150),
      note: .readonly(xnote: "Spaceship"))

if let url = algoURI.url() {
  if UIApplication.shared.canOpenURL(url) {
    UIApplication.shared.open(url, options: [:], completionHandler: nil)
  }
}

AlgorandQRCode

Utilities for generating raw and stylized Algorand QR codes from AlgorandURI instances:

  • AlgorandURI (extension) -- Generate a raw QR code UIImage from an AlgorandURI
  • AlgorandQRCodeBadge -- Create a scalable, (optionally) stylized and branded Algorand QR code badge in SwiftUI

Although not explicitly provided as part of this library, see AlgorandQRCodeTests for examples of detecting Algorand QR Codes using Apple's Vision framework.

Usage Examples

// Create an AlgorandURI to receiver Barclay for 100 microAlgos, with the readonly note "Transporter Insurance"
let algoURI = AlgorandURI(
  receiver: AlgorandURI.Receiver(address: "4AOJ5QITUBWZGO4K5AF77H5GED5A4QDBB6DOQGI63QE2GU6KD2XNETBBJE", label: "Barclay"),
  assetAmount: .algo(microAlgos: 100),
  note: .readonly(xnote: "Transporter Insurance"))

// Generate a raw QR code UIImage for this transaction URI
let qrCodeImage = algoURI.generateQRCode()

// Instantiate a stylized SwiftUI QR code badge
AlgorandQRCodeBadge(
  uri:AlgorandURI(receiver: AlgorandURI.Receiver(address: "4AOJ5QITUBWZGO4K5AF77H5GED5A4QDBB6DOQGI63QE2GU6KD2XNETBBJE", label: nil), assetAmount: nil, note: nil),
  qrCodeColor: UIColor.systemTeal,
  frameConfiguration: .framed(color: UIColor.darkGray),
  includeLogo: true)

Sample Screenshots

Sample Algorand QR Code 1 Sample Algorand QR Code 2 Sample Algorand QR Code 3

UIActivityViewController / AirDrop

Support for sharing AlgorandURIs with other devices or services via UIActivityViewController. Defaults to a set of sharing destinations including AirDrop, SMS, Mail, Copy/Paste; configurable to other sharing destinations by the caller.

Usage Examples

// Create an AlgorandURI to receiver Data for 400 microAlgos.
let algoURI = AlgorandURI(
  receiver: AlgorandURI.Receiver(address: "4AOJ5QITUBWZGO4K5AF77H5GED5A4QDBB6DOQGI63QE2GU6KD2XNETBBJE", label: "Data"),
  assetAmount: .algo(microAlgos: 400),
  note: .readonly(xnote: "Cat food."))

// Present UIActivityViewController to share AlgorandURI via AirDrop, SMS, etc. (SwiftUI)
if let av = algoURI.activityViewController(excludedActivityTypes: nil) {
  UIApplication.shared.windows.first?.rootViewController?.present(av, animated: true, completion: nil)
}

Sample Screenshots

Sample AlgorandURI AirDrop Sample AlgorandURI AirDrop Destinations Sample Receive AirDrop

AlgoSampleApp

AlgoSampleApp is a standalone iOS Application project which demonstrates importing AlgorandKit, and specifically demos AlgorandURI's UIActivityViewController / AirDrop support. This can also serve as a test harness for exploring other AlgorandKit functionality.

To build, simply open AlgoSampleApp.xcodeproj included in the AlgoSampleApp directory.

In Summary

Hopefully you are inspired to build interesting applications on Algorand! If you enjoy using this free library, you may choose to help test it by sending a tip (in Algos, of course!) to:

algorand://4AOJ5QITUBWZGO4K5AF77H5GED5A4QDBB6DOQGI63QE2GU6KD2XNETBBJE

Cheers!

Releases(1.1.0)
Owner
computerbluemonday
computerbluemonday
A pure swift Ethereum Web3 library

⚗️ Web3 Web3.swift is a Swift library for signing transactions and interacting with Smart Contracts in the Ethereum Network. It allows you to connect

null 360 Nov 16, 2021
Full Bitcoin library for iOS, implemented on Swift. SPV wallet implementation for Bitcoin, Bitcoin Cash and Dash blockchains.

BitcoinKit-iOS Bitcoin, BitcoinCash(ABC) and Dash wallet toolkit for Swift. This is a full implementation of SPV node including wallet creation/restor

Horizontal Systems 171 Nov 9, 2021
This library provides convenient way to use Coinpaprika.com API in Swift.

Coinpaprika API Swift Client Documentation | Repository | Installation Usage This library provides convenient way to use Coinpaprika.com API in Swift.

Coinpaprika 28 Nov 15, 2021
Bitcoin protocol toolkit for Swift

Welcome to BitcoinKit The BitcoinKit library is a Swift implementation of the Bitcoin protocol which support both BCH and BTC. Improving the mobile ec

Yenom - The simplest Bitcoin wallet - 758 Nov 12, 2021
Elegant Web3js functionality in Swift. Native ABI parsing and smart contract interactions on Ethereum network.

You can ask for help in our Discord Channel web3swift Swift implementation of web3.js functionality ⚡ Interaction with remote node via JSON RPC ?? Sma

BANKEX - Proof-of-Asset Protocol 475 Nov 10, 2021
EthereumKit is a free, open-source Swift framework for easily interacting with the Ethereum.

EthereumKit is a Swift framework that enables you to create Ethereum wallet and use it in your app. // BIP39: Generate seed and mnemonic sentence. le

Ryo Fukuda 428 Nov 4, 2021
Enable autocomplete use resources in swift project.

ResourceKit Enable autocomplete use resources in swift project. まだハードコードで消耗してるの? ResourceKitで安全コーディング! How does ResourceKit work? ResouceKit makes you

bannzai 90 May 27, 2021
Ethereum Wallet Toolkit for iOS - You can implement an Ethereum wallet without a server and blockchain knowledge.

Introduction EtherWalletKit is an Ethereum Wallet Toolkit for iOS. I hope cryptocurrency and decentralized token economy become more widely adapted. H

Sung Woo Chang 112 Nov 17, 2021
A UINavigationController's category to enable fullscreen pop gesture with iOS7+ system style.

FDFullscreenPopGesture An UINavigationController's category to enable fullscreen pop gesture in an iOS7+ system style with AOP. Overview 这个扩展来自 @J_雨 同

null 5.9k Nov 24, 2021
Proxitee iOS SDK to enable iOS apps to use the Proxitee platform with iBeacon and GeoFencing

Proxitee iOS SDK Introduction The Proxitee iOS SDK allows you to enable your iOS devices to use the Proxitee platform with iBeacons and GeoFences, for

Proxitee 16 Sep 19, 2020
All in One Blockchain solution

Essentia One iOS application. Manage all crypto assets in one environment and bring blockchain power to your everyday life. Buy & sell cross-platform

Essentia 45 Sep 10, 2021
Ethereum Wallet Toolkit for iOS - You can implement an Ethereum wallet without a server and blockchain knowledge.

Introduction EtherWalletKit is an Ethereum Wallet Toolkit for iOS. I hope cryptocurrency and decentralized token economy become more widely adapted. H

Sung Woo Chang 112 Nov 17, 2021
JustPeek is an iOS Library that adds support for Force Touch-like Peek and Pop interactions on devices that do not natively support this kind of interaction.

JustPeek Warning: This library is not supported anymore by Just Eat. JustPeek is an iOS Library that adds support for Force Touch-like Peek and Pop in

Just Eat 68 Apr 4, 2021
library performs interaction with UI interface

StartGravity: Agilie Team would like to offer you our new lightweight open-source library called AGInterfaceInteraction. Our library with the new inte

Agilie Team 157 Aug 3, 2021
Swift Interaction with VIPER Architecture

SwiftyVIPER SwiftyVIPER allows easy use of VIPER architecture throughout your iOS application. VIPER Architecture What is VIPER? Great question! VIPER

Cody Winton 114 Oct 5, 2021
Design and prototype customized UI, interaction, navigation, transition and animation for App Store ready Apps in Interface Builder with IBAnimatable.

Design and prototype customized UI, interaction, navigation, transition and animation for App Store ready Apps in Interface Builder with IBAnimatable.

IBAnimatable 8.6k Nov 17, 2021
Review page interaction - handy and pretty way to ask for review.

RPInteraction Overview Review page interaction - handy and pretty way to ask for review. Inspired by dribbble shot. Requirements iOS8 Installation RPI

Nurdaulet Bolatov 27 Jul 16, 2021
UITextField subclass with floating labels - inspired by Matt D. Smith's design: http://dribbble.com/shots/1254439--GIF-Mobile-Form-Interaction?list=users

JVFloatLabeledTextField JVFloatLabeledTextField is the first implementation of a UX pattern that has come to be known the "Float Label Pattern". Due t

Jared Verdi 7.1k Nov 19, 2021
UITabBarController with swipe interaction between its tabs.

?? Features Zero setup Different animations Enable/Disable interactions easily Fluid gestures ?? Installation Using CocoaPods Edit your Podfile and sp

Marcos Griselli 1.1k Nov 15, 2021
A lightweight, pure-Swift library for manage the task execution in different threads. Through the definition a simple but powerful concept, Kommand.

Kommander is a Swift library to manage the task execution in different threads. Through the definition a simple but powerful concept, Kommand. Inspire

Intelygenz 170 Oct 29, 2021
⚡️ Lightweight full-featured Promises, Async & Await Library in Swift

Lightweight full-featured Promises, Async & Await Library in Swift What's this? Hydra is full-featured lightweight library which allows you to write b

Daniele Margutti 1.9k Nov 13, 2021
Willow is a powerful, yet lightweight logging library written in Swift.

Willow Willow is a powerful, yet lightweight logging library written in Swift. Features Requirements Migration Guides Communication Installation Cocoa

Nike Inc. 1.3k Nov 6, 2021
A lightweight library to calculate tensors in Swift, which has similar APIs to TensorFlow's

TensorSwift TensorSwift is a lightweight library to calculate tensors, which has similar APIs to TensorFlow's. TensorSwift is useful to simulate calcu

Qoncept, Inc. 323 Sep 17, 2021
🍁🥓 Lightweight and fast Swift library for image downloading, caching and transformations

MapleBacon Introduction MapleBacon is a lightweight and fast Swift library for downloading and caching images. Example The folder Example contains a s

Jan Gorman 330 Nov 11, 2021
A lightweight, pure-Swift library for downloading and caching images from the web.

Kingfisher is a powerful, pure-Swift library for downloading and caching images from the web. It provides you a chance to use a pure-Swift way to work

Wei Wang 19.4k Nov 16, 2021
Lightweight library for web server applications in Swift on macOS and Linux powered by coroutines.

Why Zewo? • Support • Community • Contributing Zewo Zewo is a lightweight library for web applications in Swift. What sets Zewo apart? Zewo is not a w

Zewo 1.9k Nov 17, 2021
A lightweight library for writing HTTP web servers with Swift

Taylor Disclaimer: Not actively working on it anymore. You can check out some alternatives Swift 2.0 required. Working with Xcode 7.1. Disclaimer: It

Jorge Izquierdo 932 Nov 17, 2021