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

cryptoapis.io

1.0.8 • Public • Published

Cryptoapis.io

CryptoAPIs SDK for all Exchanges, Bitcoin and Ethereum endpoints. You can get API key here.

Table of Contents

Install

$ npm install cryptoapis.io

How to use

const CryptoApis = require('cryptoapis.io');
 
const apiKey = 'your API key';
 
var caClient = new CryptoApis(apiKey);
 
caClient.getAllExchanges().then(function(result) {
 
    console.log(result);
}, function(error) {
    console.log(error);
});

Check out CryptoAPIs documentation for more information.

Functions

constructor

Parameters

getAllExchanges

Get a detailed list of all supported exchanges provided by CryptoAPIs.

Parameters

  • skip (optional) Number Offset results. Default value is 0
  • limit (optional) Number Limit results. Default limit is 100

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var skip = 0;
var limit = 20;
var caClient = new CryptoApis(apiKey);
caClient.getAllExchanges(skip, limit).then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

getAllAssets

Get detailed list of all associated assets.

Parameters

  • skip (optional) Number Offset results. Default value is 0
  • limit (optional) Number Limit results. Default limit is 100

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var skip = 0;
var limit = 5;
var caClient = new CryptoApis(apiKey);
caClient.getAllAssets(skip, limit).then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

getAllSymbols

Get a detailed list of all symbol mappings.

Parameters

  • skip (optional) Number Offset results. Default value is 0
  • limit (optional) Number Limit results. Default limit is 100

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var skip = 0;
var limit = 10;
var caClient = new CryptoApis(apiKey);
caClient.getAllSymbols(skip, limit).then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

getSpecificRate

Get exchange rates between pair of requested assets.

Parameters

  • baseAsset String Base asset identifier
  • quoteAsset String Quote asset identifier

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.getSpecificRate('BTC', 'USD').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

getAllCurrentRates

Get the current exchange rate between requested asset and all other assets.

Parameters

  • baseAsset String Base asset identifier

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.getAllCurrentRates('BTC').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

getOHLCVPeriods

Get full list of time periods available for requesting OHLCV data.

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.getOHLCVPeriods().then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

getOHLCVLatestData

Get OHLCV latest time-series data for requested symbol and period, returned in time descending order.

Parameters

  • symbol String Symbol identifier used to filter response.
  • period String Period
  • limit (optional) Number Limit results. Default limit is 100

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.getOHLCVLatestData('5bfc329f9c40a100014dc5a7', '1day', 10).then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

getOHLCVHistoricalData

Get OHLCV time-series data for requested symbol and period, returned in time ascending order.

Parameters

  • symbol String Symbol identifier used to filter response.
  • period String Period
  • timePeriodStart (Number | String) Time period start
  • timePeriodEnd (Number | String) Time period end
  • limit (optional) Number Limit results. Default limit is 100

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.getOHLCVHistoricalData('5bfc329f9c40a100014dc5a7', '1day', 1542955177, 1556355177, 2).then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

tradesGetLatestData

Get latest trades from all symbols up to 1 hour ago

Parameters

  • skip (optional) Number Offset results. Default value is 0
  • limit (optional) Number Limit results. Default limit is 100

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.tradesGetLatestData(0, 10).then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

tradesGetLatestDataBySymbol

Get latest trades from a specific symbol without time limitation

Parameters

  • symbol String Symbol identifier used to filter response.

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.tradesGetLatestDataBySymbol('5bfc329f9c40a100014dc5a7').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

tradesGetHistoricalData

Get history transactions from specific symbol, returned in time ascending order. If no start & end time is defined, your data results will be provided 24 hours back, by default.

Parameters

  • symbol_id String Symbol identifier used to filter response.
  • timeStart (Number | String) Time start
  • timeEnd (Number | String) Time end
  • skip (optional) Number Offset results. Default value is 0
  • limit (optional) Number Limit results. Default limit is 100

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.tradesGetHistoricalData('5bfc329f9c40a100014dc5a7', 1542955177, 1556355177, 0, 10).then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

quotesGetLatestData

Get latest quote updates for up to 1 hour ago.

Parameters

  • skip (optional) Number Offset results. Default value is 0
  • limit (optional) Number Limit results. Default limit is 100

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.quotesGetLatestData().then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

quotesGetHistoricalData

Get historical quote updates within requested time range, returned in time ascending order.

Parameters

  • symbol_id String Symbol identifier used to filter response.
  • timeStart (Number | String) Time start
  • timeEnd (Number | String) Time end
  • skip (optional) Number Offset results. Default value is 0
  • limit (optional) Number Limit results. Default limit is 100

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.quotesGetHistoricalData('5bfc329f9c40a100014dc5a7', 1532955177, 1556355177, 0, 50).then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

getBitcoinInfo

General information about a blockchain.

Parameters

  • network String Network name (mainnet or testnet)

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.getBitcoinInfo('mainnet').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

getBitcoinBlock

Block endpoint gives you detail information for particular block in the blockchain.

Parameters

  • network String Network name (mainnet or testnet)
  • block (Number | String) Block height or block hash

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.getBitcoinBlock('mainnet', 546903).then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

getBitcoinLatestBlock

Latest Block Endpoint gives you detail information for the latest block in the blockchain.

Parameters

  • network String Network name (mainnet or testnet)

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.getBitcoinLatestBlock('mainnet').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

getBitcoinAddressInfo

The default Address Endpoint strikes a general information about addresses.

Parameters

  • network String Network name (mainnet or testnet)
  • address String Bitcoin address

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.getBitcoinAddressInfo('mainnet', '1DBrYbe5U7LGDcHA5tiLCxivZ7JZAGqGhJ').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

generateBitcoinAddress

The Generate Address endpoint allows you to generate private-public key-pairs along with an associated public address.

Parameters

  • network String Network name (mainnet or testnet)

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.generateBitcoinAddress('mainnet').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

getBitcoinAddressTransactions

The Address Transactions Endpoint returns all information available about a particular address, including an array of complete transactions.

Parameters

  • network String Network name (mainnet or testnet)
  • address String Bitcoin address
  • index (optional) Number Offset results. Default value is 0
  • limit (optional) Number Limit results. Default limit is 50

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.getBitcoinAddressTransactions('mainnet', '3DrVotri9Rq2xcHqCMKpVUoyU6pvoWRtY3', 0, 10).then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

createBitcoinWallet

Create Bitcoin Wallet

Parameters

  • network String Network name (mainnet or testnet)
  • name String Wallet name
  • addresses Array<String> Array of addresses that will be added to wallet

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
var addresses = ["1MfyBywPTSj9aAPr8cccCTcch71fd4vkDA", "1B5WsYR8m4axbmEMMifveDL2gtZjtpaFr5", "1KRYkrh3dAkeBWPwxDZhrz9u8xf5NRK9UH"];
caClient.createBitcoinWallet('mainnet', 'myWallet', addresses).then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

createBitcoinHDWallet

Create Bitcoin HD Wallet

Parameters

  • network String Network name (mainnet or testnet)
  • name String Wallet name
  • addressCount Number Number of addresses that should be generated in new wallet
  • password String Wallet password

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.createBitcoinHDWallet('mainnet', 'myHDWallet', 5, 'jr9023kes%kj').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

listBitcoinWallets

List Wallets

Parameters

  • network String Network name (mainnet or testnet)
  • hd Boolean False for normal wallets, true for HD wallets

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.listBitcoinWallets('mainnet', true).then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

getBitcoinWallet

Get Wallet

Parameters

  • network String Network name (mainnet or testnet)
  • walletName String Wallet name
  • hd Boolean False for normal wallets, true for HD wallets

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.getBitcoinWallet('mainnet', 'myHDWallet', true).then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

addAddressToBitcoinWallet

Add Addresses to Wallet

Parameters

  • network String Network name (mainnet or testnet)
  • walletName String Wallet name
  • addresses Array<String> Array of addresses that will be added to wallet

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.addAddressToBitcoinWallet('mainnet', 'myWallet', ['1Eeu3eC2b35LWtjXeRMJMSfrDnfDEjNwW6']).then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

generateAddressInBitcoinWallet

Generate Address in Wallet

Parameters

  • network String Network name (mainnet or testnet)
  • walletName String Wallet name

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.generateAddressInBitcoinWallet('mainnet', 'myWallet').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

generateAddressInBitcoinHDWallet

Generate Address in HD Wallet

Parameters

  • network String Network name (mainnet or testnet)
  • walletName String Wallet name
  • addressCount Number Number of addresses that should be generated
  • password String Wallet password

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.generateAddressInBitcoinHDWallet('mainnet', 'myHDWallet', 2, 'jr9023kes%kj').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

deleteAddressFromBitcoinWallet

Remove Addresses from Wallet

Parameters

  • network String Network name (mainnet or testnet)
  • walletName String Wallet name
  • address String Address which should be deleted

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.deleteAddressFromBitcoinWallet('mainnet', 'myWallet', '1GdnJh1r3xWsst7o7JXykgGD13AF4NSmh3').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

deleteBitcoinWallet

Delete Wallet

Parameters

  • network String Network name (mainnet or testnet)
  • walletName String Wallet name
  • hd Boolean False for normal wallets, true for HD wallets

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.deleteBitcoinWallet('mainnet', 'myWallet', false).then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

getBitcoinTransaction

Returns detailed information about a given transaction based on its id.

Parameters

  • network String Network name (mainnet or testnet)
  • transactionID String Transaction ID

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.getBitcoinTransaction('mainnet', '54287345c01d64a3365166b380adf04e738ec52935f2751aead7ae60ff4fcb21').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

getBitcoinTransactionByBlockIndex

Returns detailed information about a given transaction based on its hash and index of transaction in the block.

Parameters

  • network String Network name (mainnet or testnet)
  • blockHash String Block hash
  • index Number Index of the transaction in block

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.getBitcoinTransactionByBlockIndex('mainnet', '0000000000000000002523785a5a3a0f4a04536baf589f9c5fbf2b6273daf62b', 3).then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

getBitcoinTransactionsByBlockIndex

The Transaction Index Endpoint by Index, Limit and Block Height returns detailed information about transactions for the block height defined, starting from the index defined up to the limit defined.

Parameters

  • network String Network name (mainnet or testnet)
  • blockHeight Number Block height
  • index Number Index - start from
  • limit Number Limit - up to

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.getBitcoinTransactionsByBlockIndex('mainnet', 553394, 0, 3).then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

getBitcoinUnconfirmedTransactions

Returns an array of the latest transactions relayed by nodes in a blockchain that haven’t been included in any blocks.

Parameters

  • network String Network name (mainnet or testnet)

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.getBitcoinUnconfirmedTransactions('mainnet').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

bitcoinTransactionTrace

Returns detailed information about a given set of transactions based on theirs hashes.

Parameters

  • network String Network name (mainnet or testnet)
  • transactions Array<String> Array of transactions

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
var txs = ['54287345c01d64a3365166b380adf04e738ec52935f2751aead7ae60ff4fcb21', '4ed3bbc8297b69a002ac7dc5fcf0acf01f6ffd92871c1027061a7eabc1e74623'];
caClient.bitcoinTransactionTrace('mainnet', txs).then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

getBitcoinLatestTransactions

Returns an array of the latest transactions relayed by nodes in a blockchain that could be mined or not.

Parameters

  • network String Network name (mainnet or testnet)
  • limit Number Limit. Default limit is 50

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.getBitcoinLatestTransactions('mainnet', 10).then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

getBitcoinTransactionsHistory

Returns an array of the latest transactions. By default it is for last 24 hours

Parameters

  • network String Network name (mainnet or testnet)
  • txsIncluded Boolean Whether transactions to be included in response. Default true
  • index (optional) Number Offset results. Default value is 0
  • limit (optional) Number Limit. Default limit is 50

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.getBitcoinTransactionsHistory('mainnet', true, 0, 5).then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

createBitcoinTransaction

Create transaction

Parameters

  • network String Network name (mainnet or testnet)
  • inputs Array<Object> Array of objects (see example below)
  • outputs Array<Object> Array of objects (see example below)
  • fee Number Transaction fee

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
var inputs = [{
    address: "2N4Peeewfgghac69z6evCAmab91oEuWmkgy",
    value: 0.54
}, {
    address: "2MuqsmttygX6RWkxS1MLjDgwJ2DavbG9JPu",
    value: 1.0
}];
var outputs = [{
    address: "2Mx93LzsoPWR8UmoJMBFnCb2KkCGt2Jg8Dd",
    value: 1.54
}];
caClient.createBitcoinTransaction('testnet', inputs, outputs, 0.00001500).then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

sendBitcoinTransaction

Send Transaction

Parameters

  • network String Network name (mainnet or testnet)
  • toSend String Signed hash

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
var toSend = '02000000013f810859c03252a897dc1f5707ed9a3a5234ec4ef0ddafca9d933a0d32375380000000006a4730440220789cf627bc7e84e97dae9e94b97f6a790492511ad0be63afe424953846f9306a02206b99656cc96e58a717d5f47126b2ba49d612d9ef5ffb2d8b707d64d7629a776d0121023cf830a861754675344b72f0ef3654d5d47f156f7800cc6926b10309acf68899ffffffff011ced3200000000001976a914b20ecbedbb8c648e263487d40ab234cecefd34d588ac00000000';
caClient.sendBitcoinTransaction('testnet', toSend).then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

decodeRawBitcoinTransaction

Decode Raw Transaction

Parameters

  • network String Network name (mainnet or testnet)
  • txHex String Hex of raw transaction

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
var txHex = '0200000005c1ab663c05cc557f522d55d42734eb3fe7bfacf3737cba5102233b312b0c95590000000000ffffffffbfd5dc9ac3129f2a9788d0ab2c201861790d66ce147bf6ebe8ee44019b69ed790100000000ffffffff2837839555246cc3f0f9374f73030341d641f3beae71eeafb2461f8ba8daa1d40000000000ffffffffbe23166dca2f0b9a24d9704e5e6ecfe3e57265cda29468e68c19644d24e1f1c70000000000ffffffff41994176b4bb3f00bb128a982b907e0a3b139ac02d90253c61815dea3d16f98d0000000000ffffffff0140420f00000000001976a9141a96349a5025735fe18f3e783098e471edbad83388ac00000000';
caClient.decodeRawBitcoinTransaction('mainnet', txHex).then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

bitcoinCreatePayment

Create Payment

Parameters

  • network String Network name (mainnet or testnet)
  • fromAddress String Destination bitcoin address
  • toAddress String Target bitcoin address
  • callbackURL String Callback URL
  • walletName String Wallet created by current
  • password String Wallet password

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.bitcoinCreatePayment('mainnet', '12CHjjowV5koCpyMXHeYFhMQzd4KE6JUdF', '1DoAHYHRd72RBbScbr678vXhAwHPPfhY34', 'your callback url', 'myHDWallet', 'jr9023kes%kj').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

bitcoinListPayment

To list your currently active payment forwarding addresses

Parameters

  • network String Network name (mainnet or testnet)

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.bitcoinListPayment('mainnet').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

bitcoinDeletePayment

Delete Payment

Parameters

  • network String Network name (mainnet or testnet)
  • paymentID String Generated UUID when payment forwarding have been created

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.bitcoinDeletePayment('mainnet', '1f3e4771-ce6c-4b25-805b-cc27a38e2603').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

bitcoinCreateUnconfirmedTransactionWebHook

Triggered for every new transaction CryptoAPIs receives before it's confirmed in a block, basically, for every unconfirmed transaction.

Parameters

  • network String Network name (mainnet or testnet)
  • callbackURL String Callback URL

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.bitcoinCreateUnconfirmedTransactionWebHook('mainnet', 'your callback url').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

bitcoinCreateNewBlockWebHook

Triggered for every new block.

Parameters

  • network String Network name (mainnet or testnet)
  • callbackURL String Callback URL

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.bitcoinCreateNewBlockWebHook('mainnet', 'your callback url').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

bitcoinCreateConfirmedTransactionWebHook

Create Confirmed Transaction WebHook

Parameters

  • network String Network name (mainnet or testnet)
  • callbackURL String Callback URL
  • transaction String Transaction ID
  • confirmations Number Confirmations

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.bitcoinCreateConfirmedTransactionWebHook('mainnet', 'your callback url', '56ee588e6ac4df324d5e1cdd0fa7d58a479295bad71f3c62865f1c302e0ca2a6', 5).then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

bitcoinCreateAddressTransactionWebHook

Create Address Transaction WebHook

Parameters

  • network String Network name (mainnet or testnet)
  • callbackURL String Callback URL
  • address String Bitcoin address

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.bitcoinCreateAddressTransactionWebHook('mainnet', 'your callback url', '1GdnJh1r3xWsst7o7JXykgGD13AF4NSmh3').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

listAllBitcoinHooks

List all web hooks that you have created.

Parameters

  • network String Network name (mainnet or testnet)

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.listAllBitcoinHooks('mainnet').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

deleteBitcoinWebHook

Delete a WebHook by WebHook ID

Parameters

  • network String Network name (mainnet or testnet)
  • webhookID String WebHook ID

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.deleteBitcoinWebHook('mainnet', '232c9f47-ff47-401c-9681-9d854e497c8a').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

getEthereumInfo

General information about Ethereum blockchain.

Parameters

  • network String Network name (mainnet, ropsten or rinkeby)

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.getEthereumInfo('mainnet').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

getEthereumBlock

Information for particular block in the blockchain.

Parameters

  • network String Network name (mainnet, ropsten or rinkeby)
  • block (Number | String) Block height or block hash

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.getEthereumBlock('mainnet', 6873814).then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

getEthereumLatestBlock

Latest Block method gives you detail information for the latest block in the blockchain

Parameters

  • network String Network name (mainnet, ropsten or rinkeby)

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.getEthereumLatestBlock('mainnet').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

getEthereumAddressBalance

Get address balance

Parameters

  • network String Network name (mainnet, ropsten or rinkeby)
  • address String Ethereum address

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.getEthereumAddressBalance('ropsten', '0x0cb1883c01377f45ee5d7448a32b5ac1709afc11').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

getEthereumAddressInfo

Get address information

Parameters

  • network String Network name (mainnet, ropsten or rinkeby)
  • address String Ethereum address

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.getEthereumAddressInfo('ropsten', '0x0cb1883c01377f45ee5d7448a32b5ac1709afc11').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

getEthereumAddressTransactions

Returns all transactions specified by the query params: index and limit.

Parameters

  • network String Network name (mainnet, ropsten or rinkeby)
  • address String Ethereum address
  • index (optional) Number Start from. Default value is 0
  • limit (optional) Number Limit. Default limit is 50

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.getEthereumAddressTransactions('ropsten', '0x0cb1883c01377f45ee5d7448a32b5ac1709afc11', 0, 10).then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

generateEthereumAddress

Generate private-public key-pairs along with an associated public address.

Parameters

  • network String Network name (mainnet, ropsten or rinkeby)

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.generateEthereumAddress('mainnet').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

generateEthereumAccount

Generate private-public key-pairs along with an associated public address encoded in a keyfile.

Parameters

  • network String Network name (mainnet, ropsten or rinkeby)
  • password String Password

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.generateEthereumAccount('mainnet', 'kl423jkls$3kl').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

getEthereumTransaction

Returns detailed information about a given transaction based on its hash.

Parameters

  • network String Network name (mainnet, ropsten or rinkeby)
  • txHash String Transaction hash

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.getEthereumTransaction('mainnet', '0x52afade154e72b3f9059f9a0330bd8f9c9b6ccf73f9a6ef75fa6814bf941ceae').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

getEthereumTransactionsByBlock

Get ethereum transactions by block number

Parameters

  • network String Network name (mainnet, ropsten or rinkeby)
  • block String Block number
  • index (optional) Number Start from. Default value is 0
  • limit (optional) Number Limit. Default limit is 50

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.getEthereumTransactionsByBlock('mainnet', 6878377, 0, 10).then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

getEthereumTransactionByIndexInBlock

Returns detailed information about a given transaction based on its index and block.

Parameters

  • network String Network name (mainnet, ropsten or rinkeby)
  • block (Number | String) Block height or block hash
  • index (optional) Number Index of the transaction in block

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.getEthereumTransactionByIndexInBlock('mainnet', 6878377, 0).then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

createEthereumTransaction

Create new transaction using keystore file stored on our server. In order to use this endpoint you should have an account (keystore file) stored on our servers.

Parameters

  • network String Network name (mainnet, ropsten or rinkeby)
  • from String Input address
  • to String Output address
  • gasPrice Number Gas price
  • gasLimit Number Gas limit
  • value Number Value to transfer (in Ether)
  • password String Account password

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.createEthereumTransaction('ropsten', '0xc56b7f5264eb24b6b2bf2eb59184c521f0770d52', '0x0cb1883c01377f45ee5d7448a32b5ac1709afc11', 21000000000, 21000, 1.12, 'kl423jkls$3kl').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

createEthereumTransactionWithPrivateKey

Create new transaction for address which is not hold on Crypto APIs servers.

Parameters

  • network String Network name (mainnet, ropsten or rinkeby)
  • from String Input address
  • to String Output address
  • gasPrice Number Gas price
  • gasLimit Number Gas limit
  • value Number Value to transfer (in Ether)
  • privateKey String Private key

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.createEthereumTransactionWithPrivateKey('ropsten', '0xc56b7f5264eb24b6b2bf2eb59184c521f0770d52', '0x0cb1883c01377f45ee5d7448a32b5ac1709afc11', 21000000000, 21000, 1.12, '0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

sendEthereumTransaction

Send transaction

Parameters

  • network String Network name (mainnet, ropsten or rinkeby)
  • from String Input address
  • to String Output address
  • value Number Value to transfer (in Ether)

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.sendEthereumTransaction('ropsten', '0xc56b7f5264eb24b6b2bf2eb59184c521f0770d52', '0x0cb1883c01377f45ee5d7448a32b5ac1709afc11', 1.12).then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

pushEthereumTransaction

Push transaction

Parameters

  • network String Network name (mainnet, ropsten or rinkeby)
  • signedTx String Hex-encoded raw representation of your transaction

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
var signedTx = '0xf86a22827d00831e8480941b85a43e2e7f52e766ddfdfa2b901c42cb1201be8801b27f33b807c0008029a084ccbf02b27e0842fb1eda7a187a5589c3759be0e969e0ca989dc469a5e5e394a02e111e1156b197f1de4c1d9ba4af26e50665ea6d617d05b3e4047da12b915e69';
caClient.pushEthereumTransaction('ropsten', signedTx).then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

estimateEthereumTransactionGas

Estimate Transaction Gas

Parameters

  • network String Network name (mainnet, ropsten or rinkeby)
  • from String Input address
  • to String Output address
  • value Number Value to transfer (in Ether)
  • data (optional) String Optional data. However, if data is added it should be a valid hexadecimal number otherwise an error will be returned

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
var data = '24224747A80F225FD841E7AB2806A2FDF78525B58C1BC1F5D5A5D3943B4214B6C350CE0D973CAD81BD7A6E57048A487939D7CD6373BF8C9F3ADB6328f7';
caClient.estimateEthereumTransactionGas('ropsten', '0x7857af2143cb06ddc1dab5d7844c9402e89717cb', '0xc595B20EEC3d35E8f993d79262669F3ADb6328f7', 0.12, data).then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

estimateEthereumSmartContractGas

Estimate Gas Smart Contract

Parameters

  • network String Network name (mainnet, ropsten or rinkeby)

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.estimateEthereumSmartContractGas('ropsten').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

deployEthereumSmartContract

Deploy Smart Contract

Parameters

  • network String Network name (mainnet, ropsten or rinkeby)
  • privateKey String Private key
  • from String Input address
  • gasPrice Number Gas price
  • gasLimit Number Gas limit
  • byteCode String Contract bytecode - compiled to binary solidity code

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
var privateKey = '4f75aff19dd7acbf7c4d5d6f736176a3fe2db1ec9b60cc11d30dc3c343520ed1';
var byteCode = '0x60806040523480156200001157600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506040805190810160405280600481526020017f4d464b54000000000000000000000000000000000000000000000000000000008fffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116b457600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373fffff';
caClient.deployEthereumSmartContract('rinkeby', privateKey, '0xe7cc96ba0562dfba61a55c8dd2e162a30942f402', 21000000000, 2100000, byteCode).then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

getEthereumAddressTokenBalance

Get Token Balance

Parameters

  • network String Network name (mainnet, ropsten or rinkeby)
  • address String Ethereum address
  • contract String Contract address

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.getEthereumAddressTokenBalance('rinkeby', '0x0cb1883c01377f45ee5d7448a32b5ac1709afc11', '0xe7d553c3aab5943ec097d60535fd06f1b75db43e').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

ethereumTransferTokens

Transfer Tokens. You must use the private key or password (if it is an account stored on our servers)

Parameters

  • network String Network name (mainnet, ropsten or rinkeby)
  • fromAddress String From address
  • toAddress String To address
  • contract String Contract address
  • gasPrice Number Gas price
  • gasLimit Number Gas limit
  • token Number The amount of tokens you would like to transfer
  • password String Account password. Pass null if you use privateKey
  • privateKey String Private key

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.ethereumTransferTokens('rinkeby', '0x0cb1883c01377f45ee5d7448a32b5ac1709afc11', '0x0cb1883c01377f45ee5d7448a32b5ac1709afc11', '0xe7d553c3aab5943ec097d60535fd06f1b75db43e', 11500000000, 60000, 115, null, '0xeb38783ad75d8081fb9105baee6ac9413c4abd732ef889116714f271cde6aed').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

ethereumCreatePayment

Create Payment Forwarding. You must use the private key or password (if it is an account stored on our servers)

Parameters

  • network String Network name (mainnet, ropsten or rinkeby)
  • fromAddress String From address
  • toAddress String To address
  • callbackURL String Callback URL
  • password String Account password. Pass null if you use privateKey
  • privateKey String Private key

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.ethereumCreatePayment('rinkeby', '0x195831d0fa4888c3fd577110d23ee464265c551a', '0x12b1883c01377f45ee5d7448a32b5ac1709af076', 'your callback url', null, '0x17de216dff24b36c35af535c7d4d9d36f57326f3ee8aaf7fd373715c27a15b7e').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

ethereumDeletePayment

Delete Payment Forwarding

Parameters

  • network String Network name (mainnet, ropsten or rinkeby)
  • uuid String The uuid of the payment

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.ethereumDeletePayment('rinkeby', 'a2e2498a-a8e5-40a0-adb4-4b4b736c233c').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

ethereumListPayment

List of Forward Payments By Users

Parameters

  • network String Network name (mainnet, ropsten or rinkeby)

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.ethereumListPayment('rinkeby').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

ethereumListPaymentHistory

List of Past Forward Payments By Users

Parameters

  • network String Network name (mainnet, ropsten or rinkeby)

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.ethereumListPaymentHistory('rinkeby').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

ethereumCreateUnconfirmedTransactionWebHook

Create WebHook triggered for every pending transaction in the Ethereum Blockchain before it's confirmed in a block, basically, for every unconfirmed transaction

Parameters

  • network String Network name (mainnet, ropsten or rinkeby)
  • callbackURL String Callback URL

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.ethereumCreateUnconfirmedTransactionWebHook('ropsten', 'your callback url').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

ethereumCreateConfirmedTransactionWebHook

Create WebHook triggered for every new transaction making it into a new block

Parameters

  • network String Network name (mainnet, ropsten or rinkeby)
  • callbackURL String Callback URL
  • transaction String Transaction hash
  • confirmations Number Confirmations

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.ethereumCreateConfirmedTransactionWebHook('mainnet', 'your callback url', '0x87da27245076441baf7bcc6e93d328d80d11297a3a247a1ce3019168be3b7a36', 10).then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

ethereumCreateNewBlockWebHook

Create WebHook triggered for every new block

Parameters

  • network String Network name (mainnet, ropsten or rinkeby)
  • callbackURL String Callback URL

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.ethereumCreateNewBlockWebHook('rinkeby', 'your callback url').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

ethereumCreateAddressTransactionWebHook

Create Ethereum Address Transaction WebHook

Parameters

  • network String Network name (mainnet, ropsten or rinkeby)
  • callbackURL String Callback URL
  • address String Ethereum address

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.ethereumCreateAddressTransactionWebHook('ropsten', 'your callback url', '0xe816c453a99b12bb65ea55db22a6fe70f63c2c7a').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

ethereumListAllWebHooks

Provides a list with all WebHooks of current user

Parameters

  • network String Network name (mainnet, ropsten or rinkeby)

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.ethereumListAllWebHooks('ropsten').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

ethereumDeleteWebHook

Delete WebHook

Parameters

  • network String Network name (mainnet, ropsten or rinkeby)
  • webhookID String WebHook ID

Example

const CryptoApis = require('cryptoapis.io');
const apiKey = 'your API key';
var caClient = new CryptoApis(apiKey);
caClient.ethereumDeleteWebHook('ropsten', '75012af1-12b6-4472-98de-a7fb5d66dba9').then(function(result) {
    console.log(result);
}, function(error) {
    console.log(error);
});

License

MIT

install

npm i cryptoapis.io

Downloadsweekly downloads

2

version

1.0.8

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability