feat: dollar tokens Phase 3.2 UI - virtual Dolares in Swap + Gold Buy#151
Merged
Conversation
…aredTransactions per step
Extract DolaresMultiStepSummary to a shared component, replace SwapScreen's inline summary with it, and wire the same virtual-Dolares + planSpend + executeMultiSwap pattern into GoldBuyEnterAmount and GoldBuyConfirmation so users can spend aggregated dollar balances to buy XAUt0.
Merged
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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- newfetchSwapQuoteForExecution(light fetchSwapQuote + prepareSwapTransactions) used by the orchestrator saga per step. LightfetchSwapQuotestays 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- newdollarsSpend.*keys (tokenLabel, confirmAggregate, expandedDetailHeader, stepCount, stepProgress, partialSuccess, shortfall).Knip / cleanup
knip.ts- removed thesrc/dollarsSpend/index.tsignore 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- passyarn lint- passyarn 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 moduleKnown follow-ups (Phase 3.3 + later polish)
minAmountper token (V1 uses minAmountUsd=0; planner skips zero-balance, but sub-$1 dust may produce a quote that fails - acceptable per spec).Test plan