Get metadata of a fungible token
Fungible tokens can carry associated metadata, which is a set of data that provides information about the token's properties. Although each token is indistinguishable in value, metadata can specify attributes such as the token's name, symbol, or total supply. In the realm of cryptocurrencies, metadata is often used to create a clearer understanding of the token's purpose or functionality. For instance, a utility token's metadata might detail the specific service or access it provides within its platform. Similarly, a governance token's metadata could illustrate the voting rights or privileges it conveys in a Decentralised Autonomous Organisation (DAO). Thus, metadata provides essential context, enhancing the fungible tokens' usability in diverse scenarios.
Use the TatumSDK (
@tatumio/tatum
) to get the token metadata.TypeScript
JavaScript
curl
1
// yarn add @tatumio/tatum
2
import { TatumSDK, Network, Ethereum, ResponseDto, TokenMetadata } from '@tatumio/tatum'
3
4
const tatum = await TatumSDK.init<Ethereum>({network: Network.ETHEREUM})
5
6
const response: ResponseDto<TokenMetadata> = await tatum.token.getTokenMetadata({
7
tokenAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
8
})
9
10
console.log(response.data)
1
// Install with: npm install @tatumio/tatum
2
const { TatumSDK, Network } = require("@tatumio/tatum");
3
4
(async () => {
5
try {
6
const tatum = await TatumSDK.init({ network: Network.ETHEREUM });
7
const result = await tatum.token.getTokenMetadata({
8
tokenAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
9
})
10
11
console.log(result.data);
12
} catch (error) {
13
console.error("Error fetching token metadata:", error);
14
}
15
})();
1
curl --location --request GET 'https://api.tatum.io/v4/data/tokens?tokenAddress=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&chain=ethereum'
1
interface TokenAddress {
2
/**
3
* Token contract address
4
*/
5
tokenAddress: string
6
}
1
interface ResponseDto<T> {
2
/**
3
* Actual payload of the response
4
*/
5
data: T
6
/**
7
* Status of the response
8
*/
9
status: Status
10
/**
11
* In case of ERROR status, this field contains the error message and detailed description
12
*/
13
error?: ErrorWithMessage
14
}
15
16
interface TokenMetadata {
17
/**
18
* Symbol of the fungible token.
19
*/
20
symbol: string
21
/**
22
* Full name of the fungible token
23
*/
24
name: string
25
/**
26
* Total supply of the fungible token.
27
*/
28
supply: string
29
/**
30
* Number of decimal places for the fungible token.
31
*/
32
decimals: number
33
/**
34
* Type of the token - fungible
35
*/
36
type: string
37
/**
38
* Maximum supply cap of the fungible token.
39
*/
40
cap: string
41
}
Network |
---|
Ethereum / Ethereum Sepolia / Ethereum Goerli
BNB Smart Chain / BNB Smart Chain Testnet
Celo / Celo Alfajores
Polygon / Polygon Mumbai |
Last modified 5d ago