Prime SDK examples
Get Exchange Rates
Prime SDK
Prime SDK examples
- Run Prime SDK examples
- Get Address
- Transfer Funds
- Transfer ERC20
- Transfer NFT
- Social Logins
- Get Account Balances
- Get Transaction
- Get Token List
- Get NFT List
- Show gas fee in fiat
- Get Exchange Rates
- Get Exchange Supported assets
- Use Paymaster
- Paymaster valid until after specified time
- Swap
- Get bridging quotes (LiFi)
- Get bridging quotes (other)
- Get Zerodev Address
- Get SimpleAccount Address
- User Specific callGasLimit
- Concurrent UserOps
- Add Guardians
Integrations
Chain Specific Tutorials
Prime SDK examples
Get Exchange Rates
import { RateData } from '../src/sdk/data';
import { DataUtils } from '../src';
import * as dotenv from 'dotenv';
dotenv.config();
async function main(): Promise<void> {
// initializating Data service...
const dataService = new DataUtils();
const ETH_AAVE_ADDR = '0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9';
const ETH_MATIC_ADDR = '0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0';
const ETH_USDC_ADDR = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';
const TOKEN_LIST = [ETH_AAVE_ADDR, ETH_MATIC_ADDR, ETH_USDC_ADDR];
const ETH_CHAIN_ID = 1;
const requestPayload = {
tokens: TOKEN_LIST,
chainId: ETH_CHAIN_ID,
};
const rates: RateData = await dataService.fetchExchangeRates(requestPayload);
console.log('\x1b[33m%s\x1b[0m', `EtherspotWallet Rates:`, rates);
}
main()
.catch(console.error)
.finally(() => process.exit());