Fix card withdrawal asset picker and fund visibility issues - #2527
Merged
Merged
Conversation
…thdraw Two symptoms from one support report (Solid Operations 13039057237): the Swap and Send buttons had disappeared from home, and withdrawing from the card did not work. The reporter holds $4.87 on a Rain card and $0 in their wallet — every deposit they have ever made went to the card's own deposit address, which never touches their Safe. Home: the action row asked `depositCompleted`, which only ever knows about wallet funding (a deposit on record, a token balance, a vault balance). A cardholder who funds their card directly satisfies none of it, so the row collapsed to a lone "Add Funds" on a screen that was showing them a balance right above it. It now asks whether the user holds anything in any of the pots the breakdown shows, with `depositCompleted` still in front so an erroring or not-yet-settled balance query cannot hide the buttons either. Swap and Send work off wallet tokens, so a card-only balance opens Send on an empty asset list — which now says why, and points at Add Funds, instead of rendering a blank list under "Select an asset". Card withdraw: the asset picker was a portalled dropdown menu on web. Inside the withdraw sheet on a phone browser it covered the "Withdraw" button and swallowed taps on its own rows — in the recording the user spent nine seconds tapping the asset they wanted and gave up with the sheet still open. Both platforms now render the in-flow list native already had, from one shared file. Two more things the same screen got wrong: - Every token the user's Rain contracts support was offered, so the two assets they could actually withdraw sat behind eight $0 rows, including a duplicate "USDC" and "USDT". Only funded assets are listed now (plus the selected one, and the full list when nothing is funded), and a symbol held on two chains names its chain. - Picking the asset already selected cleared the amount, so "press Max, then confirm the destination" ended with an empty field. Only an actual change of asset clears it now. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FxQs7MKViUX9AL5bzUzj9o
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes two critical UX issues affecting card users:
Asset picker showing empty/unreadable assets: The withdrawal screen was displaying all supported tokens (including $0 balances and unreadable ones), burying the actually-funded assets in a long list. This made it impossible to find withdrawable assets.
Swap/Send actions disappearing for card-funded users: Users who funded their card directly (bypassing the wallet) saw their balance but the Swap and Send actions vanished, leaving only "Add Funds" visible.
Key Changes
New
ToDestinationSelector.shared.tsx: Unified asset picker component used by both web and native platforms. Replaces the previous portalled dropdown menu (which didn't work in modals) with an in-flow list that:New helper functions in
cardHelpers.ts:withdrawableAssetOptions(): Filters assets to show only those with readable balances and non-zero amounts (keeping selected asset even if empty)isDifferentCollateralAsset(): Detects actual asset changes vs. re-selecting the same asset (fixes amount field being cleared on re-selection)New
holdsFundsAnywhere()predicate: Determines whether to show Swap/Send actions by checking if user holds funds anywhere (wallet, card, savings, or has deposit history) rather than only checking wallet fundingPlatform consolidation: Both
ToDestinationSelector.native.tsxand.web.tsxnow re-export from the shared implementation, eliminating platform-specific divergenceImproved empty state handling: TokenSelector now shows a helpful message when the wallet is empty (normal for card-funded users) instead of a blank list
Testing
Comprehensive test coverage added:
ToDestinationSelector.test.tsx: Tests asset filtering, selection behavior, chain disambiguation, and empty statescardCollateralAssets.test.ts: Tests the filtering logic and asset comparison helpershomeBalanceTotals.test.ts: Tests the fund visibility predicate across various balance scenarioshttps://claude.ai/code/session_01FxQs7MKViUX9AL5bzUzj9o