getTokenSupply RPC Method

Returns the total supply of an SPL Token type.

Parameters

string required
Pubkey of the token Mint to query

  • Base-58 encoded string

object optional
Configuration object containing the following fields:

commitment string optional
The level of commitment desired when querying state

Code Sample

curl https://rpc.testnet.soo.network/rpc \
-X POST \
-H "Content-Type: application/json" \
-d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getTokenSupply",
  "params": [
    "BESTc6u4kKPDrdAXHTKPgCm9bwBzDn2Nq9g4gk1Ld3P4",
    {
      "commitment": "finalized"
    }
  ]
}'

Response

{
  "jsonrpc": "2.0",
  "result": {
    "context": {
      "slot": 369624
    },
    "value": {
      "amount": "1000000000",
      "decimals": 6,
      "uiAmount": 1000.0,
      "uiAmountString": "1000.0"
    }
  },
  "id": 1
}

Result Details

The result is an RpcResponse JSON object with value containing:

  • amount: <string>

    • Raw total token supply without decimals
    • String representation of u64 integer
    • Represents the absolute number of tokens
  • decimals: <u8>

    • Number of decimal places for the token
    • Determines how the raw amount should be displayed
  • uiAmount: <number|null> DEPRECATED

    • Total token supply using mint-prescribed decimals
    • Will be removed in future versions
  • uiAmountString: <string>

    • Total token supply as a string
    • Formatted using mint-prescribed decimal places

Important Notes

  • Provides comprehensive information about token supply
  • Includes both raw and user-friendly token supply representations
  • Decimals help in correct token amount interpretation