Skip to content

feat(ctrl): PSBT signing for BTC via sats-connect (V3 flow)#12

Merged
towanTG merged 1 commit intodevelopfrom
feat/ctrl-btc-psbt-v3
Apr 16, 2026
Merged

feat(ctrl): PSBT signing for BTC via sats-connect (V3 flow)#12
towanTG merged 1 commit intodevelopfrom
feat/ctrl-btc-psbt-v3

Conversation

@towanTG
Copy link
Copy Markdown
Contributor

@towanTG towanTG commented Apr 15, 2026

Summary

  • Splits the CTRL UTXO case so Bitcoin wires a proper PSBT signer via CTRL's sats-connect `sign_psbt` RPC
  • Passes the signer into `getUtxoToolbox(Chain.Bitcoin, { signer })` so the toolbox can synthesize `signAndBroadcastTransaction` — unblocking the V3 SwapKit swap plugin for CTRL BTC
  • BCH/DOGE/LTC keep the existing bespoke `walletTransfer` path (CTRL only supports sats-connect for BTC)

Context

The V3 SwapKit plugin calls `wallet.signAndBroadcastTransaction(psbtTransaction)`. That method is synthesized by `getUtxoToolbox` only when a `{ signer }` is passed at construction. CTRL's current BTC path calls `getUtxoToolbox(chain)` with no signer and only overrides `transfer`, so the plugin's V3 path breaks. This PR matches the pattern already used by Phantom / OKX / BITGET / ONEKEY / PASSKEYS.

Notes

  • `provider.request` is invoked with a promise-and-callback wrapper (the existing `transaction()` helper uses callback form; `getCtrlAddress` awaits it as a promise — we tolerate both shapes)
  • PSBT is base64 in and out (CTRL docs: `sign_psbt` with `{ psbt, signInputs, allowedSignHash, broadcast }`)

Test plan

  • Connect CTRL wallet, verify BTC address returned
  • Run a V3 BTC swap end-to-end; confirm `signAndBroadcastTransaction` resolves with a txid
  • Regression: legacy `wallet.transfer({...})` for BTC still works
  • Regression: BCH/DOGE/LTC via CTRL unchanged

🤖 Generated with Claude Code

Wire window.ctrl.bitcoin's sign_psbt RPC into a toolbox signer so
getUtxoToolbox(Chain.Bitcoin, { signer }) synthesizes
signAndBroadcastTransaction, unblocking the V3 SwapKit swap plugin for
CTRL Bitcoin. BCH/DOGE/LTC remain on the bespoke walletTransfer path
since CTRL only exposes sats-connect for BTC.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@towanTG towanTG merged commit 1a9432f into develop Apr 16, 2026
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