feat(walletkit): multi-chain balances with zero-balance natives and redesigned rows#381
feat(walletkit): multi-chain balances with zero-balance natives and redesigned rows#381ignaciosantise wants to merge 2 commits into
Conversation
|
Claude finished @ignaciosantise's task in 2m 5s —— View job Code Review
Found 4 issue(s)Issue 1: Type cast crash when API returns integer
|
…edesigned rows Sample wallet balances page now fetches balances across all supported namespaces (eip155, solana, sui, ton, tron), returning every EVM chain in a single call when chainId is omitted. Filters out spam/airdrop tokens, always shows mainnet native tokens (even at 0 balance) so their address is visible, and adds per-token filter chips. Redesigns each balance row to match the TokenBalanceCard spec: token icon with chain badge on the left, compact amount (no USD value), 6...6 truncated per-chain address, and a tap-to-copy card with a copy icon and toast. Removes the single "Wallet address" header since multiple chains/addresses are now supported. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
9eda5ca to
094928b
Compare
There was a problem hiding this comment.
Pull request overview
This PR reworks the WalletKit example app’s Balances screen to support multi-namespace balance fetching and a redesigned, copy-to-clipboard row UI aligned with the TokenBalanceCard spec.
Changes:
- Updated balance fetching to support optional
chainId(enabling a single-call “all EVM chains” query when omitted) and to aggregate results across supported namespaces. - Added balance post-processing to filter spam/airdrop tokens and ensure mainnet native tokens are shown even at 0 balance.
- Redesigned balance rows (chain badge, compact amount formatting, truncated per-chain address, tap-to-copy with new
CopySimple.svgicon and toast).
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/reown_walletkit/example/lib/utils/blockchain_api_utils.dart | Makes chainId optional and omits the query param when absent to support multi-chain EVM balance fetches. |
| packages/reown_walletkit/example/lib/pages/balances_page.dart | Implements multi-namespace fetching, spam filtering, native-token inclusion at 0 balance, and redesigned tappable balance rows with copy + toast. |
| packages/reown_walletkit/example/ios/Runner.xcodeproj/project.pbxproj | Changes Xcode project objectVersion (appears incidental). |
| packages/reown_walletkit/example/assets/CopySimple.svg | Adds a new SVG asset used for the copy icon in balance rows. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Use num.toDouble() in the balance sort to avoid a TypeError when the API
returns an integer value (e.g. 0 for zero-value tokens).
- Null-safe quantity parsing in the row builder to avoid crashes when the
API omits quantity or returns a non-string numeric.
- Generalize the empty state from EVM-only ("No EVM accounts found") to any
supported namespace ("No accounts found"), matching multi-chain support.
- Resolve each supported namespace address once in the _addresses getter.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
All 4 findings addressed in 1af443f:
|
Description
Reworks the sample wallet Balances page. It now fetches balances across all supported namespaces (eip155, solana, sui, ton, tron) — returning every EVM chain in a single call when
chainIdis omitted — filters out spam/airdrop tokens, always shows mainnet native tokens even at a 0 balance (so their address is visible), and adds per-token filter chips. Each row is redesigned to theTokenBalanceCardspec: token icon with chain badge on the left, compact amount (no inline USD value), a6...6truncated per-chain address, and a tap-to-copy card with a newCopySimple.svgcopy icon and a confirmation toast. The single "Wallet address" header was removed since multiple chains/addresses are now supported.Resolves # (issue)
How Has This Been Tested?
flutter analyzepasses clean on the changed files. Verified manually by opening the Balances tab in the WalletKit example app: rows render icon-left with chain badges, amounts/addresses format correctly, and tapping a card copies its address and shows the toast.Due Dilligence