Skip to content

getTokenList

The getTokenList method returns an array of all tokens involved in the route, in order of appearance.

Signature

getTokenList(): string[]

Returns

Returns an array of token addresses representing all tokens in the route path, including intermediate tokens.

Example Usage

const symphony = new Symphony();
 
// Get a route for SEI -> USDC swap through an intermediate token
const route = await symphony.getRoute(
  "0x0", // SEI
  "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
  "1.0"
);
 
// Get list of all tokens in the route
const tokenList = route.getTokenList();
console.log(tokenList);
//"0x0": {
//      id: "sei_native_sei",
//      attributes: {
//        address: "0x0",
//        name: "sei",
//        symbol: "sei",
//        decimals: 18,
//        initialsupply: "",
//        logoUrl:
//          "https://raw.githubusercontent.com/Sei-Public-Goods/sei-assetlist/main/images/Sei.png",
//      },
//    },
//    "0x5f0e07dfee5832faa00c63f2d33a0d79150e8598": {
//      id: "sei_0x5f0e07dfee5832faa00c63f2d33a0d79150e8598",
//      attributes: {
//        address: "0x5f0e07dfee5832faa00c63f2d33a0d79150e8598",
//        name: "seiyan",
//        symbol: "seiyan",
//        decimals: 6,
//        initialSupply: "1000000000000000000000",
//        logoUrl:
//          "https://raw.githubusercontent.com/Sei-Public-Goods/sei-assetlist/main/images/SEIYAN.png",
//      },
//    },
// ...