@cryptoscan/scanner-sdk
v1.2.1
Published
The easiest way to get dynamic swap/exchange rates by CEX and DEX tokens
Downloads
151
Readme
@cryptoscan/scanner-sdk
The easiest way to get dynamic swap/exchange rates by CEX and DEX tokens
[GitHub] [Our website] [Docs] [Discord]
To install package:
npm install @cryptoscan/scanner-sdkUsage example:
import { getPrice, getRates, getRate } from '@cryptoscan/scanner-sdk';
const network = 'solana';
const from = 'USDC';
const to = 'SOL';
const amount = 10;
async function load() {
const price = await getPrice({ network, to, from }); // 145.3
const amount = await getPrice({ network, to, from, amount }); // 1453
const rates = await getRate({ network, to, from }) // Array of Rate
const rate = await getRate({ network, to, from }) // The first Rate
}
load()Docs
Request
network- network name (Optional - auto-detecting)to- coin address to get pricefrom- base coin address (Default: usdt)amount- amount of base coin (Deafult: 1)
Response
List of Rate
RatecontractFrom- contract of the base coin addresscontractTo- contract of the quote coin addressbase- base coin symbolquote- quote coin symbolprice- price of the pairpriceUSD- price of the coin in USDresult- amount of quote tokens to payresultUSD- amount of quote tokens to pay in USDfee- feefeeUSD- fee in USDservice- exchange or platform to buyimpact- price impact
