Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@tomfrench/chainlink-asset-converter

TomAFrench2.6kMIT0.1.1TypeScript support: included

Asset conversion utils powered by Chainlink price feeds

ethereum, chainlink, pricefeed

readme

chainlink-asset-converter

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

Installation

yarn add @tomfrench/chainlink-asset-converter

Basic Usage

import { exchangeRate } from '@tomfrench/chainlink-asset-converter';

// Your Ethereum JSON-RPC endpoint*
const provider = new JsonRpcProvider('https://mainnet.infura.io/v3/ab01ab01ab01ab01ab01ab01')

const ethBtcRatio = await exchangeRate(
  'ETH',
  'BTC',
  provider,
);