/chainlink-asset-converter

Asset/currency conversion utils powered by Chainlink price feeds

Primary LanguageTypeScriptMIT LicenseMIT

chainlink-asset-converter

Logo

Super easy conversion between any of the assets currently supported by Chainlink's price feeds network

Installation

npm i chainlink-asset-converter

Basic Usage

import { convert } from 'chainlink-asset-converter';

await convert({
  amount: 5,
  from: 'ETH',
  to: 'BTC',
  // Your Ethereum JSON-RPC endpoint*
  endpoint: 'https://mainnet.infura.io/v3/ab01ab01ab01ab01ab01ab01',
});
// => '0.2'

*you could get your own one of these with a free-tier account at Infura for example