Solana CookbookTokens
How to Get a Token Mint
In order to get the current supply, authority, or decimals a token has, you will need to get the account info for the token mint.
import { Address, createSolanaRpc } from "@solana/kit";import { fetchMint } from "@solana-program/token-2022";const rpc = createSolanaRpc("https://api.mainnet-beta.solana.com");const address = "2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo" as Address;const mint = await fetchMint(rpc, address);console.log(mint);
ConsolePowered by Mirror
Click to execute the code.
Is this page helpful?