Requesting all known Tokens
Request all tokens known by the LI.FI services
This endpoint gives a comprehensive list of all tokens that the LI.FI services are aware.
It is possible to filter them by chain to get a more concise and targeted result.
const getTokens = async () => {
const optionalFilter = ['ETH', 137] // Both numeric and mnemonic can be used
const result = await axios.get('https://li.quest/v1/tokens',
{params: {chains: optionalFilter.join(',')}});
return result.data;
}
The response is an object with a tokens property. In turn this is an object with keys being
ChainId
and values being Token
objects. The sample response for the sample request above is:{
"tokens": {
"100": [
{
"address": "0x6a023ccd1ff6f2045c3309768ead9e68f978f6e1",
"decimals": 18,
"symbol": "ETH",
"chainId": 100,
"coinKey": "ETH",
"name": "ETH",
"logoURI": "https://static.debank.com/image/xdai_token/logo_url/0x6a023ccd1ff6f2045c3309768ead9e68f978f6e1/61844453e63cf81301f845d7864236f6.png",
"priceUSD": "1740.38"
}
],
"137": [
{
"address": "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619",
"decimals": 18,
"symbol": "ETH",
"chainId": 137,
"coinKey": "ETH",
"name": "ETH",
"logoURI": "https://static.debank.com/image/matic_token/logo_url/0x7ceb23fd6bc0add59e62ac25578270cff1b9f619/61844453e63cf81301f845d7864236f6.png",
"priceUSD": "1740.38"
}
]
}
}
Last modified 5mo ago