exratecalc
v0.0.9
Published
Get token exchange rate from Klayswap V2 or V3 LP Contract
Downloads
115
Maintainers
Readme
exratecalc
Get token exchange rate from Klayswap V2 or V3 LP Contract
Install
npm i exratecalc
Usage
const exratecalc = require("exratecalc");
const calculator = new exratecalc("RPC Endpoint");
Method descriptions
.v2(v2_LP_Contract_Address, token_symbol){}
returns amount of token per a token with given symbol
.v3(v3_LP_Contract_Address, token_Symbol){}
returns amount of token per a token with given symbol
Example
const exratecalc = require("exratecalc");
const calculator = new exratecalc("RPC Endpoint");
// amount of oUSDT per 1KSP
calculator
.v2("0xe75a6a3a800a2c5123e67e3bde911ba761fe0705", "ksp")
.then(console.log); // 0.4710626833673169
// amount of oUSDT per 1KSP
calculator
.v3("0x21ecdfb99772b10fb913a6f4658a9f97185c82be", "ksp")
.then(console.log); // 0.4706124510348447