Skip to main content

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 { clusterApiUrl, Connection, PublicKey } from "@solana/web3.js";
import { getMint } from "@solana/spl-token";

(async () => {
const connection = new Connection(clusterApiUrl("devnet"), "confirmed");

const mintAccountPublicKey = new PublicKey(
"8mAKLjGGmjKTnmcXeyr3pr7iX13xXVjJJiL6RujDbSPV",
);

let mintAccount = await getMint(connection, mintAccountPublicKey);

console.log(mintAccount);
/*
{
address: PublicKey {
_bn: <BN: 7351e5e067cc7cfefef42e78915d3c513edbb8adeeab4d9092e814fe68c39fec>
},
mintAuthority: PublicKey {
_bn: <BN: df30e6ca0981c1a677eed6f7cb46b2aa442ca9b7a10a10e494badea4b9b6944f>
},
supply: 0n,
decimals: 8,
isInitialized: true,
freezeAuthority: PublicKey {
_bn: <BN: df30e6ca0981c1a677eed6f7cb46b2aa442ca9b7a10a10e494badea4b9b6944f>
}
}
*/
})();