Skip to main content

Get ERC20 token data

Immutable's Blockchain Data APIs allow developers to retrieve data about fungible/ERC20 tokens on Immutable-supported chains. You can get a list of supported ERC20 tokens supported on a specific chain, or details of a specific token, via Immutable's Token API.

Get ERC20 token dataGet ERC20 token data

note

$IMX is the native token to Immutable's zkEVM blockchain. Immutable supports both native and ERC20 interfaces for $IMX for developer convenience. However the Blockchain Data indexer will always represent activities $IMX as native for consistency purposes, independent of what interface was called.

Request parameters

ParameterDescriptionRequired
chainNameString representing the name of the chain. A list of available chains can be found here.Yes
contractAddressThe contract address of a ERC20 contract; mandatory if you are requesting details of a specific ERC20 tokenNo

List all ERC20 tokens supported by Immutable's indexer

This request returns all supported ERC20 tokens on a user specified blockchain.

listTokens.tsView on GitHub
import { blockchainData } from '@imtbl/sdk';

import { client } from '../lib';

export async function listTokens(): Promise<blockchainData.Types.ListTokensResult> {
return await client.listTokens({
chainName: 'imtbl-zkevm-testnet',
});
}

Example response

{
"result": {
"chain": {
"id": "eip155:13473",
"name": "imtbl-zkevm-testnet"
},
"contract_address": "string",
"root_contract_address": "string",
"symbol": "string",
"decimals": 0,
"image_url": "string",
"name": "string"
}
}

Get the details of a single token

This request returns details of a ERC20 token supported on a user specified blockchain. Use the Get Token API with the following parameters:

getToken.tsView on GitHub
import { blockchainData } from '@imtbl/sdk';

import { client } from '../lib';

export async function getToken(
contractAddress: string,
): Promise<blockchainData.Types.GetTokenResult> {
return await client.getToken({
chainName: 'imtbl-zkevm-testnet',
contractAddress,
});
}