@warren-bank/node-shapeshift-api

1.0.1 • Public • Published

Node.js ShapeShift API

Node.js Client Library for the ShapeShift (shapeshift.io) API

This is an asynchronous Promise-based Node.js client for the shapeshift.io API.

Installation:

npm install --save @warren-bank/node-shapeshift-api

Usage:

  • class constructor:
    • input: config (optional: {agent, timeout})
  • api() method:
    • input: method (required), params (varies by method)
      where: method is one of the following values (as specified in the official API docs ):
      • 'rate', {pair}
      • 'limit', {pair}
      • 'marketinfo', {pair}
      • 'recenttx', {max}
      • 'txStat', {address}
      • 'timeremaining', {address}
      • 'getcoins', {}
      • 'txbyapikey', {apiKey} // PRIVATE api key
      • 'txbyaddress', {address, apiKey} // PRIVATE api key
      • 'validateAddress', {address, coinSymbol}
      • 'shift', {withdrawal, pair, returnAddress, destTag, rsAddress, apiKey} // PUBLIC api key
      • 'mail', {email, txid}
      • 'sendamount', {amount, withdrawal, pair, returnAddress, destTag, rsAddress, apiKey} // PUBLIC api key
      • 'cancelpending', {address}
    • output: Promise

Example:

const shapeshiftClient = require('@warren-bank/node-shapeshift-api')
const shapeshift = new shapeshiftClient({timeout: 10000})

// get current rate for currency pair
shapeshift.api('rate', {pair: 'BTC_ETH'})
.then((result) => {
  console.log(`pair: ${result.pair}`)
  console.log(`rate: ${result.rate}`)
})
.catch((error) => {
  console.log('Error:', error.message)
})

Legal:

Package Sidebar

Install

npm i @warren-bank/node-shapeshift-api

Weekly Downloads

14

Version

1.0.1

License

GPL-2.0

Last publish

Collaborators

  • warren-r-bank