Skip to content

feat(wallet): port redesigned swap flow - #727

Closed
sahilc0 wants to merge 15 commits into
masterfrom
wt-port-swap-ui-20260707
Closed

sahilc0 wants to merge 15 commits into
masterfrom
wt-port-swap-ui-20260707

Conversation

@sahilc0

@sahilc0 sahilc0 commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This draft PR combines the redesigned wallet swap flow with swap-specific activity presentation and the follow-up fixes from #758 and #762.

  • Ports the redesigned swap flow onto current master: asset selection, amount entry, receive-asset drawer, review, confirmation, and success.
  • Routes wallet and asset-detail swap actions into the new flow.
  • Returns Back to the originating asset detail when Swap was opened from an asset, while preserving the internal picker back path for swaps started from the wallet.
  • Uses the currency and bitcoin unit selected in Settings for the primary swap input, quote values, fees, labels, and decimal precision across every asset pair.
  • Keeps prototype swap history normalized in USD internally so downstream configured-unit history conversion remains correct.
  • Records prototype swap metadata and balance deltas so local confirmations appear in activity.
  • Shows one configured unit-of-account value for a swap in Recent activity instead of separate sent and received balances.
  • Uses reusable overlapping asset-pair icons in both the activity list and swap receipt.
  • Replaces the generic transaction header content with a swap receipt: Swap, asset route, prominent configured-unit value, From, To, Type, Status, When, and Date.
  • Removes send-only Amount, Total, and Direction rows from swap receipts.
  • Keeps Network fees and Transaction ID visible. Missing prototype values display Not available yet without creating fake links; real values take precedence when present.
  • Preserves balance privacy for the hero, list amount, From, and To values.
  • Keeps send and receive detail behavior unchanged.

Tracking

Closes #754.
Closes #758.
Closes #762.

Real swap metadata remains tracked separately:

Affected areas

  • Swap flow and state: src/screens/Wallet/Swap/Index.tsx, src/providers/flow.tsx, src/providers/navigation.tsx, src/providers/wallet.tsx, src/lib/types.ts.
  • Swap activity: src/components/TransactionsList.tsx, src/screens/Wallet/Transaction.tsx, src/components/Details.tsx, src/components/SwapRouteIcon.tsx, src/components/SwapTransactionSummary.tsx, src/lib/swapDisplay.ts.
  • Wallet entry points and presentation: src/screens/Wallet/HomeQuickActions.tsx, src/screens/Wallet/BitcoinDetail.tsx, src/screens/Wallet/AssetsSection.tsx, src/components/WalletSuccessSplash.tsx, send/receive success screens, drawer styling, and src/index.css.
  • Tests: swap flow, activity list, transaction details, portfolio fiat, wallet home, and app routing suites.
  • Review evidence: reviews/codex-code-review-2026-07-13-1622.md, reviews/codex-code-review-2026-07-14-1530.md.

Verification

  • bun run test:unit — 52 files passed; 365 tests passed; 3 skipped.
  • Focused swap flow — 9 tests passed.
  • bunx tsc -b --pretty false.
  • bun run lint.
  • bun run format:check.
  • bun run build.
  • git diff --check.
  • The follow-up commit was applied directly to the existing draft head after verifying the remote head had not changed.
  • Independent GPT-5.5 code review approved the follow-up fixes.

Visual behavior

  • With BTC selected in Settings, opening Swap from a USD account was verified to show 0 BTC as the primary input instead of USD.
  • Pressing Back from that screen was verified to return directly to the USD account detail, not the Choose asset to swap screen.
  • The original swap receipt was also verified at mobile width with project fonts loaded.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@sahilc0, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 47 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6e323fba-dd28-4a16-8dd8-ae0a128bd65d

📥 Commits

Reviewing files that changed from the base of the PR and between 1942e37 and a14093b.

📒 Files selected for processing (47)
  • reviews/codex-code-review-2026-07-13-1622.md
  • reviews/codex-code-review-2026-07-14-1530.md
  • src/components/Details.tsx
  • src/components/SwapRouteIcon.tsx
  • src/components/SwapTransactionSummary.tsx
  • src/components/TokenLogo.tsx
  • src/components/TransactionsList.tsx
  • src/components/WalletSuccessSplash.tsx
  • src/components/ui/drawer.tsx
  • src/hooks/usePortfolioFiat.ts
  • src/icons/ArrowUpDown.tsx
  • src/index.css
  • src/lib/accountAssets.ts
  • src/lib/fiat.ts
  • src/lib/marketData.ts
  • src/lib/swapDisplay.ts
  • src/lib/types.ts
  • src/providers/flow.tsx
  • src/providers/navigation.tsx
  • src/providers/wallet.tsx
  • src/screens/Wallet/AccountDetail.tsx
  • src/screens/Wallet/AssetsSection.tsx
  • src/screens/Wallet/BitcoinDetail.tsx
  • src/screens/Wallet/HomeQuickActions.tsx
  • src/screens/Wallet/Receive/QrCode.tsx
  • src/screens/Wallet/Receive/Success.tsx
  • src/screens/Wallet/Send/Details.tsx
  • src/screens/Wallet/Send/Form.tsx
  • src/screens/Wallet/Send/Success.tsx
  • src/screens/Wallet/Swap/Index.tsx
  • src/screens/Wallet/Transaction.tsx
  • src/test/App.test.tsx
  • src/test/components/transactions-list.test.tsx
  • src/test/hooks/usePortfolioFiat.test.tsx
  • src/test/lib/accountAssets.test.ts
  • src/test/lib/format.test.ts
  • src/test/lib/marketData.test.ts
  • src/test/screens/mocks.ts
  • src/test/screens/wallet/account-detail.test.tsx
  • src/test/screens/wallet/account-market-data.test.ts
  • src/test/screens/wallet/bitcoin-detail.test.tsx
  • src/test/screens/wallet/index.test.tsx
  • src/test/screens/wallet/send.test.tsx
  • src/test/screens/wallet/swap.test.tsx
  • src/test/screens/wallet/transaction.test.tsx
  • src/tokens.css
  • src/vite-env.d.ts

Walkthrough

Adds a prototype swap feature with a dedicated flow, provider state, expanded transaction data, swap-aware transaction and portfolio rendering, reusable success splash UI, and related tests and styling. It also updates dev-mnemonic test environment handling.

Changes

Prototype Swap Feature

Layer / File(s) Summary
Swap contracts and provider wiring
src/lib/types.ts, src/providers/flow.tsx, src/providers/wallet.tsx, src/providers/navigation.tsx
Expands prototype swap data, adds Flow and Wallet context state, stores synthetic swaps and balance deltas, and registers Pages.WalletSwap.
WalletSwap flow and presentation
src/screens/Wallet/Swap/Index.tsx, src/components/ui/drawer.tsx, src/icons/ArrowUpDown.tsx, src/index.css, src/test/screens/wallet/swap.test.tsx
Implements asset selection, amount entry, quote/review, confirmation, success handling, swap styling, and flow tests.
Swap entry points
src/screens/Wallet/BitcoinDetail.tsx, src/screens/Wallet/HomeQuickActions.tsx, src/test/screens/wallet/index.test.tsx
Routes home and Bitcoin-detail swap actions to Pages.WalletSwap instead of the coming-soon sheet.
Swap transaction rendering
src/components/TransactionsList.tsx, src/screens/Wallet/Transaction.tsx, src/index.css
Adds swap status, route, amount, fiat, asset-filter, detail, and failed-amount handling.
Portfolio aggregation and asset resolution
src/hooks/usePortfolioFiat.ts, src/screens/Wallet/AssetsSection.tsx, src/test/hooks/usePortfolioFiat.test.tsx, src/test/screens/mocks.ts
Aggregates stablecoin and CHF balances into synthetic rows, incorporates prototype deltas, and resolves visibility and detail targets from richer portfolio rows.
Wallet success splash
src/components/WalletSuccessSplash.tsx, src/screens/Wallet/Receive/Success.tsx, src/screens/Wallet/Send/Success.tsx
Adds an animated success component and uses it for Receive and Send completion screens.

Estimated code review effort: 4 (Complex) | ~75 minutes

Dev Mnemonic Environment Cleanup

Layer / File(s) Summary
Environment declaration and test setup
src/test/App.test.tsx, src/vite-env.d.ts
Stubs VITE_DEV_MNEMONIC during tests and removes its environment declaration.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Sequence Diagram(s)

sequenceDiagram
  participant BitcoinDetail
  participant FlowContext
  participant WalletSwap
  participant WalletContext
  participant TransactionsList
  BitcoinDetail->>FlowContext: setSwapFromAssetId('btc')
  BitcoinDetail->>WalletSwap: navigate(Pages.WalletSwap)
  WalletSwap->>WalletSwap: buildQuote and validate amount
  WalletSwap->>WalletContext: addPrototypeSwap(execution)
  WalletContext-->>TransactionsList: expose merged prototype transactions
  TransactionsList->>TransactionsList: render swap status and amounts
Loading

Possibly related PRs

  • arkade-os/wallet#627: Both PRs modify the home swap entry-point flow and its transition from a coming-soon sheet.
  • arkade-os/wallet#628: Both PRs modify swap-specific transaction list rendering and Tx.prototypeSwap presentation.
  • arkade-os/wallet#674: Both PRs modify VITE_DEV_MNEMONIC handling in startup, tests, or environment types.

Suggested reviewers: pietro909, bordalix, arkanaai

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: porting the redesigned wallet swap flow and related routing/UI.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch wt-port-swap-ui-20260707

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.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 7, 2026 •

Copy link
Copy Markdown

Deploying wallet-mutinynet with  Cloudflare Pages  Cloudflare Pages

Latest commit: a14093b
Status: ✅  Deploy successful!
Preview URL: https://32f15a64.arkade-wallet.pages.dev
Branch Preview URL: https://wt-port-swap-ui-20260707.arkade-wallet.pages.dev

View logs

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 7, 2026 •

Copy link
Copy Markdown

Deploying tmp-boltz-upstream-mainnet-arkade-wallet with  Cloudflare Pages  Cloudflare Pages

Latest commit: a14093b
Status: ✅  Deploy successful!
Preview URL: https://b1dbb8b6.tmp-boltz-upstream-mainnet-arkade-wallet.pages.dev
Branch Preview URL: https://wt-port-swap-ui-20260707.tmp-boltz-upstream-mainnet-arkade-wallet.pages.dev

View logs

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 7, 2026 •

Copy link
Copy Markdown

Deploying wallet-bitcoin with  Cloudflare Pages  Cloudflare Pages

Latest commit: a14093b
Status: ✅  Deploy successful!
Preview URL: https://6374db76.wallet-bitcoin.pages.dev
Branch Preview URL: https://wt-port-swap-ui-20260707.wallet-bitcoin.pages.dev

View logs

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (3)
src/screens/Wallet/Receive/Success.tsx (1)

72-79: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Extract shared asset-label formatting to avoid duplication.

The displayText computation duplicates the same per-asset label formatting logic already in the notification useEffect at lines 56-61 (prettyAssetAmount + ticker/name fallback). Extracting a small helper would keep both in sync.

♻️ Proposed refactor
+function formatAssetLabel(
+  a: { assetId: string; amount: bigint },
+  meta: AssetDetails | undefined,
+): string {
+  return `${prettyAssetAmount(a.amount, meta?.metadata?.decimals ?? 0)} ${meta?.metadata?.ticker ?? meta?.metadata?.name ?? 'assets'}`
+}
+
   // Inside the notification useEffect:
   const labels = receivedAssets.map((a) => {
-    const meta = assetDetails.get(a.assetId)?.metadata
-    const amount = prettyAssetAmount(a.amount, meta?.decimals ?? 0)
-    const ticker = meta?.ticker ?? meta?.name ?? 'assets'
-    return `${amount} ${ticker}`
+    return formatAssetLabel(a, assetDetails.get(a.assetId))
   })

   // displayText:
   const displayText = isAssetReceive
     ? receivedAssets
-        .map((a) => {
-          const meta = assetDetails.get(a.assetId)?.metadata
-          return `${prettyAssetAmount(a.amount, meta?.decimals ?? 0)} ${meta?.ticker ?? meta?.name ?? 'assets'}`
-        })
+        .map((a) => formatAssetLabel(a, assetDetails.get(a.assetId)))
         .join(', ')
     : `${displayAmount} received successfully`
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/screens/Wallet/Receive/Success.tsx` around lines 72 - 79, The per-asset
label formatting in `displayText` duplicates the same `prettyAssetAmount` plus
ticker/name fallback logic used in the notification `useEffect` inside
`Success`. Extract that shared formatting into a small helper near `Success` and
reuse it in both places so the asset label string is built consistently from
`receivedAssets` and `assetDetails`.
src/components/WalletSuccessSplash.tsx (1)

38-40: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Prefer individual framer-motion transform properties over transform strings.

Using y: '100%' / y: 0 instead of transform: 'translate3d(0, 100%, 0)' is more idiomatic for framer-motion and ensures the spring physics apply reliably to the animated values. The same applies to the motion.span copy animation at lines 54-55 (y: 10 / y: 0).

♻️ Proposed refactor
         <motion.button
           type='button'
           className='wallet-success-splash'
           onClick={handleDone}
-          initial={{ transform: 'translate3d(0, 100%, 0)' }}
-          animate={{ transform: 'translate3d(0, 0%, 0)' }}
-          exit={{ transform: 'translate3d(0, 100%, 0)' }}
+          initial={{ y: '100%' }}
+          animate={{ y: '0%' }}
+          exit={{ y: '100%' }}
           transition={{ type: 'spring', stiffness: 260, damping: 30, mass: 0.95 }}
           aria-label={ariaLabel}
         >
           <motion.span
             className='wallet-success-splash__mark'
             initial={{ opacity: 0, scale: 0.9 }}
             animate={{ opacity: 1, scale: 1 }}
             transition={{ delay: 0.16, type: 'spring', duration: 0.42, bounce: 0.18 }}
           >
             <SuccessIcon small />
           </motion.span>
           <motion.span
             className='wallet-success-splash__copy'
-            initial={{ opacity: 0, transform: 'translate3d(0, 10px, 0)' }}
-            animate={{ opacity: 1, transform: 'translate3d(0, 0, 0)' }}
+            initial={{ opacity: 0, y: 10 }}
+            animate={{ opacity: 1, y: 0 }}
             transition={{ delay: 0.2, duration: 0.24, ease: EASE_OUT_QUINT_TUPLE }}
           >

Also applies to: 54-55

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/WalletSuccessSplash.tsx` around lines 38 - 40, Replace the
string-based transform animations in WalletSuccessSplash with framer-motion’s
individual motion props so the spring behavior applies correctly. Update the
motion container setup in the component to use y values instead of transform
strings, and make the same change in the motion.span copy animation by switching
to y-based initial/animate values. Keep the existing animation flow and timing
the same while updating the relevant motion elements in WalletSuccessSplash.
src/test/hooks/usePortfolioFiat.test.tsx (1)

48-53: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add test coverage for USD aggregation and prototype delta paths.

The current test only covers the CHF aggregation path. The USD bucket (USDT/USDC → account:usd) and prototypeAssetBalanceDeltas integration are critical aggregation paths that lack coverage. Adding test cases following the existing patterns would be straightforward and would verify the clamping logic and sourceAssetIds tracking for these paths.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/test/hooks/usePortfolioFiat.test.tsx` around lines 48 - 53, The current
hook test only validates the CHF aggregation path, so add coverage in
usePortfolioFiat.test.tsx for the USD bucket and prototypeAssetBalanceDeltas
path as well. Extend the existing usePortfolioFiat assertions to verify the
account:usd row produced from USDT/USDC aggregation, including fiatAmount
clamping, satsEquivalent, hasFiatPrice, and sourceAssetIds, and add a case that
exercises prototypeAssetBalanceDeltas through usePortfolioFiat to confirm the
same aggregation behavior is preserved there.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/ui/drawer.tsx`:
- Line 44: The base DrawerContent styles in drawer.tsx are leaking border styles
into SheetModal because it also reuses DrawerContent; scope the border-related
classes to the swap variant only. Update the DrawerContent class set so the
generic drawer keeps border-0, and apply border-t/b and related directional
border classes only when the .swap-drawer-content variant is used.

In `@src/index.css`:
- Line 1802: Update the affected CSS declarations in the stylesheet to satisfy
stylelint: replace the deprecated clip usage with clip-path: inset(50%) in the
rule that currently contains clip: rect(0 0 0 0), and change the currentColor
value to lowercase currentcolor in the declaration at the other reported
location. Keep the surrounding selectors and spacing unchanged while fixing
those two declarations.
- Around line 2749-2762: The reduced-motion override in the stylesheet currently
stops splash path animations and active transforms, but it still leaves the
infinite swap skeleton shimmer running. Update the existing
prefers-reduced-motion block in index.css to also disable the swap skeleton
shimmer animation by targeting the same skeleton/shimmer selector used for the
swap loading state, so all motion is suppressed consistently when reduced motion
is requested.

In `@src/providers/wallet.tsx`:
- Around line 151-152: Clear the prototype swap state when the wallet is locked
or reset. In WalletProvider, make sure both prototypeTxs and
prototypeAssetBalanceDeltas are emptied inside the lockWallet and resetWallet
flows so a new session does not inherit stale swap history or balance deltas.
Use the existing state setters for prototypeTxs and prototypeAssetBalanceDeltas,
and verify any helper paths that trigger wallet reset also clear both buckets
consistently.

---

Nitpick comments:
In `@src/components/WalletSuccessSplash.tsx`:
- Around line 38-40: Replace the string-based transform animations in
WalletSuccessSplash with framer-motion’s individual motion props so the spring
behavior applies correctly. Update the motion container setup in the component
to use y values instead of transform strings, and make the same change in the
motion.span copy animation by switching to y-based initial/animate values. Keep
the existing animation flow and timing the same while updating the relevant
motion elements in WalletSuccessSplash.

In `@src/screens/Wallet/Receive/Success.tsx`:
- Around line 72-79: The per-asset label formatting in `displayText` duplicates
the same `prettyAssetAmount` plus ticker/name fallback logic used in the
notification `useEffect` inside `Success`. Extract that shared formatting into a
small helper near `Success` and reuse it in both places so the asset label
string is built consistently from `receivedAssets` and `assetDetails`.

In `@src/test/hooks/usePortfolioFiat.test.tsx`:
- Around line 48-53: The current hook test only validates the CHF aggregation
path, so add coverage in usePortfolioFiat.test.tsx for the USD bucket and
prototypeAssetBalanceDeltas path as well. Extend the existing usePortfolioFiat
assertions to verify the account:usd row produced from USDT/USDC aggregation,
including fiatAmount clamping, satsEquivalent, hasFiatPrice, and sourceAssetIds,
and add a case that exercises prototypeAssetBalanceDeltas through
usePortfolioFiat to confirm the same aggregation behavior is preserved there.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0632f6ab-35ba-4d30-b11a-8765fa98c089

📥 Commits

Reviewing files that changed from the base of the PR and between 3e5df15 and c1d654e.

📒 Files selected for processing (23)
  • src/components/TransactionsList.tsx
  • src/components/WalletSuccessSplash.tsx
  • src/components/ui/drawer.tsx
  • src/hooks/usePortfolioFiat.ts
  • src/icons/ArrowUpDown.tsx
  • src/index.css
  • src/lib/types.ts
  • src/providers/flow.tsx
  • src/providers/navigation.tsx
  • src/providers/wallet.tsx
  • src/screens/Wallet/AssetsSection.tsx
  • src/screens/Wallet/BitcoinDetail.tsx
  • src/screens/Wallet/HomeQuickActions.tsx
  • src/screens/Wallet/Receive/Success.tsx
  • src/screens/Wallet/Send/Success.tsx
  • src/screens/Wallet/Swap/Index.tsx
  • src/screens/Wallet/Transaction.tsx
  • src/test/App.test.tsx
  • src/test/hooks/usePortfolioFiat.test.tsx
  • src/test/screens/mocks.ts
  • src/test/screens/wallet/index.test.tsx
  • src/test/screens/wallet/swap.test.tsx
  • src/vite-env.d.ts
💤 Files with no reviewable changes (1)
  • src/vite-env.d.ts

Comment thread src/components/ui/drawer.tsx Resolved
Comment thread src/index.css Resolved
Comment thread src/index.css Resolved
Comment thread src/providers/wallet.tsx Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/test/screens/wallet/swap.test.tsx (1)

157-179: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a test for the swap confirmation flow.

The review dialog test stops before clicking "Confirm," so addPrototypeSwap is never exercised. A confirmation test would verify the core swap flow: that addPrototypeSwap is called with correct arguments and the success splash renders. The WalletContext mock in renderSwap doesn't explicitly provide addPrototypeSwap, so it would need to be added (e.g., addPrototypeSwap: vi.fn()).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/test/screens/wallet/swap.test.tsx` around lines 157 - 179, Add a
confirmation-flow test alongside the existing “shows a human-readable amount and
fee breakdown” test: provide an addPrototypeSwap mock in renderSwap’s
WalletContext setup, click Confirm in the review dialog, assert it is called
with the expected swap arguments, and verify the success splash renders.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/test/screens/wallet/swap.test.tsx`:
- Around line 157-179: Add a confirmation-flow test alongside the existing
“shows a human-readable amount and fee breakdown” test: provide an
addPrototypeSwap mock in renderSwap’s WalletContext setup, click Confirm in the
review dialog, assert it is called with the expected swap arguments, and verify
the success splash renders.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5d34bdd3-762b-4376-affe-98f15fb3454a

📥 Commits

Reviewing files that changed from the base of the PR and between c1d654e and 1942e37.

📒 Files selected for processing (8)
  • src/components/WalletSuccessSplash.tsx
  • src/components/ui/drawer.tsx
  • src/index.css
  • src/providers/wallet.tsx
  • src/screens/Wallet/Receive/Success.tsx
  • src/screens/Wallet/Swap/Index.tsx
  • src/test/hooks/usePortfolioFiat.test.tsx
  • src/test/screens/wallet/swap.test.tsx
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/components/WalletSuccessSplash.tsx
  • src/index.css
  • src/screens/Wallet/Receive/Success.tsx
  • src/screens/Wallet/Swap/Index.tsx

sahilc0 and others added 6 commits July 13, 2026 16:35
Port the redesigned wallet swap experience onto the current wallet home redesign, including the swap route, asset picker, composer, review drawer, success splash, and wallet entry points.

Add prototype swap transaction metadata and portfolio balance deltas so local swap confirmations render in home activity and transaction details while remaining fenced from real settlement behavior.

Fold in the home activity/rate note follow-up by moving recent activity above upsells, removing the LendaSat upsell, adding the dynamic-rate note, and covering the flow with wallet swap tests.
Replace the ambiguous estimated and total value presentation with explicit Swap, Receive, and Fees rows in the review drawer. Keep the prototype fee at zero until live quote integration supplies the final value, and cover the 50 USD review case with a regression test.
Scope the flexible asset-copy layout to its dedicated wrapper so custom token avatars remain square in the swap composer. Add a regression test covering custom asset icons.
Show a single configured-unit value in recent swap activity and render reusable asset-pair receipt details with privacy-aware From and To values.\n\nKeep honest placeholders for swap fees and transaction IDs until real metadata is persisted, while allowing real values to take precedence.
sahilc0 added 5 commits July 13, 2026 16:44
Normalize USDT, USDC, and AUSD wallet surfaces to USD and DPIX/DEPIX to BRL while preserving the underlying asset IDs for transfers. Aggregate equivalent fiat tokens into account balances, use currency flags, and keep issuer branding out of wallet-facing send, receive, swap, activity, and transaction views.\n\nRefs #760
Route wallet accounts to the bitcoin-style detail experience with price, actions, genuine historical cross-rate charts, balances, values, and filtered activity. Show an explicit unavailable state when a real market history cannot be derived, and rename the wallet section from Assets to Accounts.

Refs #763
Refs #759
Use normalized fiat asset quantities and live exchange rates for wallet activity and transaction details instead of bitcoin dust amounts. Keep sent detail values absolute while preserving signed asset labels and direction, with received and sent regressions covered.

Refs #760

Refs #763
Display Brazilian real amounts with the unambiguous BRL code across wallet surfaces. Color each supported account chart from the primary identity color of its currency flag, with centralized tokens and regression coverage.

Refs #759

Refs #760

Refs #763
Keep non-fiat tokens on their administration detail screen while fiat accounts retain the wallet account experience. Carry normalized account context through send, allocate amounts across real backing assets with decimal-aware balances, and use the largest backing rail for receive.

Add regressions for multi-source USD sends and non-fiat detail routing.

Refs #759

Refs #760

Refs #763
sahilc0 and others added 3 commits July 13, 2026 17:21
Prevent partial fiat subtotals for mixed-asset transactions, retain cross-issuer sub-cent precision until aggregation completes, and provide a stable fallback label when asset ticker metadata is unavailable. Add regression coverage for each corrected path.
Merge the completed fiat-account presentation, market detail, activity valuation, BRL labeling, chart localization, and aggregated account action work into the swap feature branch.
Return directly to the originating asset detail when a swap starts there, while retaining the internal picker back path for swaps started from the wallet.

Format and convert primary swap amounts using the currency and bitcoin unit selected in Settings, with regression coverage for navigation and BTC precision.
Sample constant currency pairs uniformly across the selected window so Liveline retains data near both viewport edges after applying its internal buffer.

Use the shared series builder for fiat account charts and cover standard and all-time windows plus the USD account integration.
@sahilc0

sahilc0 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@sahilc0

sahilc0 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #784. The updated wallet and swap UI from this PR was ported onto #784 through #798, while retaining the newer swap implementation.

@sahilc0 sahilc0 closed this Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

2 participants