✨ app: implement new flow for adding funds - #1181
Conversation
🦋 Changeset detectedLatest commit: ea3504d The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughThe pull request restructures the mobile add-funds flow for multi-network asset selection, receiving, bridging, and user guidance. It adds per-chain allowlists, new routes and sheets, QR and warning interfaces, bridge matching, localization updates, caching changes, and patch changesets. ChangesAdd funds multi-network flow
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant AddFunds
participant Assets
participant Network
participant AddCrypto
participant Bridge
User->>AddFunds: choose cryptocurrency funding
AddFunds->>Assets: open asset list
User->>Assets: select asset
Assets->>Network: open network selection
User->>Network: select network
Network->>AddCrypto: navigate with asset and chain
AddCrypto->>User: show address, QR, and guidance
User->>Bridge: start bridge when required
Bridge->>User: show quote and processing status
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 841ada189a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
❌ 1 Tests Failed:
View the top 1 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
There was a problem hiding this comment.
Actionable comments posted: 12
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: c7c942bf-d802-476a-b9f3-600bba37ec3f
📒 Files selected for processing (39)
.changeset/brave-otters-wave.md.changeset/brisk-terns-guide.md.changeset/calm-badgers-greet.md.changeset/deep-owls-emit.md.changeset/eager-owls-list.md.changeset/glad-finches-map.md.changeset/keen-otters-match.md.changeset/neat-cranes-copy.md.changeset/plush-swans-send.md.changeset/proud-lions-glow.md.changeset/quiet-cranes-teach.md.changeset/round-moles-count.md.changeset/sly-foxes-sift.md.changeset/soft-doves-teach.md.changeset/warm-swifts-flip.md.changeset/wise-crows-allow.md.changeset/witty-geese-roam.mdcommon/wagmi.config.tssrc/app/(main)/add-funds/_layout.tsxsrc/app/(main)/add-funds/assets.tsxsrc/app/(main)/add-funds/network.tsxsrc/components/add-funds/AddCrypto.tsxsrc/components/add-funds/AddFunds.tsxsrc/components/add-funds/AddFundsOption.tsxsrc/components/add-funds/AssetMatchSheet.tsxsrc/components/add-funds/AssetSelectSheet.tsxsrc/components/add-funds/Assets.tsxsrc/components/add-funds/Bridge.tsxsrc/components/add-funds/EducationSheet.tsxsrc/components/add-funds/Network.tsxsrc/components/add-funds/ReceiveGuideSheet.tsxsrc/components/add-funds/SupportedAssetsSheet.tsxsrc/components/shared/CopyAddressSheet.tsxsrc/components/shared/SendWarning.tsxsrc/i18n/es-AR.jsonsrc/i18n/es.jsonsrc/i18n/pt.jsonsrc/utils/lifi.tssrc/utils/queryClient.ts
💤 Files with no reviewable changes (2)
- src/components/add-funds/SupportedAssetsSheet.tsx
- src/i18n/es-AR.json
There was a problem hiding this comment.
Actionable comments posted: 3
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: d6a3c527-ef52-467b-8e87-a5b3910cbac1
📒 Files selected for processing (39)
.changeset/brave-otters-wave.md.changeset/brisk-terns-guide.md.changeset/calm-badgers-greet.md.changeset/deep-owls-emit.md.changeset/eager-owls-list.md.changeset/glad-finches-map.md.changeset/keen-otters-match.md.changeset/neat-cranes-copy.md.changeset/plush-swans-send.md.changeset/proud-lions-glow.md.changeset/quiet-cranes-teach.md.changeset/round-moles-count.md.changeset/sly-foxes-sift.md.changeset/soft-doves-teach.md.changeset/warm-swifts-flip.md.changeset/wise-crows-allow.md.changeset/witty-geese-roam.mdcommon/wagmi.config.tssrc/app/(main)/add-funds/_layout.tsxsrc/app/(main)/add-funds/assets.tsxsrc/app/(main)/add-funds/network.tsxsrc/components/add-funds/AddCrypto.tsxsrc/components/add-funds/AddFunds.tsxsrc/components/add-funds/AddFundsOption.tsxsrc/components/add-funds/AssetMatchSheet.tsxsrc/components/add-funds/AssetSelectSheet.tsxsrc/components/add-funds/Assets.tsxsrc/components/add-funds/Bridge.tsxsrc/components/add-funds/EducationSheet.tsxsrc/components/add-funds/Network.tsxsrc/components/add-funds/ReceiveGuideSheet.tsxsrc/components/add-funds/SupportedAssetsSheet.tsxsrc/components/shared/CopyAddressSheet.tsxsrc/components/shared/SendWarning.tsxsrc/i18n/es-AR.jsonsrc/i18n/es.jsonsrc/i18n/pt.jsonsrc/utils/lifi.tssrc/utils/queryClient.ts
💤 Files with no reviewable changes (1)
- src/components/add-funds/SupportedAssetsSheet.tsx
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: af04048b0f
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/i18n/es.json (1)
858-858: 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick winRemove the trailing comma from the final JSON property in both locale files.
src/i18n/es.json#L858-L858: remove the comma after the final property.src/i18n/pt.json#L858-L858: remove the comma after the final property.Strict JSON rejects trailing commas, so the locale imports can fail.
Source: Learnings
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 43bb9967-affd-48e7-92e6-fbb751f5c1b3
📒 Files selected for processing (39)
.changeset/brave-otters-wave.md.changeset/brisk-terns-guide.md.changeset/calm-badgers-greet.md.changeset/deep-owls-emit.md.changeset/eager-owls-list.md.changeset/glad-finches-map.md.changeset/keen-otters-match.md.changeset/neat-cranes-copy.md.changeset/plush-swans-send.md.changeset/proud-lions-glow.md.changeset/quiet-cranes-teach.md.changeset/round-moles-count.md.changeset/sly-foxes-sift.md.changeset/soft-doves-teach.md.changeset/warm-swifts-flip.md.changeset/wise-crows-allow.md.changeset/witty-geese-roam.mdcommon/wagmi.config.tssrc/app/(main)/add-funds/_layout.tsxsrc/app/(main)/add-funds/assets.tsxsrc/app/(main)/add-funds/network.tsxsrc/components/add-funds/AddCrypto.tsxsrc/components/add-funds/AddFunds.tsxsrc/components/add-funds/AddFundsOption.tsxsrc/components/add-funds/AssetMatchSheet.tsxsrc/components/add-funds/AssetSelectSheet.tsxsrc/components/add-funds/Assets.tsxsrc/components/add-funds/Bridge.tsxsrc/components/add-funds/EducationSheet.tsxsrc/components/add-funds/Network.tsxsrc/components/add-funds/ReceiveGuideSheet.tsxsrc/components/add-funds/SupportedAssetsSheet.tsxsrc/components/shared/CopyAddressSheet.tsxsrc/components/shared/SendWarning.tsxsrc/i18n/es-AR.jsonsrc/i18n/es.jsonsrc/i18n/pt.jsonsrc/utils/lifi.tssrc/utils/queryClient.ts
💤 Files with no reviewable changes (1)
- src/components/add-funds/SupportedAssetsSheet.tsx
There was a problem hiding this comment.
Actionable comments posted: 4
♻️ Duplicate comments (4)
src/utils/queryClient.ts (1)
230-250: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract a helper for the repeated settings-flag query defaults.
The three blocks differ only by the key string. Extract a loop, as per the guideline to abstract only with reuse (two or more uses).
♻️ Proposed refactor
-queryClient.setQueryDefaults(["settings", "bridge-needed-shown"], { - initialData: false, - retry: false, - staleTime: Infinity, - gcTime: Infinity, - queryFn: () => queryClient.getQueryData(["settings", "bridge-needed-shown"]), -}); -queryClient.setQueryDefaults(["settings", "bridge-swap-needed-shown"], { - initialData: false, - retry: false, - staleTime: Infinity, - gcTime: Infinity, - queryFn: () => queryClient.getQueryData(["settings", "bridge-swap-needed-shown"]), -}); -queryClient.setQueryDefaults(["settings", "swap-needed-shown"], { - initialData: false, - retry: false, - staleTime: Infinity, - gcTime: Infinity, - queryFn: () => queryClient.getQueryData(["settings", "swap-needed-shown"]), -}); +for (const key of ["bridge-needed-shown", "bridge-swap-needed-shown", "swap-needed-shown"]) { + queryClient.setQueryDefaults(["settings", key], { + initialData: false, + retry: false, + staleTime: Infinity, + gcTime: Infinity, + queryFn: () => queryClient.getQueryData(["settings", key]), + }); +}As per coding guidelines, "a value consumed once stays at the point of consumption... extract and abstract only with reuse (two or more uses)."
Source: Coding guidelines
src/components/add-funds/Assets.tsx (2)
35-45: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExcluded-asset/WETH→ETH mapping duplicated with
useMarkets.
useMarketsindependently excludesUSDC.e/DAI/WETHand addsETH. ThisassetsuseMemo re-implements the same exclusion and renaming logic to attach display names. HaveuseMarkets(or a shared helper) expose the richer{symbol, name}shape so both call sites share one definition.
46-63: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract shared allowlist/correlation token-matching helper.
Both files independently re-implement the same "correlated symbol lookup + per-chain allowlist membership" check against
tokenCorrelation/allowlists. This risks silent divergence if either is updated without the other.
src/components/add-funds/Assets.tsx#L46-L63: replace the inlinecorrelated/allowedchecks in theothersuseMemo with a shared helper (e.g.,isAllowlistedToken(token)/resolveCorrelatedSymbol(token)) exported from../../utils/lifi.ts.src/components/add-funds/Network.tsx#L49-L60: replace the equivalent inline checks in thesymbolsuseMemo with the same shared helper.src/components/add-funds/AssetSelectSheet.tsx (1)
112-123: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winName the chain-filter trigger for assistive technology.
The
Pressablecontains only icons. Screen readers announce no name for it. Addrole="button"and anaria-labelthat states the current filter.🛠️ Proposed fix
- {groups.length > 1 && ( - <Pressable onPress={() => setFilterOpen(!filterOpen)}> + {groups.length > 1 && ( + <Pressable + role="button" + aria-label={t("Filter by network")} + onPress={() => setFilterOpen(!filterOpen)} + >
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: acb3a726-1ba4-4a30-b548-0ba84c1cdc21
📒 Files selected for processing (39)
.changeset/brave-otters-wave.md.changeset/brisk-terns-guide.md.changeset/calm-badgers-greet.md.changeset/deep-owls-emit.md.changeset/eager-owls-list.md.changeset/glad-finches-map.md.changeset/keen-otters-match.md.changeset/neat-cranes-copy.md.changeset/plush-swans-send.md.changeset/proud-lions-glow.md.changeset/quiet-cranes-teach.md.changeset/round-moles-count.md.changeset/sly-foxes-sift.md.changeset/soft-doves-teach.md.changeset/warm-swifts-flip.md.changeset/wise-crows-allow.md.changeset/witty-geese-roam.mdcommon/wagmi.config.tssrc/app/(main)/add-funds/_layout.tsxsrc/app/(main)/add-funds/assets.tsxsrc/app/(main)/add-funds/network.tsxsrc/components/add-funds/AddCrypto.tsxsrc/components/add-funds/AddFunds.tsxsrc/components/add-funds/AddFundsOption.tsxsrc/components/add-funds/AssetMatchSheet.tsxsrc/components/add-funds/AssetSelectSheet.tsxsrc/components/add-funds/Assets.tsxsrc/components/add-funds/Bridge.tsxsrc/components/add-funds/EducationSheet.tsxsrc/components/add-funds/Network.tsxsrc/components/add-funds/ReceiveGuideSheet.tsxsrc/components/add-funds/SupportedAssetsSheet.tsxsrc/components/shared/CopyAddressSheet.tsxsrc/components/shared/SendWarning.tsxsrc/i18n/es-AR.jsonsrc/i18n/es.jsonsrc/i18n/pt.jsonsrc/utils/lifi.tssrc/utils/queryClient.ts
💤 Files with no reviewable changes (2)
- src/components/add-funds/SupportedAssetsSheet.tsx
- src/i18n/es-AR.json
There was a problem hiding this comment.
Actionable comments posted: 4
♻️ Duplicate comments (2)
src/i18n/es.json (1)
21-21: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winKeep
APRin the translated rate label.The source key identifies the value as
APR.TNAchanges that label. Use"{{rate}} APR fija".Proposed fix
- "{{rate}} FIXED APR": "{{rate}} TNA FIJA", + "{{rate}} FIXED APR": "{{rate}} APR fija",src/components/add-funds/Assets.tsx (1)
46-64: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick winExtract the shared allowlist/correlation matching logic.
The
othersmemo reimplements the same "correlated symbol lookup + per-chain allowlist membership" check againsttokenCorrelation/allowliststhatNetwork.tsximplements independently. A prior review flagged this same duplication and it remains unresolved in this version. Divergence between the two implementations risks inconsistent asset visibility across the asset and network selection screens.Export a shared helper (e.g.
isAllowlistedToken(token)/resolveCorrelatedSymbol(token)) from../../utils/lifi.tsand reuse it in bothAssets.tsxandNetwork.tsx.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 170a08db-7ecd-4969-9a30-63f8e6439c40
📒 Files selected for processing (27)
.changeset/brisk-terns-guide.md.changeset/calm-herons-store.md.changeset/deep-owls-emit.md.changeset/glad-finches-map.md.changeset/keen-otters-match.md.changeset/neat-cranes-copy.md.changeset/plush-swans-send.md.changeset/quiet-cranes-teach.md.changeset/round-moles-count.md.changeset/sly-foxes-sift.md.changeset/soft-doves-teach.md.changeset/warm-swifts-flip.md.changeset/wise-crows-allow.mdcommon/wagmi.config.tssrc/components/add-funds/AddCrypto.tsxsrc/components/add-funds/AssetMatchSheet.tsxsrc/components/add-funds/AssetSelectSheet.tsxsrc/components/add-funds/Assets.tsxsrc/components/add-funds/Bridge.tsxsrc/components/add-funds/Network.tsxsrc/components/add-funds/ReceiveGuideSheet.tsxsrc/components/shared/CopyAddressSheet.tsxsrc/i18n/es.jsonsrc/i18n/pt.jsonsrc/utils/factoryOptions.tssrc/utils/lifi.tssrc/utils/queryClient.ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5b2d566539
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3e5629c8a4
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| onConfirm={() => { | ||
| if (!assetMatch) return; | ||
| setSourceAmount(0n); | ||
| setSelectedSource({ chain: assetMatch.chainId, address: assetMatch.token.address.toLowerCase() }); |
There was a problem hiding this comment.
Reset the matched destination on confirm
When the user has already selected a non-correlated receive token, then re-selects the same correlated source token and confirms this match sheet, this only rewrites the source. Because effectiveDestinationAddress keeps selectedDestinationAddress whenever the source address hasn't changed, the bridge screen can still quote/send to the old destination even though the sheet just promised {{source}} -> {{destination}}; clear or set the destination address when confirming the match.
Useful? React with 👍 / 👎.
💡 Codex ReviewLine 6 in b14ed33 When the activity list contains the newer ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
closes #1118 closes #1190
Summary by CodeRabbit
New Features
Improvements