getTokenListAsync
The getTokenList
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(): Record<string, TokenInfo>
Returns
Returns an object where:
- Keys are token addresses
- Values are
TokenInfo
objects containing:symbol
: Token symbol (e.g., "USDC")name
: Token name (e.g., "USD Coin")decimals
: Number of decimals the token usesaddress
: Token contract address
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
}