@getsafle/token-rates-controller
v1.0.6
Published
Getsafle Token rates controller
Downloads
3
Keywords
Readme
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 : arraycurrencies
- Base currencies selected by user - type : arraychain
- name of blockchain - type : string [ethereum, polygon supported for now]
Supported Chains
ethereum
polygon
bsc
avalanche
harmony