Skip to content

feat(recovery): make on-chain sweep work on mainnet, add ASP switching#11

Merged
Jeezman merged 1 commit into
mainfrom
feat/recovery-sweep-and-asp-switch
Jun 24, 2026
Merged

feat(recovery): make on-chain sweep work on mainnet, add ASP switching#11
Jeezman merged 1 commit into
mainfrom
feat/recovery-sweep-and-asp-switch

Conversation

@Jeezman

@Jeezman Jeezman commented Jun 24, 2026

Copy link
Copy Markdown
Owner

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.

…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.
@Jeezman Jeezman merged commit 07cdefb into main Jun 24, 2026
2 checks passed
@Jeezman Jeezman deleted the feat/recovery-sweep-and-asp-switch branch June 24, 2026 12:43
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