Safle Token Rates Controller
Token rates controller returns the rates of tokens for multiple currencies across multiple tokens on multiple chains.
Installation
To install this SDK,
npm install --save @getsafle/token-rates-controller
Initialization
Initialize the constructor,
const safleTokenRatesController = require('@getsafle/token-rates-controller');
const tokenRatesController = new safleTokenRatesController.TokenRatesController();
Get token conversion rates
This function takes in an array of token contract addresses and an array of currencies and returns the rates accordingly.
const tokenRates= await tokenRatesController.getTokenRates({ contractAddresses, currencies, chain })
-
contractAddresses
- contract address of tokens - type : array -
currencies
- Base currencies selected by user - type : array -
chain
- name of blockchain - type : string [ethereum, polygon supported for now]
Supported Chains
ethereum
polygon
bsc
avalanche
harmony