Lisk Swift is a Swift 4 library for Lisk - the cryptocurrency and blockchain application platform. It allows developers to create offline transactions and broadcast them onto the network. It also allows developers to interact with the core Lisk API, for retrieval of collections and single records of data located on the Lisk blockchain. Its main benefit is that it does not require a locally installed Lisk node, and instead utilizes the existing peers on the network. It can be used on any environment that runs Swift 4, including iOS, tvOS, macOS, watchOS.
Lisk Swift is heavily inspired by Lisk JS
- Local Signing for maximum security
- Targets Lisk 1.0.0 API
- Directly based on lisk-js
- Swift 4.0
- Unit Tests (87% coverage)
- Documentation
https://andrewbarba.github.io/lisk-swift/
import Lisk
let address = ...
let secret = ...
// Send LSK on the Mainnet
Transactions().transfer(lsk: 1.12, to: address, secret: secret) { response in
switch response {
case .success(let result):
print(result.transactionId)
case .error(let error):
print(error.message)
}
}
let address = ...
let secret = ...
// Send LSK on the Testnet
Transactions(client: .testnet).transfer(lsk: 1.12, to: address, secret: secret) { response in
switch response {
case .success(let result):
print(result.transactionId)
case .error(let error):
print(error.message)
}
}
By default, all modules are initialized with an APIClient
pointing to the Lisk Mainnet. You can optionally pass in a specific client to any modules constructor:
let mainTransactions = Transactions()
let testTransactions = Transactions(client: .testnet)
To default all modules to a specific client you can set the shared client:
APIClient.shared = .testnet
And then all modules initialized will default to Testnet:
// This will connect to Testnet
let transactions = Transactions()
- iOS 10.0+ / macOS 10.12+ / tvOS 10.0+ / watchOS 3.0+
- Xcode 9.0+
- Swift 4.0+
// swift-tools-version:4.0
import PackageDescription
let package = Package(
name: "My Lisk App",
dependencies: [
.package(url: "https://github.com/AndrewBarba/lisk-swift.git", from: "1.0.0-beta")
]
)
CocoaPods 1.1.0+ is required to build lisk-swift
pod 'Lisk', '~> 1.0.0-beta'
github "AndrewBarba/lisk-swift" ~> 1.0.0-beta
To show support for continued development feel free to vote for my delegate: andrew
Or donate LSK to 14987768355736502769L