Overview
The Balances API provides a unified view of a user’s token holdings across all supported chains. It aggregates balances of the same asset type (e.g., USDC on Ethereum, Polygon, and Arbitrum) and provides both crypto and fiat valuations.API Methods
getAggregatedBalance
Retrieve aggregated balances for all assets held by an account.Parameters
The user’s smart contract account address (predicted address from OneBalance)
This should be the predicted/smart account address, not the embedded wallet address.
Returns
Complete balance information across all chains and assets
Example
Understanding Aggregated Balances
OneBalance aggregates the same token across different chains. For example:- 150 USDC total across 3 chains (Ethereum, Polygon, Arbitrum)
- 0.5 ETH total across 2 chains (Ethereum, Optimism)
- Total portfolio value: $2,000
Formatting Balances for Display
Real-World Implementation
Here’s how balances are fetched and managed in the actual application:Understanding CAIP-19 Asset Types
Individual asset types use the CAIP-19 standard:Filtering and Sorting
Calculating Totals
Error Handling
Refresh Strategies
On Navigation
Refresh balances when user navigates to balance/portfolio pages
After Transactions
Automatically refresh after successful swaps or transfers
Periodic Updates
Set up periodic refresh (e.g., every 30 seconds) when page is active
Manual Refresh
Provide pull-to-refresh or refresh button for user-initiated updates
Best Practices
Cache Balances
Cache balance data to avoid unnecessary API calls
Show Loading States
Display skeleton loaders while fetching balances
Handle Zero Balances
Show helpful empty states for new accounts
Format Consistently
Use consistent decimal places and currency formatting
Related APIs
- Assets API - Get list of supported assets
- Chains API - Get chain information for display
- Transactions API - View transaction history
Related Types
- BalancesResponse - Complete response structure
- BalanceByAssetDto - Per-asset balance details
- IndividualAssetBalance - Per-chain balance details