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 of.
It is possible to filter them by chain in order to get a more concise and targeted result.
1
const getTokens = async () => {
2
const optionalFilter = ['ETH', 137] // Both numeric and mnemonic can be used
3
const result = await axios.get('https://li.quest/v1/tokens',
4
{params: {chains: optionalFilter.join(',')}});
5
return result.data;
6
}
Copied!
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:
1
{
2
"tokens": {
3
"100": [
4
{
5
"address": "0x6a023ccd1ff6f2045c3309768ead9e68f978f6e1",
6
"decimals": 18,
7
"symbol": "ETH",
8
"chainId": 100,
9
"coinKey": "ETH",
10
"name": "ETH",
11
"logoURI": "https://static.debank.com/image/xdai_token/logo_url/0x6a023ccd1ff6f2045c3309768ead9e68f978f6e1/61844453e63cf81301f845d7864236f6.png",
12
"priceUSD": "1740.38"
13
}
14
],
15
"137": [
16
{
17
"address": "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619",
18
"decimals": 18,
19
"symbol": "ETH",
20
"chainId": 137,
21
"coinKey": "ETH",
22
"name": "ETH",
23
"logoURI": "https://static.debank.com/image/matic_token/logo_url/0x7ceb23fd6bc0add59e62ac25578270cff1b9f619/61844453e63cf81301f845d7864236f6.png",
24
"priceUSD": "1740.38"
25
}
26
]
27
}
28
}
Copied!
Copy link