useTokenBalances() and wallet.getBalance(), and the widget rendered the transaction confirmation modal (simulation preview, fees, security warnings) before a send. The JavaScript SDK exposes the same balance data and the same simulation result as functions and matching React hooks, and leaves the confirmation UI to you.
What maps to what
Reading balances
wallet.getBalance() returned a single native-balance string; getNativeBalance({ walletAccount }) returns { balance } (a human-readable string, or null while unavailable) and getTokenBalances({ walletAccount }) returns one entry per token. Watch two renamed options when migrating: the React SDK’s includeFiat is now includePrices, and includeNativeBalance is now includeNative.
balance on a TokenBalance is already scaled by the token’s decimals for display. When you need the exact integer amount (for a transfer, say), use rawBalanceString — it preserves precision a JavaScript number can lose.Simulating and sending a transaction
The one migration change is that the React SDK’s confirmation modal — which ran a simulation, showed asset changes, fees, and a security verdict, then sent — is gone. You now callsimulateEvmTransaction yourself, render your own review step, gate the approve button on validation.result (block 'malicious', warn on 'warning'), then send with the wallet client and wait for confirmTransaction.
Transactions are chain-specific. Use the EVM extension (
@dynamic-labs-sdk/evm) shown in the Building UI guide; the simulate → review → send → confirm pattern is the same on other chains with that chain’s functions.- Simulating before you send — the review step with
outAssets/inAssets,feeData, and thevalidationverdict. - Sending and confirming — send with the wallet client, then wait on
confirmTransaction. - Signing a message —
signMessage({ walletAccount, message })returns{ signature }. - Handling errors — malicious/warning verdicts, rejected prompts, and slow confirmations.
See also
- Network management — make sure the wallet is on the right network before sending
- Transaction confirmation & simulation (Building UI) — build the full review step
- Token balances & display (Building UI) — build the balance UI