Recommended: JavaScript SDK with React Hooks
For new React apps, we recommend the JavaScript SDK with React Hooks (
@dynamic-labs-sdk/react-hooks) instead of the legacy React SDK documented here. The JS SDK comes with many benefits such as a much smaller bundle size and other optimizations. Use the React quickstart (JavaScript SDK) to get started.Token balances are provided by Zerion and supported across 35+ EVM networks (including Ethereum, Base, Arbitrum, Optimism, Polygon, BNB Chain, and Avalanche) plus Solana. See the full list in the Token Balances reference.Dynamic supports fetching the top 3000 tokens by market cap.
Hook
You can fetch token balances for a user’s wallet using theuseTokenBalances hook:
React
Return Value
This hook returns an object fortokenBalances with the following properties:
Reference
You can find the full reference for theuseTokenBalances hook here.
On chains that distinguish a public balance from a private (shielded) one — Aleo today — use the
usePrivateTokenBalances hook to render the private balances. It mirrors useTokenBalances and can be called alongside it.Full Example
React
Using the JavaScript SDK? See Getting Multichain Token Balances for the equivalent guide.