Skip to content

feat: dollar tokens Phase 3.2 UI - virtual Dolares in Swap + Gold Buy#151

Merged
TuCopFi merged 8 commits into
Developmentfrom
feat/dollars-spend-ui
Jun 5, 2026
Merged

feat: dollar tokens Phase 3.2 UI - virtual Dolares in Swap + Gold Buy#151
TuCopFi merged 8 commits into
Developmentfrom
feat/dollars-spend-ui

Conversation

@TuCopFi

@TuCopFi TuCopFi commented Jun 5, 2026

Copy link
Copy Markdown
Member

Summary

Phase 3.2 UI integration. Bolts the Phase 3 foundation onto SwapScreen and GoldBuyEnterAmount/GoldBuyConfirmation. Users now see a single 'Dolares' option in the swap and gold-buy pickers that internally walks the spend order (USAT > USDm > USDC > USDT) via multi-step swaps.

Send Dolares is OUT OF SCOPE here (Phase 3.3 separate plan because Send uses transferSubmitSaga not swapSubmitSaga, and the recipient-side UX needs separate design).

What this PR contains

Architectural fix

  • src/swap/useSwapQuote.ts - new fetchSwapQuoteForExecution (light fetchSwapQuote + prepareSwapTransactions) used by the orchestrator saga per step. Light fetchSwapQuote stays for UI previews.
  • src/dollarsSpend/saga.ts - the saga now selects walletAddress + fromToken + feeCurrencies and calls fetchSwapQuoteForExecution so swapSubmitSaga gets real preparedTransactions per step. Foundation gap closed.

New components

  • src/dollarsSpend/dolaresVirtualToken.ts - builds the synthetic 'Dolares' TokenBalance prepended to picker lists. Returns null when balances total 0.
  • src/dollarsSpend/MultiSwapProgressSheet.tsx - 'Paso X de Y: convirtiendo {{symbol}}' in-flight progress.
  • src/dollarsSpend/PartialSuccessSheet.tsx - 'Completaste X de Y pasos. Reintentar?' after partial failure with retry/cancel actions.
  • src/dollarsSpend/DolaresMultiStepSummary.tsx - aggregate + expandable per-step breakdown shared by SwapScreen + GoldBuyConfirmation.

Screen integrations

  • src/swap/SwapScreen.tsx - filters dollar tokens from the from picker, prepends Dolares row, branches confirmation render + dispatch. Existing single-swap flow unchanged.
  • src/gold/GoldBuyEnterAmount.tsx - same picker filter + prepend.
  • src/gold/GoldBuyConfirmation.tsx - virtual Dolares branch: multi-step plan + quote + summary + shortfall banner + executeMultiSwap dispatch. Single-token gold buy unchanged.

i18n

  • locales/{base,es-419}/translation.json - new dollarsSpend.* keys (tokenLabel, confirmAggregate, expandedDetailHeader, stepCount, stepProgress, partialSuccess, shortfall).

Knip / cleanup

  • knip.ts - removed the src/dollarsSpend/index.ts ignore line; UI now consumes the barrel.
  • src/dollarsSpend/index.ts - trimmed to only externally consumed symbols (the rest are imported directly from their source modules where needed).

Verification

  • yarn build:ts - pass
  • yarn lint - pass
  • yarn test - 378 suites, 4044 tests, 96 snapshots pass (existing single-swap flow tests unchanged, plus 3 new virtual-Dolares cases in SwapScreen + 3 in DolaresMultiStepSummary + 3 in dolaresVirtualToken + 4 in MultiSwapProgressSheet + 3 in PartialSuccessSheet)
  • yarn knip --no-gitignore - clean for the dollarsSpend module

Known follow-ups (Phase 3.3 + later polish)

  • Phase 3.3 - Send Dolares: separate plan. Multi-transfer instead of multi-swap; recipient sees N ERC-20 transfers from same sender.
  • Dynamic Squid minAmount per token (V1 uses minAmountUsd=0; planner skips zero-balance, but sub-$1 dust may produce a quote that fails - acceptable per spec).
  • Settings UI to revoke ERC-20 allowances (per spec follow-up).
  • Permit2 / multicall integration (long-term, requires Squid native support).

Test plan

  • All existing tests pass (no regression in single-token swap or gold buy)
  • CI passes
  • Mainnet manual QA on Android (Pixel 8 emulator + real device) with wallet holding USDT only -> single-step path
  • Mainnet manual QA with wallet holding USAT + USDm + USDC -> three-step path with priority order
  • Manual QA: force a failure mid-chain -> partial-success sheet appears with correct remaining USD + retry path
  • Manual QA: enter amount > total Dolares balance -> shortfall banner blocks confirm

@TuCopFi TuCopFi merged commit 8a898ae into Development Jun 5, 2026
8 checks passed
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