What you will build
A portfolio view that reads balances on every network a user has connected, then moves a chosen holding into a Base asset.Prerequisites
@sodax/sdk, plus@sodax/dapp-kitand aSodaxProviderfor the React hook.- The networks and addresses the user has connected.
How it works
1
Read one network at a time
Each read covers one network, so a broken network never hides the others. A failed network comes back as
null, never as an empty wallet.2
Keep the chain key and token list together
Every read uses
token.address on the network you pass, so a token list from another network reads wrong. Each network’s swap-supported list is also the set of holdings a user can route onto Base. Look tokens up by address, not symbol.3
Display amounts
Balances are
bigint in the token’s smallest unit. Scale them by token.decimals. See Read wallet balances.4
Route a holding onto Base
Hand the chosen holding to Accept any token, settle on Base: the source is the network and token the user picked, the destination is Base.
Code
Read every connected network with@sodax/sdk:
useBalances hook in @sodax/dapp-kit:
Next steps
- Read wallet balances: per-chain notes and failure behavior.
- dapp-kit package: the React hook layer.