Solana Balance Updates Cube
The BalanceUpdates cube on Solana returns every change to an account's balance, with the transaction that caused it. Use it for balance history, live balance tracking and per-account aggregates. Solana.InstructionBalanceUpdates gives the same changes broken down by instruction.
For current balances and holder rankings on EVM chains and Tron, use the Balances and Holders cubes.
What is a Balance Update?
Any change in the balance of any account, by any means, is a balance update. On Solana that covers token transfers, fees, rewards and account changes inside a transaction. Each row carries the Amount of the change, the PreBalance and PostBalance of the account, and a Type.
Balance updates of an account
The latest balance changes of one account, newest first.
{r('b1_s1.graphql')}
Fields in the response:
Account.Address: the account whose balance changed.Account.Owneris the wallet that owns it (for token accounts).AmountandAmountInUSD: the size of the change. Positive values are inflows.PreBalanceandPostBalance: the balance before and after the change.Type: what kind of change it was.Currency: the token; SOL has mint11111111111111111111111111111111.
Stream balance updates
The same query as a subscription. A new row arrives each time the account's balance changes.
{r('b1_s4.graphql')}
Aggregation in the BalanceUpdates cube
Aggregates run at query time, so you can group balance changes by currency, type, time or account.
Latest balance per token for a wallet
PostBalance(maximum: Block_Slot) picks the post-balance of the most recent update per currency, which is the current balance. Filter on Account.Owner to cover all token accounts of a wallet.
{r('b1_s3.graphql')}
Net change per currency and type
Sum the updates over the last 24 hours, grouped by currency and Type.
{r('b1_s2.graphql')}
Related
Ready to run this in production?
Get an API key and run these queries in minutes, or talk to us about plans and enterprise delivery.