feat(rn_cli_wallet): redesign payment options UI with per-option fee estimates#480
feat(rn_cli_wallet): redesign payment options UI with per-option fee estimates#480ignaciosantise wants to merge 14 commits intomainfrom
Conversation
…estimates Refactor PaymentOptionsModal to estimate gas/approval fees per option upfront, share a new OptionItem component across select and review views, and add a dedicated gas fee explainer. Persist the last paid token unit via MMKV so it appears first on subsequent payments, and clear it on wallet import. Add Shimmer loading component, GasPump, Info, Pencil and SelectToken icons. Add PaymentStore unit tests.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Claude finished @ignaciosantise's task in 58s —— View job Code Review🚨 PR Too Large This PR packages a complete store refactor, new shared components, new assets, and new tests in one commit. Suggested splits:
Found 5 issue(s)Issue 1: Hardcoded token name "USDT" in gas-fee explainer linkID: reviewpaymentview-hardcoded-usdt-b3a1 Context:
Recommendation: // Use selectedOption.amount.display.assetSymbol instead of the literal
Why does {selectedOption.amount.display.assetSymbol.toUpperCase()} require a gas fee?Issue 2:
|
There was a problem hiding this comment.
Pull request overview
Refactors the rn_cli_wallet WalletConnect Pay modal to show per-option fee estimates up front, reuse a shared option row UI across select/review screens, and persist the last-used payment token for faster repeat payments.
Changes:
- Preload per-option approval fee estimates in parallel on modal open and expose them via
PaymentStore. - Redesign select/review UI around a shared
OptionItem, addGasFeeView, and enhance loading text (message + note). - Persist and clear “last paid token unit” using MMKV-backed storage; add/expand unit tests for the new behavior.
Reviewed changes
Copilot reviewed 32 out of 32 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| wallets/rn_cli_wallet/src/utils/TypesUtil.ts | Adds gasFee to the Pay flow step union. |
| wallets/rn_cli_wallet/src/utils/PaymentUtil.ts | Splits approval detection into getApprovalAction + requiresApproval. |
| wallets/rn_cli_wallet/src/utils/PaymentTransactionUtil.ts | Adds fiat-aware fee estimate struct and native-token price fetching with caching. |
| wallets/rn_cli_wallet/src/store/PaymentStore.ts | Implements per-option fee estimate preloading + last-token persistence; updates confirm flow. |
| wallets/rn_cli_wallet/src/services/ERC20BalanceService.ts | Formatting-only changes to improve readability. |
| wallets/rn_cli_wallet/src/screens/Settings/index.tsx | Minor JSX formatting simplification. |
| wallets/rn_cli_wallet/src/screens/SecretPhrase/index.tsx | Minor formatting change for snapshot destructuring. |
| wallets/rn_cli_wallet/src/screens/LogList/components/LogFilterSheet.tsx | Minor formatting and adds lint suppression comment for inline style. |
| wallets/rn_cli_wallet/src/modals/SessionProposalModal.tsx | Import formatting for Canton constants. |
| wallets/rn_cli_wallet/src/modals/PaymentOptionsModal/index.tsx | Reworks step-resolution logic, wires new views/props, adds gasFee step routing. |
| wallets/rn_cli_wallet/src/modals/PaymentOptionsModal/SelectOptionView.tsx | Replaces custom row with shared OptionItem, shows per-option fee shimmer/estimate. |
| wallets/rn_cli_wallet/src/modals/PaymentOptionsModal/ReviewPaymentView.tsx | Uses OptionItem, updates pay CTA text, adds gas-fee explainer link. |
| wallets/rn_cli_wallet/src/modals/PaymentOptionsModal/ResultView.tsx | Minor formatting changes to helper functions. |
| wallets/rn_cli_wallet/src/modals/PaymentOptionsModal/LoadingView.tsx | Adds optional note under the loading message. |
| wallets/rn_cli_wallet/src/modals/PaymentOptionsModal/InfoExplainerView.tsx | Centers content and aligns layout. |
| wallets/rn_cli_wallet/src/modals/PaymentOptionsModal/GasFeeView.tsx | New explainer screen for approval gas fees. |
| wallets/rn_cli_wallet/src/modals/PaymentOptionsModal/ExpiryWarningView.tsx | Minor formatting cleanup. |
| wallets/rn_cli_wallet/src/modals/PaymentOptionsModal/CollectDataWebView.tsx | Trailing comma formatting fix. |
| wallets/rn_cli_wallet/src/modals/ImportWalletModal.tsx | Clears persisted last-paid token on wallet import. |
| wallets/rn_cli_wallet/src/hooks/useNfc.ts | Minor formatting change for return type. |
| wallets/rn_cli_wallet/src/constants/Canton.ts | Formatting for chain constant object spread. |
| wallets/rn_cli_wallet/src/components/Text.tsx | Adds underline prop + style support. |
| wallets/rn_cli_wallet/src/components/Shimmer.tsx | New Reanimated-based shimmer primitive. |
| wallets/rn_cli_wallet/src/components/OptionItem.tsx | New shared option row component used by select/review screens. |
| wallets/rn_cli_wallet/src/components/FadeGradient.tsx | Minor formatting change for SVG gradient props. |
| wallets/rn_cli_wallet/src/assets/SelectToken.tsx | New icon asset for select-token header. |
| wallets/rn_cli_wallet/src/assets/QuestionMark.tsx | Removes old QuestionMark icon asset (no longer used). |
| wallets/rn_cli_wallet/src/assets/Pencil.tsx | New pencil icon asset for “change option” affordance. |
| wallets/rn_cli_wallet/src/assets/Info.tsx | New info icon asset for collect-data hint. |
| wallets/rn_cli_wallet/src/assets/GasPump.tsx | New gas-pump icon asset for fee UI. |
| wallets/rn_cli_wallet/tests/PaymentUtil.test.ts | Updates tests for new approval helper functions. |
| wallets/rn_cli_wallet/tests/PaymentStore.test.ts | Adds comprehensive tests for fee preloading + persistence + confirm flow. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Gate the "(incl. gas fee)" badge on whether the fee was actually combined into the total, and use the selected option's token symbol in the gas-fee explainer link instead of a hardcoded "USDT". Also extracts OptionFeeEstimateStatus into TypesUtil and drops the unused selectedOption prop on SelectOptionView. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The message container had a fixed minHeight of 48 with overflow:hidden, but its child uses absoluteFill, so it couldn't grow to fit a wrapped message plus the note. Bump the base minHeight and apply a taller variant when a note is present. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Summary
Refactor the WalletConnect Pay flow in
rn_cli_walletso each payment option shows its gas/approval fee upfront, the review and select screens share UI primitives, and the previously paid token is remembered across sessions.PaymentStorenow fetches required actions and estimates approval/transaction fees for each option in parallel as soon as the modal opens, instead of doing it sequentially after the user picks one.OptionItemcomponent: select and review screens now render the same row, including chain badge, token amount, fee shimmer, and a right-side action slot (info / pencil).GasFeeView: tapping the gas-pump info button on a Permit2 option opens a dedicated explainer with the estimated fee.amount.unitto MMKV (PAY_LAST_TOKEN_UNIT) and uses it to pre-select the same token on the next payment. Cleared on wallet import.Shimmer(Reanimated-driven),GasPump,Info,Pencil,SelectTokenicons;Textgains anunderlineprop.PaymentStore.test.ts(615 lines) covering option-fee loading, persistence and confirm flow; existingPaymentUtil.test.tsupdated.Flow
flowchart TD A[QR scanned] --> B[PaymentStore.loadPaymentOptions] B --> C[Fetch options] C --> D[Parallel per-option<br/>getRequiredPaymentActions<br/>+ estimateTransactionFee] D --> E{Last paid<br/>token unit?} E -- yes --> F[Pre-select matching option] E -- no --> G[Show SelectOptionView] F --> H[ReviewPaymentView<br/>shared OptionItem] G --> H H -- info tap --> I[GasFeeView] H -- pay --> J[confirmPayment + wait] J --> K[Persist last unit on success] K --> L[ResultView]Test plan
yarn jestinwallets/rn_cli_wallet(PaymentStore + PaymentUtil suites pass locally)GasFeeViewexplainer shows the estimate🤖 Generated with Claude Code