token.getMetadata
Gets the metadata for a TIP-20 token, including name, symbol, decimals, currency, and total supply.
Usage
ts
import { Actions } from 'wagmi/tempo'
import { config } from './config'
const metadata = await Actions.token.getMetadata(config, {
token: '0x20c0000000000000000000000000000000000000',
})
console.log('Currency:', metadata.currency)
console.log('Decimals:', metadata.decimals)Currency: USDconsole.log('Name:', metadata.name)Decimals: 18console.log('Symbol:', metadata.symbol)Name: United States Dollarconsole.log('Total Supply:', metadata.totalSupply)Symbol: USDTotal Supply: 1000000000000000000000nts
import { createConfig, http } from 'wagmi'
import { tempoTestnet } from 'wagmi/chains'
import { KeyManager, webAuthn } from 'wagmi/tempo'
export const config = createConfig({
connectors: [
webAuthn({
keyManager: KeyManager.localStorage(),
}),
],
chains: [tempoTestnet],
multiInjectedProviderDiscovery: false,
transports: {
[tempoTestnet.id]: http(),
},
})Return Type
ts
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.