Skip to content

getTokenListAsync

The getTokenListAsync method returns a list of all available tokens on the current chain that can be used for swaps. Provides up to date token list provided by Symphony. You can always use your own list using combination of additionalTokens and overrideDefaultTokens. If you need to check if a token is on the list take a look at isTokenListedAsync.

Signature

async getTokenListAsync(): Promise<TokenList>

TypeScript Types

// Import for viem
import type { TokenList, TokenMetadata } from 'symphony-sdk/types/viem';
 
// Import for ethersV5
import type { TokenList, TokenMetadata } from 'symphony-sdk/types/ethersV5';
 
// Import for ethers v6
import type { TokenList, TokenMetadata } from 'symphony-sdk/types/ethers';
 
interface TokenList {
  [tokenAddress: string]: TokenMetadata;
}
 
interface TokenMetadata {
  id: string;
  attributes: {
    address: `0x${string}`;
    name: string;
    symbol: string;
    decimals: number;
    logoUrl: string;
  };
}

Returns

Returns a Promise that resolves to a TokenList object where:

  • Keys are token addresses
  • Values are TokenMetadata objects containing:
    • id: Token identifier
    • attributes: Object with token details
      • address: Token contract address
      • name: Token name (e.g., "USD Coin")
      • symbol: Token symbol (e.g., "USDC")
      • decimals: Number of decimals the token uses
      • logoUrl: URL to token logo image

Example

const symphony = new Symphony();
const tokens = await symphony.getTokenListAsync();
 
// Example output:
{
  "0x0": {
      id: "sei_native_sei",
      attributes: {
        address: "0x0",
        name: "SEI",
        symbol: "SEI",
        decimals: 18,
        logoUrl:"https://token-logo-url.com",
      },
    },
    "0xe30fedd158a2e3b13e9badaeabafc5516e95e8c7": {
      id: "sei_0xe30fedd158a2e3b13e9badaeabafc5516e95e8c7",
      attributes: {
        address: "0xe30fedd158a2e3b13e9badaeabafc5516e95e8c7",
        name: "Wrapped Sei",
        symbol: "WSEI",
        decimals: 18,
        logoUrl:"https://token-logo-url.com",
      },
    },
  // ... other tokens
}