Unleash awesomeness. Private packages, team management tools, and powerful integrations. Get started with npm Orgs »

arionum-js

1.3.0 • Public • Published

arionum-js

Latest Version on npm Software License Build Status Code Coverage Total Downloads

An API wrapper for the Arionum cryptocurrency node.

Install

Via npm

$ npm install arionum-js

Via Yarn

$ yarn add arionum-js

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

Change log

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please email owzie123@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Keywords

none

install

npm i arionum-js

Downloadsweekly downloads

4

version

1.3.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability