Skip to content

sayler8182/RxLisk-iOS

Repository files navigation

Swift 5 library for Lisk Blockchain

RxLisk is a Swift 5 library for Lisk - the cryptocurrency and blockchain application platform. It allows developers to interact with the core Lisk API, for retrieval of collections and single records of data located on the Lisk blockchain. Its does't require a locally installed Lisk node, and instead utilizes the existing peers on the network (mainnet or testnet). It can be used on iOS environment.

Lisk Swift is heavily inspired by Lisk Swift and Lisk JS

Features

  • Local Signing for maximum security
  • Targets Lisk 1.6.0 API
  • Based on lisk-swift and lisk-js
  • Swift 5.0
  • Unit Tests
  • Documentation

API

  • Accounts
  • Blocks
  • Dapps
  • Delegates
  • Node
  • Peers
  • Signatures
  • Transactions
  • Voters
  • Votes

Requirements

  • iOS 10.0+
  • Xcode 10.0+
  • Swift 5.0+

Installation

Swift Package Manager

TODO:

CocoaPods

TODO:

Carthage

TODO:

Dependencies

Usage

Import Framework

import RxLisk

Environment

By default, all modules are initialized with an LiskNodeConfig pointing to the Lisk Mainnet. You can optionally pass in a specific client to any modules constructor:

// mainnet
let mainTransactions = LiskTransactions()

// testnet
let testTransactions = LiskTransactions(nodeConfig: .testnet)

// custom
let customNodeConfig = LiskNodeConfig(
    ssl: true,
    node: LiskNode(hostname: "custom.host.name"),
    port: 8888)
let customTransactions = LiskTransactions(nodeConfig: customNodeConfig)

Accounts

All accounts

let accountsModule = LiskAccounts()

// get accounts
module
    .accounts()
    .subscribe(
        onSuccess: { (accounts) in
            print(accounts.meta.offset)
            print(accounts.data.count) },
        onError: { (error) in
            print(error.localizedDescription) }
    )

Account with specific address

let address = ...
let accountsModule = LiskAccounts()

// get account info
module
    .account(address: address)
    .subscribe(
        onSuccess: { (account) in
            print(account.balance) },
        onError: { (error) in
            print(error.localizedDescription) }
    )

Send LSK

let recipientId = ...
let secret = ...
let transactionsModule = LiskTransactions()

// sign transaction
try transaction.sign(secret: secret)

// send transaction
transactionsModule
    .sendTransaction(transaction: transaction) 
    .subscribe(
        onSuccess: { (response) in
            print(response.meta.status)
            print(response.data.message) },
        onError: { (error) in
            print(error.localizedDescription) }
    )
}

Thank You

To show support for continued development feel free to donate LSK to 8985905004777775964L

Or vote delegate who was an inspiration: andrew