Skip to content

Latest commit

 

History

History
193 lines (145 loc) · 3.16 KB

README.md

File metadata and controls

193 lines (145 loc) · 3.16 KB

Usage

Set the node base URI

const arionum = new Arionum()
arionum.nodeAddress = 'https://node-uri-here'

Get an address from a public key

arionum.getAddress('public-key').then(address => {
  console.log(address)
})

Get a Base58-encoded version of a string

arionum.getBase58('string-data').then(base58 => {
  console.log(base58)
})

Get the balance for an address

arionum.getBalance('address').then(balance => {
  console.log(balance)
})

Get the pending balance for an address

arionum.getPendingBalance('address').then(pendingBalance => {
  console.log(pendingBalance)
})

Get the transactions for an address

arionum.getTransactions('address').then(transactions => {
  console.log(transactions)
})

Get the transactions for a public key

arionum.getTransactionsByPublicKey('public-key').then(transactions => {
  console.log(transactions)
})

Get the transaction by its id

arionum.getTransaction('transaction-id').then(transaction => {
  console.log(transaction)
})

Get the public key for an address

arionum.getPublicKey('address').then(publicKey => {
  console.log(publicKey)
})

Generate a new account

arionum.generateAccount().then(accountDetails => {
  console.log(accountDetails)
})

Get the current block

arionum.getCurrentBlock().then(block => {
  console.log(block)
})

Get a specific block by its height

arionum.getBlock(1).then(block => {
  console.log(block)
})

Get transactions for a specific block

arionum.getBlockTransactions('block-id').then(transactions => {
  console.log(transactions)
})

Get version of the current node

arionum.getNodeVersion().then(version => {
  console.log(version)
})

Get the number of transactions in the mempool

arionum.getMempoolSize().then(size => {
  console.log(size)
})

Get a random number based on a specified block

arionum.getRandomNumber(1, 1, 1000).then(number => {
  console.log(number)
})

Get a list of available masternodes on the network

arionum.getMasternodes().then(masternodes => {
  console.log(masternodes)
})

Get the alias for a specific address

arionum.getAlias('address').then(alias => {
  console.log(alias)
})

Send a transaction

let transaction = new Transaction()

transaction.value = 1
transaction.destinationAddress = '...'
transaction.publicKey = '...'
transaction.signature = '...'
transaction.date = 1
transaction.message = '...'

arionum.sendTransaction(transaction).then(result => {
  console.log(result)
})

Get details about the nodes sanity process

arionum.getSanityDetails().then(sanityDetails => {
  console.log(sanityDetails)
})

Get details about the node

arionum.getNodeInfo().then(nodeInfo => {
  console.log(nodeInfo)
})

Check the validity of a signature

arionum.checkSignature('signature', 'data', 'public-key').then(signatureStatus => {
  console.log(signatureStatus)
})

Check the validity of an address

arionum.checkAddress('address').then(addressStatus => {
  console.log(addressStatus)
})