Add core-side synthetic destination for swap-to-address - #730
Open
j0ntz wants to merge 3 commits into
Open
Conversation
Contributor
Author
6 tasks
- EdgeSwapRequest accepts an optional toAddressInfo descriptor (toPluginId, toAddress, toMemos) as an alternative to toWallet, with exactly one of the two required. The core builds a synthetic, bridgified destination wallet backed by the real currencyConfig, so swap plugins receive an EdgeCurrencyWallet unchanged. - Destination memos (e.g. an XRP destination tag) use the descriptor only as GUI-to-core transport; plugins read them off the synthetic wallet's getMemos method (EdgeSyntheticDestinationWallet). - EdgeTxActionSwap.payoutWalletId and EdgeTxSwap.payoutWalletId become optional, since a swap-to-address destination has no payout wallet. - The pasted destination address and memo values are redacted from swap-quote logs.
j0ntz
force-pushed
the
jon/stealth-send-swap
branch
from
July 3, 2026 03:13
edc8fbd to
c12ad45
Compare
A swap-to-address send, a private same-asset send, and a private cross-asset send all settle through a swap provider and carry every other field of EdgeTxActionSwap, so they stay swaps to existing consumers. What differs is the flow the user ran, which a UI needs in order to title the transaction. The optional swapType field names it, and the saved-action cleaner carries it so it survives a round trip.
j0ntz
force-pushed
the
jon/stealth-send-swap
branch
from
July 30, 2026 01:55
3053725 to
2814d2c
Compare
A privacy feature powered by one provider needs two things the swap API could not express: a quote that must be sender-unlinkable rather than merely routed through the provider, and a provider the user's swap settings cannot switch off for that one feature.
j0ntz
force-pushed
the
jon/stealth-send-swap
branch
from
July 30, 2026 07:56
2814d2c to
ca9ed1d
Compare
Bugbot is paused — on-demand spend limit reachedBugbot uses usage-based billing for this team and has hit its on-demand spend limit. A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue. |
Contributor
Author
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit ca9ed1d. Configure here.
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.


CHANGELOG
Does this branch warrant an entry to the CHANGELOG?
Dependencies
none
Description
Technical design doc
Asana task
Production implementation of swap-to-address (the core piece of Stealth Send / send-to-any-asset).
EdgeSwapRequestaccepts an optionaltoAddressInfodescriptor as an alternative totoWallet(exactly one of the two required); the core builds a synthetic, bridgified destination wallet from it, backed by the realcurrencyConfig, so swap plugins receive anEdgeCurrencyWalletunchanged. Nothing Houdini-specific lives in core: the same mechanism powers provider-agnostic send-to-any-asset (verified in-app with a ChangeNOW-routed cross-chain send).Judgement calls, with alternates:
EdgeSwapToAddressInfocarries onlytoPluginId,toAddress, and optionaltoMemos.toPluginIdselects thecurrencyConfig(not derivable from the request);toAddressis the payload; the destination token comes from the request's owntoTokenId. Alternate (descriptor carryingtoTokenId) was rejected as a two-sources-of-truth hazard.getMemoson the synthetic wallet. For memo-required payout chains (e.g. an XRP destination tag), the descriptor'stoMemosis only the GUI-to-core transport; plugins never read the descriptor. The synthetic wallet exposesgetMemos()(EdgeSyntheticDestinationWallet), so the plugin-facing mechanism stays wallet-shaped. Alternate (plugins reading a tag field off the request descriptor) was rejected to keep the plugin interface generic. A pure no-descriptor design is not physically possible: the value must cross the GUI-core bridge somewhere, and the descriptor is the plain-data channel that crosses yaob cleanly.EdgeTxActionSwap.payoutWalletIdandEdgeTxSwap.payoutWalletIdare both optional now. A swap-to-address destination has no payout wallet;payoutAddresscarries the destination. Making only the action type optional (the prototype state) left a latent inconsistency inEdgeTxSwap. Alternate (keeping them required and writing the syntheticsynthetic://<pluginId>id) was rejected: it embeds fake wallet ids in persistent tx metadata.The yaob bridge-crossing proof test covers descriptor-only construction, plugin-faithful reads, memo round-trip via
getMemos, and the synthetic surviving the wire format back to the GUI.Testing:
tscclean, 174 mocha tests pass, eslint clean,verify-repo.shPASSED. The plugin-selection rule thatforceEnabledanddisabledencode is now a named predicate (isSwapPluginQueryable) instead of an inline condition insidefetchSwapQuotes, with its full truth table under test. The corner that matters: a caller can reach a provider the user switched off, and can never reach one it disabled itself in the same call, which is exactly what a stealth send does (every other plugin disabled, Houdini force-enabled, one request). In-app verification (linked into edge-react-gui with the Stealth Send UI): a real cross-chain send-to-address executed on the iOS sim through this mechanism (Base ETH to an Ethereum address via ChangeNOW, deposit broadcast on-chain, swap success scene reached).Note
Medium Risk
Changes the central swap quote path and makes
toWalletoptional onEdgeSwapRequest, which can break callers that assumed a payout wallet id always exists; synthetic wallet casting is intentionally partial but plugins only touch the implemented surface.Overview
Adds swap-to-address so swaps can target a pasted destination instead of a user wallet, enabling send-to-any-asset and private-send flows without changing swap plugins.
EdgeSwapRequestnow accepts eithertoWalletortoAddressInfo(exactly one). The core validates the descriptor, builds a bridgified synthetic destination wallet from realcurrencyConfig, and passes a normaltoWalletto plugins. Destination memos ride on syntheticgetMemos()(EdgeSyntheticDestinationWallet), not on the descriptor. Quote logging redacts pasted addresses and memo values.API additions: optional
privacy: 'required'on swap requests; optionalforceEnabledonEdgeSwapRequestOptions(withdisabledstill winning—isSwapPluginQueryable); optionalswapTypeonEdgeTxActionSwapfor send-shaped flows.payoutWalletIdon swap tx metadata is now optional when there is no payout wallet.Cleaners,
SwapCurrencyError, and tests cover synthetic wallet bridge behavior and plugin-selection truth table.Reviewed by Cursor Bugbot for commit ca9ed1d. Bugbot is set up for automated code reviews on this repo. Configure here.