Prime SDK examples
Get Token List
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 Token List
import { DataUtils } from '../src';
import * as dotenv from 'dotenv';
dotenv.config();
async function main(): Promise<void> {
// initializating Data service...
const dataService = new DataUtils();
const tokenLists = await dataService.getTokenLists({ chainId: 1 });
console.log('\x1b[33m%s\x1b[0m', `TokenLists:`, tokenLists);
const { name } = tokenLists[0];
let tokenListTokens = await dataService.getTokenListTokens({ chainId: 1 });
console.log('\x1b[33m%s\x1b[0m', `Default token list tokens length:`, tokenListTokens.length);
tokenListTokens = await dataService.getTokenListTokens({
chainId: 1,
name,
});
console.log('\x1b[33m%s\x1b[0m', `${name} token list tokens length:`, tokenListTokens.length);
}
main()
.catch(console.error)
.finally(() => process.exit());