Skip to main content
This guide explains how to build a balance widget that displays an account’s multi-chain asset balances and their USD value, using the Universal Accounts SDK as its data source.
To see a live example of this, head to the Universal Accounts demo.
Balance Widget
You’ll learn:
  • What data to fetch from a Universal Account.
  • How UAs’ asset structure is organized.
  • How to render a portfolio overview in a React component.

Get started with Universal Accounts

Check out our Quickstart guide to learn how to build an app leveraging Universal Accounts.

Fetching Primary Assets from a Universal Account

Once a Universal Account is initialized, you can retrieve the user’s cross-chain Primary Assets balances with:
This returns a list of tokens and their aggregated balances across all supported chains.

Primary Assets Response Structure

Each entry in the response above represents a single token type (e.g. ETH, USDT, USDC), including its price, total balance, and per-chain breakdown.
This unified balance only includes Primary Assets, across any chain the UA holds them on. The SDK will then automatically select the most efficient payment source and route assets to execute the transaction.
You can find an example of the JSON structure below:
JSON
Use the chainAggregation field to display balances per chain.

Complete Example: Universal Account Balance Widget

Below is a ready-to-use React component that displays a user’s Universal Account portfolio. It aggregates balances and USD values for each supported asset, sorts them by value, and renders a modern dashboard UI.
Get your Universal Accounts project ID from the Particle Dashboard.
This widget makes it simple to show users an at-a-glance overview of their holdings—unified across all chains and token types—with just a single API call to universalAccount.getAssets(). You can use or customize this component as a starting point for a wallet dashboard or portfolio summary.
This example uses:
  • ShadCN UI components (Card, CardContent). Ensure they are set up in your project.
  • Lucide Icons—specifically the Wallet icon.
  • Token icons must be available at /public/tokens/[symbol].png (e.g., /tokens/eth.png, /tokens/usdc.png). You can customize or replace these as needed.
Below you will find the complete code for the BalanceWidget component:
BalanceWidget.tsx
You can then pass the data from the Primary Assets response to the WalletWidget component:
This component provides a basic summary of the user’s assets. To show more details—including a full chain-by-chain breakdown—you can customize it as needed.For a full breakdown example, refer to the Universal Accounts with Ethers demo, or see it live here.

What’s Next?

Explore the SDK reference for more advanced capabilities.

SDK Reference

Learn more about the SDK APIs.

Supported Chains

See the different chains supported by the SDK.