feat(recovery): make on-chain sweep work on mainnet, add ASP switching#11
Merged
Conversation
…g, redesign send/receive
## Recovery / unilateral-exit sweep.
The SDK's send_on_chain builds a 0-fee transaction the relay rejects "min relay fee not met"), so sweeping unilaterally-exited VTXOs never worked on mainnet. Replaced with a self-built, fee-bearing sweep:
- build_sweep_tx: copy ark-core's proven taproot script-path build/sign
sequence but reserve a real fee from change (sweep_fee, sized from the
live fee rate; floored at 1 sat/vB).
- Discover sweepable outpoints from the cached candidates the UI shows
(not a gap-limit address scan, which missed unrolled VTXOs); resolve
scripts via the connected client's authoritative get_offchain_addresses,
reconstructing default VTXOs only as an offline fallback.
- Select all mature inputs and clamp the sent amount to selected − fee, so
a near-max ("Max") sweep sends total − fee instead of failing when the
fee exceeds a fixed headroom.
- Unify VTXO/boarding maturity on can_be_claimed_unilaterally_by_owner with
a 2h MTP safety margin so a near-boundary sweep isn't built non-final.
- Resolve owner keys via the live provider's get_keypair_for_pk (no fixed
derivation ceiling when connected).
- Surface fee-estimate failures instead of broadcasting at relay-minimum;
get_fee_rate falls back to the nearest target, not 1.0 sat/vB.
## ASP switching
- probe_asp / switch_asp commands: validate + test-connect, hard-block a
network mismatch (sourced from wallet.json, refusing when unknown),
persist to settings.json + wallet.json, and rebuild the live client in
place via reconnect_wallet_client (restart-to-retry on failure).
- AspConfig gains a switch mode (probe → typed confirm) launched from
Settings.
## Send / Receive UX
- Shared AmountField hero input and rails/RailChip identity across both
sheets (single source of truth for colour/glyph/label).
- Send: rail-aware accents, paste + scan, fee-aware spendable max (offboard
fee comes from change, so Max now reserves it).
- Receive: tabbed Ark / On-chain / Lightning with per-rail QR + caption.
## Deps / config
- Bump ark-* SDK to v0.9.3 (sends x-build-version satisfying the ASP gate).
- Add tauri-plugin-clipboard-manager (+ capability) for paste; dotenvy.
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.
Recovery / unilateral-exit sweep.
The SDK's send_on_chain builds a 0-fee transaction the relay rejects "min relay fee not met"), so sweeping unilaterally-exited VTXOs never worked on mainnet. Replaced with a self-built, fee-bearing sweep:
ASP switching
Send / Receive UX
Deps / config