TriportRPC

getTokenSupply

POSThttps://api.triport.io/v1/sol

Returns the total circulating supply of an SPL token mint.

Solanasol_read_rpcfree+ — 20 / 60 / 200 / 600 RPS (free / basic / pro / business)

getTokenSupply returns the total supply currently in circulation for a single SPL token mint. The amount is reported both as a raw integer string (in the token's smallest indivisible unit) and as a human-readable value scaled by the mint's decimals.

Use it to display a token's circulating supply, to compute market cap alongside a price feed, or to confirm a mint's decimal precision before formatting other balances. The value reflects the supply as recorded on-chain at the slot named in the response context — pass a stricter commitment (e.g. finalized) when you need a confirmed, rollback-safe number.

This is a lightweight read; it is rate limited under the standard sol_read_rpc bucket and is available on every tier including free.

Parameters

Positional params array: [mint, config?].

mintstring (Pubkey, base-58)required
The token mint account to query.
configobjectoptional
Optional configuration (see below).
commitmentstringoptional
Commitment level for the read: processed, confirmed, or finalized. Defaults to the node default if omitted.

Response

The example above queries the USDC mint and returns a total supply of 4827361029847562 base units, i.e. 4827361029.847562 USDC at 6 decimals.

resultobject
TokenBalanceResponse envelope.
result.contextobject
The context the response was evaluated against.
result.context.slotinteger
The slot at which the supply was read.
result.context.apiVersionstring
The node software version that served the request.
result.value.amountstring
Raw total supply in the token's smallest unit, as a decimal string.
result.value.decimalsinteger
Number of base-10 digits to the right of the decimal place for this mint.
result.value.uiAmountnumber | null
Supply scaled by decimals as a JSON number. May be null if the value is not safely representable.
result.value.uiAmountStringstring
Supply scaled by decimals as a string — prefer this for display to avoid floating-point loss.

Errors

Errors are returned in the standard JSON-RPC error envelope. See the shared errors reference for the full envelope shape and shared codes.

CodeMeaningWhen it happens
-32602Invalid paramsmint is missing, malformed, or not a valid base-58 Pubkey, or the account is not an SPL Token mint.
401UnauthorizedMissing or invalid Authorization bearer token.
403ForbiddenThe API key lacks the sol_read_rpc scope.
429Rate limitedMore than your tier's RPS for sol_read_rpc (20 / 60 / 200 / 600).

Examples

JavaScript (fetch)

const res = await fetch("https://api.triport.io/v1/sol", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.TRIPORT_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "getTokenSupply",
    params: ["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", { commitment: "finalized" }],
  }),
});


const { result } = await res.json();
console.log(result.value.uiAmountString);

TypeScript SDK (@triport/sdk)

import { TriportClient } from "@triport/sdk";


const client = new TriportClient({ apiKey: process.env.TRIPORT_API_KEY });


const supply = await client.solana.getTokenSupply(
  "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
  { commitment: "finalized" }
);


console.log(supply.value.uiAmountString, "decimals:", supply.value.decimals);

Python (triport-sdk)

import os
from triport import TriportClient


client = TriportClient(api_key=os.environ["TRIPORT_API_KEY"])


supply = client.solana.get_token_supply(
    "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    commitment="finalized",
)


print(supply["value"]["uiAmountString"], "decimals:", supply["value"]["decimals"])

Notes

  • For display and arithmetic, prefer value.uiAmountString over value.uiAmount: the string form preserves precision, while the numeric form can be null or lossy for very large supplies.
  • value.amount is denominated in the smallest unit; divide by 10 ** decimals to get the human-readable supply (which is exactly what uiAmountString already gives you).
  • To read a single holder's balance instead of the whole supply, use getTokenAccountBalance. For the largest holders of a mint, see getTokenLargestAccounts.
  • A stale or unexpected supply is often a commitment issue — request finalized for a confirmed, rollback-safe number.