in-solana by Supanode

getTokenSupply — Solana RPC Method

getTokenSupply returns the total supply of a specific SPL Token mint. The response includes the raw amount and a human-readable formatted value.

Parameters

NameTypeRequiredDescription
mintstringYesBase-58 encoded public key of the token mint.
commitmentstringNoprocessed, confirmed, or finalized. Default: finalized.

Request

curl -X POST https://api.mainnet-beta.solana.com \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getTokenSupply",
    "params": [
      "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
    ]
  }'

TypeScript (@solana/kit)

import { createSolanaRpc, address } from "@solana/kit";

const rpc = createSolanaRpc("https://api.mainnet-beta.solana.com");
const supply = await rpc
  .getTokenSupply(address("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"))
  .send();

console.log(`Total supply: ${supply.value.uiAmountString}`);
console.log(`Decimals: ${supply.value.decimals}`);

Response

{
  "jsonrpc": "2.0",
  "result": {
    "context": { "slot": 341200000, "apiVersion": "2.2.4" },
    "value": {
      "amount": "30000000000000000",
      "decimals": 6,
      "uiAmount": 30000000000.0,
      "uiAmountString": "30000000000"
    }
  },
  "id": 1
}
FieldTypeDescription
amountstringRaw total supply as a string.
decimalsu8Token decimal places.
uiAmountnumber or nullFormatted supply as float (deprecated).
uiAmountStringstringFormatted supply as string.

Common errors

  • Invalid mint — querying a non-mint account or a nonexistent address returns an error.

Performance

getTokenSupply reads the supply field directly from the mint account. Extremely lightweight — it is a single account read.

FAQ

What is the difference between getTokenSupply and getSupply? getTokenSupply returns the total supply of a specific SPL Token. getSupply returns the total SOL supply. Different assets entirely.

Does the supply change? Yes. Token supply changes when tokens are minted or burned. The value reflects the current on-chain state at the requested commitment level.

Does this work for Token-2022 tokens? Yes. Pass any valid Token-2022 mint address and it works the same way.

What does decimals mean? decimals is the number of decimal places the token uses. USDC has 6 decimals, so amount: "1000000" represents 1 USDC. Divide amount by 10^decimals to get the human-readable value.

Parameters

ParameterTypeRequiredDescriptionDefault
mintstringYesBase-58 encoded public key of the token mint.—
commitmentstringNoCommitment level: processed, confirmed, or finalized.finalized

Updated: