Skip to content

✨ app: add support for multi-chain asset recovery#970

Open
dieguezguille wants to merge 17 commits intotransportfrom
recover
Open

✨ app: add support for multi-chain asset recovery#970
dieguezguille wants to merge 17 commits intotransportfrom
recover

Conversation

@dieguezguille
Copy link
Copy Markdown
Member

@dieguezguille dieguezguille commented Apr 16, 2026

closes #854 , closes #649

Summary by CodeRabbit

  • New Features

    • Cross-chain account support, multi-chain balance fetching, and non-collateral/external assets views; recovery flow for assets on unsupported networks; portfolio pending-state UI.
  • Bug Fixes

    • Improved error status extraction, USD display for very small balances, swap/transfer validation, provider access behavior, and proposal timing; aligned close buttons.
  • Refactors

    • Bridge/source fetching and query exclusion logic simplified.
  • Localization

    • Spanish and Portuguese strings added/updated for new UX.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 16, 2026

🦋 Changeset detected

Latest commit: 6412718

The changes in this PR will be included in the next version bump.

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

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 16, 2026

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds cross-chain asset discovery and execution, portfolio restructuring, new UI sheets for external/collateral/unsupported networks, cross-chain account client routing, multiple query helpers for deployed/wallet balances, i18n updates, and assorted UI/layout tweaks. Includes many small changesets for patch releases.

Changes

Cohort / File(s) Summary
Changeset Metadata
.changeset/better-feet-arrive.md, .changeset/brisk-otters-sing.md, .changeset/easy-rockets-reply.md, .changeset/fuzzy-icons-push.md, .changeset/open-coats-battle.md, .changeset/smooth-plants-grab.md, .changeset/solid-snails-add.md, .changeset/tough-ducks-end.md, .changeset/wicked-buses-go.md, .changeset/wide-laws-travel.md, .changeset/wild-geckos-remain.md, .changeset/soft-ferrets-tap.md, .changeset/strong-kings-pay.md, .changeset/twelve-points-sniff.md
Added multiple patch-level changeset entries for @exactly/mobile documenting fixes, refactors, and small features.
Bridge & Add-Funds
src/components/add-funds/Bridge.tsx
Switched to useLocalSearchParams, introduced sender/transfer/swap/recovery classification, replaced markets with portfolio query helpers, adjusted quote/simulation gating to isTransfer, changed execution branching for cross-chain/native flows, removed shared handleError, and updated UI/deployment gating.
Home: Assets & Sheets
src/components/home/Home.tsx, src/components/home/AssetList.tsx, src/components/home/Portfolio.tsx, src/components/home/PortfolioSummary.tsx, src/components/home/CollateralAssetsSheet.tsx, src/components/home/ExternalAssets.tsx, src/components/home/ExternalAssetsSheet.tsx, src/components/home/UnsupportedNetworksSheet.tsx
Refactored portfolio to expose allAssets, added ExternalAssets and sheets (CollateralAssetsSheet, ExternalAssetsSheet, UnsupportedNetworksSheet) for non-collateral/cross-chain UX, added pending skeletons, asset grouping by chain, deployment checks, Intercom recovery flow, and small UI/press adjustments.
Portfolio Hook & LiFi / Balances
src/utils/usePortfolio.ts, src/utils/lifi.ts, src/utils/deployedOptions.ts
Split same-chain vs cross-chain balance queries, added walletBalancesOptions and bridgeSourcesOptions, introduced deployedOptions, added OwnerAsset + tokenAmountsToAssets, added protocolSymbols, added allAssets/crossChainAssets and updated USD totals and pending flags.
Account Client & Cross-Chain Routing
src/utils/accountClient.ts, src/utils/alchemyChains.ts
Extracted signUserOperationHash, added shared dummySignatureMiddleware, implemented cached getCrossChainClient(targetChainId), adjusted wallet_sendCalls to route UserOperations via cross-chain client with composite ids, and updated wallet_getCallsStatus to decode chain from ids.
Connector & Wagmi Config
src/utils/alchemyConnector.ts, src/utils/wagmi/exa.ts
Removed optional chainId param/validation from getProvider(), expanded Wagmi config to include multiple viem chains with per-chain transports, and added alchemyChains map file.
UI Consistency & Small Components
src/components/shared/Failure.tsx, src/components/shared/Pending.tsx, src/components/shared/Success.tsx, src/components/send-funds/Amount.tsx, src/components/loans/Review.tsx, src/components/swaps/Failure.tsx, src/components/swaps/Pending.tsx, src/components/swaps/Success.tsx, src/components/shared/AmountSelector.tsx, src/components/shared/AssetSelector.tsx, src/components/home/CollateralAssetsSheet.tsx, src/components/defi/ConnectionSheet.tsx, src/components/defi/IntroSheet.tsx
Applied alignSelf="flex-start" to various close buttons, adjusted flex/shrink behavior in some sheets, changed AmountSelector to store formatted USD string directly, added isSameChainPending gating in AssetSelector, and minor swaps/insufficient-balance logic tweaks.
Error Handling & Query Utilities
src/utils/reportError.ts, src/utils/queryClient.ts, src/utils/useSimulateProposal.ts
Refined passkey error classification to use codes and regexes, changed status extraction to traverse error cause chain for numeric codes, consolidated excluded query keys and suppressed messages into Sets, and bumped simulation block override timestamps by +1 unit.
Internationalization
src/i18n/es.json, src/i18n/pt.json
Added Spanish and Portuguese strings for collateral vs non-collateral guidance, unsupported-network recovery templates (with placeholders), swap CTA, support contact prompt; renamed "Collateral Assets""Collateral assets" and removed "Other Assets".
Config Typing
tamagui.config.ts
Added portfolio pseudo-group to Tamagui config and extended type augmentation to include "portfolio" in group names.

Sequence Diagram

sequenceDiagram
    participant User
    participant Bridge as Bridge Component
    participant Portfolio as Portfolio Screen
    participant QueryClient as Query Client
    participant LiFi as LiFi API
    participant Deployed as Deployed Check

    User->>Portfolio: Open portfolio
    Portfolio->>QueryClient: fetch markets, same-chain & wallet balances
    QueryClient->>LiFi: request tokenBalances & walletBalances
    LiFi-->>QueryClient: return balances per chain
    QueryClient->>Deployed: check contract bytecode per chain
    Deployed-->>Portfolio: deployed status
    Portfolio->>User: render collateral + external assets grouped by chain
    User->>Bridge: select external asset -> navigate with sender, sourceChain, sourceToken
    Bridge->>Bridge: classify mode (isTransfer/isSwap/isRecovery)
    alt isTransfer (same-chain)
        Bridge->>Wallet: send native transaction
        Wallet->>Network: broadcast tx
    else cross-chain / recovery
        Bridge->>AccountClient: request cross-chain client for targetChain
        AccountClient->>CrossChainClient: build/sign UserOperation
        CrossChainClient->>Network: submit UserOperation
        Network-->>CrossChainClient: execution/result
        CrossChainClient-->>Bridge: return composite id/result
    end
    Bridge->>User: show success/failure
Loading
sequenceDiagram
    participant User
    participant ExternalAssets as ExternalAssets Component
    participant QueryClient as Query Client
    participant Deployed as Deployed Check
    participant Unsupported as UnsupportedNetworksSheet

    User->>ExternalAssets: Tap non-collateral asset
    ExternalAssets->>QueryClient: ensure deployedOptions(account, chainId) queries
    QueryClient->>Deployed: return deployed/not-deployed
    alt not supported or not deployed
        ExternalAssets->>Unsupported: open UnsupportedNetworksSheet with formatted recovery message
        Unsupported->>User: show contact support flow (Intercom)
    else supported & deployed
        ExternalAssets->>Bridge: navigate to Bridge with asset params
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding multi-chain asset recovery support with clear scope and specificity.
Linked Issues check ✅ Passed The PR implements cross-chain asset recovery by adding external asset display, bridging support, and unsupported network handling as required by #649 and #854.
Out of Scope Changes check ✅ Passed All changes align with multi-chain recovery objectives: UI for external assets, bridge support, cross-chain queries, error handling, and layout refinements for the new features.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch recover

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

gemini-code-assist[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

@sentry
Copy link
Copy Markdown

sentry Bot commented Apr 16, 2026

Codecov Report

❌ Patch coverage is 32.61456% with 250 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.79%. Comparing base (de51847) to head (6412718).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/utils/lifi.ts 2.63% 74 Missing ⚠️
src/components/home/ExternalAssets.tsx 32.92% 55 Missing ⚠️
src/utils/accountClient.ts 12.50% 49 Missing ⚠️
src/utils/usePortfolio.ts 51.16% 21 Missing ⚠️
src/components/home/UnsupportedNetworksSheet.tsx 0.00% 19 Missing ⚠️
src/components/home/Portfolio.tsx 29.41% 12 Missing ⚠️
src/utils/deployedOptions.ts 0.00% 6 Missing ⚠️
src/components/shared/AmountSelector.tsx 20.00% 4 Missing ⚠️
src/components/home/AssetList.tsx 84.21% 3 Missing ⚠️
src/components/home/ExternalAssetsSheet.tsx 0.00% 3 Missing ⚠️
... and 3 more
Additional details and impacted files
@@              Coverage Diff              @@
##           transport     #970      +/-   ##
=============================================
+ Coverage      71.74%   71.79%   +0.04%     
=============================================
  Files            229      236       +7     
  Lines           8406     9238     +832     
  Branches        2708     3038     +330     
=============================================
+ Hits            6031     6632     +601     
- Misses          2143     2345     +202     
- Partials         232      261      +29     
Flag Coverage Δ
e2e 71.79% <32.61%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

@dieguezguille dieguezguille marked this pull request as ready for review April 20, 2026 14:10
sentry[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

sentry[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

sentry[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

View 13 additional findings in Devin Review.

Open in Devin Review

Comment on lines +41 to 44
defaultValues: { receiver: typeof receiver === "string" ? receiver : "" },
onSubmit: ({ value }) => {
router.push({ pathname: "/send-funds/asset", params: { receiver: String(value.receiver) } });
router.push({ pathname: "/send-funds/asset", params: { receiver: value.receiver } });
},
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 Receiver form defaultValues change affects pre-filled address UX

In src/components/send-funds/Receiver.tsx:41-44, the old code used safeParse + form.setFieldValue + form.validateAllFields in the render body to pre-fill and validate addresses from URL params (e.g., QR scan). The new code uses defaultValues: { receiver: typeof receiver === "string" ? receiver : "" }. This fixes the anti-pattern of setting state during render, but the submit button checks !isValid || !isTouched (line 353), so a pre-filled address from URL params won't enable the button until the user interacts with the input. This is a deliberate stabilization per the changeset, though it may require a user tap on the input before proceeding.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant