Repository navigation
feat(swap): pick the pay asset across every account, then the account to pay from, and restore the paying account from Swap History [PER-3082] - #2455
Merged
Conversation
… to pay from, and restore the paying account from Swap History
Device e2e flows affectedEvery suite (22 suites, 255 scenarios, 47 p0): a change under a path every screen depends on.
Run them:
|
…ync keeps its token
yasin-ce
approved these changes
Nov 16, 2026
yasin-ce
left a comment
Collaborator
There was a problem hiding this comment.
This makes Swap From list holdings across all accounts, adds a Select account step when several accounts hold the asset, and makes the Swap History chips work across accounts and switch to the account that paid. The logic sits in the swaps package, the app hooks are thin, every new hook and util has a spec, and the integration flow covers the main path. I don't see anything blocking. Below are a few minor points on duplicated filtering logic and two edge cases in the batched history read.
…tory per batch and per deployment so one failure or a testnet account doesn't hide the rest
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.
Pull Request Template
Description
Swap could only pay with assets held by the account selected in the header, so finding an asset meant guessing which account held it and switching first. Per the new design, Swap From now lists what every account holds, asks which account pays when several hold the chosen asset, and Swap History chips bring back the account that paid as well as the pair.
useSwapPayHoldings(swaps package) groups every swap-signing account's holdings into one row per asset and network, totalled, with each row's holders largest first; hidden tokens, collectibles and networks an account can't pay from are left out, as before. It lists nothing until every account's holdings are read, so a quick tap can't skip the account choice.SwapSourceAccountList), with a back arrow through a newonBackonSheetHeader; with a single holder the step is skipped.pairAccountIdin the swaps store, written bysetAccountPair, marks the pair as chosen for that account, so the form's reset on account switch and the screen's reset on network change no longer wipe it.source_accountis now parsed intoSwapHistoryItem.sourceAccount, anduseRecentSwapPairsQuerymatches each pair to the account that paid. Tapping a chip restores the pair and switches to that account and its network; a pair with a leg on another network, or one its payer can no longer pay on, is left out.useChainNetworkLabelin chain-ui thatuseChainLabelnow builds on.useAccountsHoldingsAcrossChainsQuery(accounts package) reads many accounts' holdings across chains under the existing per-account cache keys; the single-account version wraps it.Covered by package specs for the pay holdings, grouping, recent pairs, payer matching, batched history query (including a failed batch and a custom-node account), account addresses, source-chain resolver, router ids, store and the CAIP-10 parsing, and app specs for the form's account switch, the screen's chain-change guard, the asset/account selection sheet and the history chips. An Ethereum integration flow picks a token two accounts hold, chooses the second, and checks the swap pays from it with the token kept.
Related Issues
Closes https://linear.app/algorandfoundation/issue/PER-3082/apply-new-asset-selection-flow-to-swaps
Checklist
Additional Notes