JSPM

  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q80977F
  • License MIT

A tiny Node.js wrapper for the BitPay Rates API

Package Exports

  • bitpay-rates
  • bitpay-rates/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (bitpay-rates) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

bitpay-rates

GitHub Workflow Status BundlePhobia BundlePhobia

A lightweight Node.js wrapper for BitPay's exchange rates API, now in TypeScript.

Zero-dependency, promise and callback support for easy integration into your project. ✨

Requirements

  • nodejs >= 12.x

Examples

Getting a rate by code:

import bitpayRates from 'bitpay-rates';

const code = 'ARS'; // see list of codes bellow

// Using promise
bitpayRates
  .get(code)
  .then((rate) => console.log('Promise Rate:', rate))
  .catch((err) => console.error('Promise Error:', err));

Successful response:

{
  "code": "ARS",
  "name": "Argentine Peso",
  "rate": 3793422.92
}

Getting all the rates:

import bitpayRates from 'bitpay-rates';

// Using callback
bitpayRates.get((err, res) => {
  console.error('Callback Error:', err);
  console.log('Callback Rates:', res);
});

Successful response:

[
  {
    "code": "ARS",
    "name": "Argentine Peso",
    "rate": 5291987.02
  },
  {
    "code": "BUSD",
    "name": "Binance USD",
    "rate": 57818.28
  },
  {...}
]

More examples here.

Available Codes (updated: 2024-01-24)

Follow this link to see the complete list of codes.