token.getMetadata
Gets the metadata for a TIP-20 token, including name, symbol, decimals, currency, and total supply.
Usage
example.ts
import { client } from './viem.config'
const metadata = await client.token.getMetadata({
token: '0x20c0000000000000000000000000000000000000',
})
console.log('Currency:', metadata.currency)
Currency: USDconsole.log('Decimals:', metadata.decimals)Decimals: 18console.log('Name:', metadata.name)Name: United States Dollarconsole.log('Symbol:', metadata.symbol)Symbol: USDconsole.log('Total Supply:', metadata.totalSupply)Total Supply: 1000000000000000000000nReturn Type
type ReturnType = {
currency: string
decimals: number
name: string
paused?: boolean
quoteToken?: Address
supplyCap?: bigint
symbol: string
totalSupply: bigint
transferPolicyId?: bigint
}Parameters
token
- Type:
Address | bigint
Address or ID of the TIP-20 token.
account (optional)
- Type:
Account | Address
Account that will be used to send the transaction.
blockNumber (optional)
- Type:
bigint
Block number to read the state from.
blockOverrides (optional)
- Type:
BlockOverrides
Block overrides to apply to the state.
blockTag (optional)
- Type:
BlockTag
Block tag to read the state from.
stateOverride (optional)
- Type:
StateOverride
State override to apply.