Skip to content

getTokenList

The getTokenList method returns a list of all available tokens on the current chain that can be used for swaps. Mostly used internally. If you need to check if Symphony supports a token take a look at isTokenListed.

Signature

getTokenList(): 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 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 = symphony.getTokenList();
 
// 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
}