getTokenSupply
Returns the total supply of an SPL Token mint. This includes the raw amount, decimal count, and human-readable formatted values. Knowing a token's total supply is fundamental for market cap calculations, tokenomics analysis, and understanding token inflation or deflation over time. This method queries a single mint address and returns its current total minted supply.
Parameters
| # | Type | Required | Description |
|---|---|---|---|
| 1 | string | Yes | Base-58 encoded public key of the token mint |
| 2 | object | No | Configuration object |
Configuration object fields:
| Field | Type | Description |
|---|---|---|
commitment | string | Commitment level: processed, confirmed, or finalized |
Response
Returns an RpcResponse object:
| Field | Type | Description |
|---|---|---|
context.slot | u64 | The slot at which the value was read |
value.amount | string | Raw total supply as a string |
value.decimals | u8 | Number of decimals |
value.uiAmount | `f64 | null` |
value.uiAmountString | string | Total supply as a string with decimal formatting |
Code Examples
cURL
curl http://88.216.36.108:7999 -X POST -H "Content-Type: application/json" -d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getTokenSupply",
"params": [
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
{ "commitment": "confirmed" }
]
}'TypeScript
const response = await fetch("http://88.216.36.108:7999", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
jsonrpc: "2.0",
id: 1,
method: "getTokenSupply",
params: [
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
{ commitment: "confirmed" }
]
}),
});
const { result } = await response.json();
console.log("Total supply:", result.value.uiAmountString);Python
import requests
response = requests.post("http://88.216.36.108:7999", json={
"jsonrpc": "2.0",
"id": 1,
"method": "getTokenSupply",
"params": [
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
{"commitment": "confirmed"}
]
})
result = response.json()["result"]
print(f"Total supply: {result['value']['uiAmountString']}")Rust
use reqwest::Client;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let res = client.post("http://88.216.36.108:7999")
.json(&json!({
"jsonrpc": "2.0",
"id": 1,
"method": "getTokenSupply",
"params": [
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
{"commitment": "confirmed"}
]
}))
.send().await?
.text().await?;
println!("{}", res);
Ok(())
}Example Response
{
"jsonrpc": "2.0",
"result": {
"context": { "slot": 166974442 },
"value": {
"amount": "10000000000000000",
"decimals": 6,
"uiAmount": 10000000000.0,
"uiAmountString": "10000000000"
}
},
"id": 1
}