Skip to content

Swift 4 library for Lisk - Including Local Signing for maximum security

License

Notifications You must be signed in to change notification settings

AndrewBarba/lisk-swift

Repository files navigation

Lisk Swift

Build Status CocoaPods Compatible Carthage Compatible Twitter

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

Features

  • Local Signing for maximum security
  • Targets Lisk 1.0.0 API
  • Directly based on lisk-js
  • Swift 4.0
  • Unit Tests (87% coverage)
  • Documentation

API

Documentation

https://andrewbarba.github.io/lisk-swift/

Usage

Import Framework

import Lisk

Send LSK

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)
    }
}

Send LSK on Testnet

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)
    }
}

Testnet

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()

Requirements

  • iOS 10.0+ / macOS 10.12+ / tvOS 10.0+ / watchOS 3.0+
  • Xcode 9.0+
  • Swift 4.0+

Installation

Swift Package Manager

// 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

CocoaPods 1.1.0+ is required to build lisk-swift

pod 'Lisk', '~> 1.0.0-beta'

Carthage

github "AndrewBarba/lisk-swift" ~> 1.0.0-beta

Thank You

To show support for continued development feel free to vote for my delegate: andrew

Or donate LSK to 14987768355736502769L

About

Swift 4 library for Lisk - Including Local Signing for maximum security

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages