react-native-chainz
v1.0.0
Published
React Native wrapper for the CryptoID Blockchain Explorers API. Uses Fetch so it drops in neatly into any React Native App. In addition to Phore (PHR), it works for any Altcoin for which Chainz has a code. Sample commands include getting the balance of an
Downloads
5
Maintainers
Readme
React-Native-Chainz
A React Native wrapper for the CryptoID Blockchain Explorer API. Uses Fetch so it drops in neatly into any React Native App. In addition to Phore (PHR), it works for any Altcoin for which Chainz has a code.
Installation
Using npm:
npm install react-native-chainz --save
In React Native:
import * as phorechainz from 'react-native-chainz' // doesn't phorechainz sound a bit like Fortunes? I think it does...
phorechainz.getPhoreBalance(address).then(console.log) // returns the current balance for the provide Phore (PHR) address
phorechainz.getAltBalance(altcoin, address).then(console.log) // returns the current balance for the address provided for the specified Altcoin - using the Chainz code for the Altcoin. More info at https://chainz.cryptoid.info
phorechainz.getAddresses(altcoin).then(console.log) // returns a JSON object with the number of known and non-zero addresses (with funds) - for Phore use the code 'phr'
phorechainz.getCirculating(altcoin).then(console.log) // returns the number of circulating coins (minus reserve, Prime holdings...)
phorechainz.getBlockcount(altcoin).then(console.log) // returns the current block height as a plain text string
phorechainz.getDifficulty(altcoin).then(console.log) // returns the difficulty as a plain text string
phorechainz.getHashrate(altcoin).then(console.log) // returns the hashrate in GH/s (when supported, blockchain.info API compatible)
phorechainz.getNethashps(altcoin).then(console.log) // returns the hashrate in H/s (when supported)
phorechainz.getNetmhashps(altcoin).then(console.log) // returns the hashrate in MH/s (when supported)
phorechainz.getRich(altcoin).then(console.log) // returns the rich list top 1000 (JSON format)
phorechainz.getTotalcoins(altcoin).then(console.log) // returns the outstanding number of coinsr
phorechainz.getAddressFirstSeen(altcoin, address).then(console.log) // returns the date and time of the block in which the address was first seen, or a string begining with "ERROR:" otherwise.
phorechainz.getReceivedByAddress(altcoin, address).then(console.log) // returns the amount received by the address (sum of vout). For incorrect addresses or addresses never seen on the network, the returned amount is zero. Can be delayed by up to 1 hour.
phorechainz.getRichRank(altcoin, address).then(console.log) // returns the rich list rank for the address.
phorechainz.getLasttxs(altcoin).then(console.log) // returns the last ten transactions (with at least one confirmation), excluding coinbase and stake transactions
phorechainz.getTxinfo(altcoin, txHash).then(console.log) // returns summary information about a transaction (confirmations, fees, inputs & output addresses and amounts).