Preserve exact SOL supply figures in a metrics pipeline
Cluster-wide supply in lamports can exceed the exact integer range of common JSON number parsers. The loss can occur before a dashboard even formats the amount in SOL.
Collect the three counters together
Ask for finalized total, circulating and nonCirculating values. Excluding the account list reduces response size when only totals are needed. Keep the context slot with the observation so a change in circulating supply can be tracked to a particular reading.
{
"jsonrpc": "2.0",
"id": 1,
"method": "getSupply",
"params": [
{
"commitment": "finalized",
"excludeNonCirculatingAccountsList": true
}
]
}
Test precision before conversion
Use a parser that preserves large integer literals. As a test fixture, decode 9007199254740993 lamports and check that the last digit remains 3. Converting to a big integer after a binary floating-point parser has rounded the value cannot restore the lost lamport.
Check that circulating plus nonCirculating equals total within the same response. For display, divide the stored exact lamport count by one billion using decimal arithmetic. Keep the arithmetic check in base units.