Token Balances Stream
The Token Balances Stream provides real-time updates on wallet token balances. This documentation follows our standard streaming API structure.
Credit Cost
Supported Chains
- Base Mainnet
- Base Sepolia Flashblocks
- BSC Mainnet
- BSC Testnet
- Ethereum Mainnet
- Ethereum Sepolia Testnet
This stream is currently in Beta. It is stable for testing and evaluation but may undergo changes in schema or behavior as we continue to improve it. No API credits are currently charged.
We welcome your feedback so please reach out to us directly to report issues or request features.
Authentication
Using any of the GoldRush developer tools requires an API key.
Get Started
Sign up for a free API key to get started with GoldRush.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
chain_name | enum | Yes | Chain name to filter events (e.g. BASE_MAINNET , ETH_MAINNET , BSC_MAINNET ) |
wallet_address | string | Yes | The wallet address to track balances for |
Connection
If you’re not using the graphql-ws
package, you must set the WebSocket protocol header:
"Sec-WebSocket-Protocol" : "graphql-transport-ws"
This header is required for the server to properly recognize and handle your GraphQL subscription requests.
The WebSocket endpoint uses the GraphQL query
or subscription
protocol. Here are examples of how one can connect with different languages:
Subscription
Once connected, you can subscribe to the tokenBalancesForWalletAddress
endpoint to receive notifications.
Basic Subscription Query
Complete Subscription Query
Implementation
Response Format
The subscription returns real-time updates of token balances in the following format:
Field Descriptions
Field | Type | Description |
---|---|---|
wallet_address | string | The wallet address being tracked |
chain_name | string | The chain name where the balance is being tracked |
last_block | integer | The latest block number when the balance was updated |
items | array | Array of token balance items |
balance | string | Raw token balance (unscaled) |
balance_pretty | float | Human-readable token balance (scaled by decimals) |
quote_rate_usd | float | Token exchange rate to USD |
quote_usd | float | Token balance in USD |
metadata | object | Token contract metadata |
is_native | boolean | If the token is the native token of the chain |