📘
Adding Additional Tokens
Add trade support for any token to your widget
The prop
tokenListAddendum
of type TokenInfoExternal
is used to add tokens not found in the default token list. Type TokenInfoExternal
is an extension of the type TokenInfo
and contains the following fields:type TokenListExternal = {
chainId: number // the chainId of the token
address: string // the address of the token
decimals: number // the decimals of the token
symbol: string // the symbol to display for the token
name: string // the name to display for the token
routerModel?: number // what DEX should be used for trades with this token
}
Since many tokens don't have sufficient liquidity on every DEX to perform swaps, this value dictates what DEX to use. Currently, there are two supported options:
routerModel Value | DEX |
---|---|
0 | Uniswap (defaults to this DEX if routerMode==undefined ) |
1 | Quickswap |
Let's look at an example. Say you want to add the tokens VOXEL and SAND, both on Polygon. You want VOXEL to be traded through Quickswap, and SAND on Uniswap. The
TokenListAddendum
prop would be constructed like this:const tokenListAddendum: TokenInfoExternal[] = [
{
chainId: 137,
address: '0xd0258a3fD00f38aa8090dfee343f10A9D4d30D3F',
decimals: 18,
symbol: 'VOXEL',
name: 'VOXEL Token',
routerModel: 1,
},
{
chainId: 137,
address: '0xBbba073C31bF03b8ACf7c28EF0738DeCF3695683',
decimals: 18,
symbol: 'SAND',
name: 'SAND Token',
routerModel: 0,
},
]
Last modified 2mo ago