Clone or download
Latest commit 751c076 Oct 3, 2018

README.md

Version CI Status Version Platform License Last commit

MinterCore

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

MinterCore is available through CocoaPods. To install

it, simply add the following line to your Podfile:

pod 'MinterCore'

How-to

import MinterCore

Get balance

let accountManager = AccountManager.default
accountManager.balance(address: "Mx6b6b3c763d2605b842013f84cac4d670a5cb463d") { (resp, error) in
  print("Resp: \(String(describing: resp))")
  print("Error: \(String(describing: error))")
}

Get coin info

let coinManager = CoinManager.default
coinManager.info(symbol: "SHSCOIN") { (coin, error) in
  print("Coin: \(coin)")
  print("Error: \(error)")
}

Get estimate coin buy

coinManager.estimateCoinBuy(from: "MNT", to: "BELTCOIN", amount: Decimal(string: "10000000000000")!) { (value, commission, error) in
  print("Value: \(value)")
  print("Commission: \(commission)")
  print("Error: \(error)")
}

Get estimate coin sell

coinManager.estimateCoinSell(from: "MNT", to: "BELTCOIN", amount: Decimal(string: "10000000000000")!) { (value, commission, error) in
  print("Value: \(value)")
  print("Commission: \(commission)")
  print("Error: \(error)")
}

Get transaction

let transactionManager = CoreTransactionManager.default
transactionManager.transaction(hash: "Mt6e59d0ad0286c1ec3539de71eb686cad42e7c741") { (transaction, error) in
  print("Transaction: \(transaction)")
}

Send transaction

import MinterCore
import BigInt
/// Prepeare data
let sendData = SendCoinRawTransactionData(to: "Mx6b6b3c763d2605b842013f84cac4d670a5cb463d", value: BigUInt(decimal: 1 * TransactionCoinFactorDecimal)!, coin: "MNT").encode()
/// Make 'send' raw transaction
let rawTransaction = SendCoinRawTransaction(nonce: BigUInt(1), gasCoin: "MNT", data: sendData!)
/// Sign raw transaction with private key
let signedTx = RawTransactionSigner.sign(rawTx: rawTransaction, privateKey: "8da1c947b489399a5b07b6bd3d9bb41f7647bb01a28303431b6993a8092f0bed")!
/// Send raw transaction
transactionManager.send(tx: signedTx) { (txHash, resultText, error) in
  print(txHash)
  print(resultText)
  print(error)
}

Get nonce

transactionManager.transactionCount(address: "Mx6b6b3c763d2605b842013f84cac4d670a5cb463d") { (nonce, error) in
  print("Count: \(nonce)")
  print("Error: \(error)")
}

Get candidate

let candidateManager = CandidateManager.default
candidateManager.candidate(publicKey: "Mp740b1b0f0f4b29cb2fc73e53c8e4b34966a89a97d4e1b86903db6ca2cc1c1596") { (candidate, error) in
  print(candidate)
  print(error)
}

Get validators

let validatorManager = ValidatorManager.default
validatorManager.validators { (validators, error) in
  print(validators)
  print(error)			
}

Get status

let statusManager = StatusManager.default

statusManager.status { (status, error) in
  print(status)
  print(error)
}

Get base coin volume

statusManager.baseCoinVolume(height: 2) { (volume, error) in
  print(volume)
  print(error)
}

Author

sidorov.panda, ody344@gmail.com

License

MinterCore is available under the MIT license. See the LICENSE file for more info.