Skip to content

feat(wallet-connect): impl BTC (UTxO) for swaps v2#2617

Open
mariocynicys wants to merge 49 commits intodevfrom
btc-walletconnect-for-swaps-v2
Open

feat(wallet-connect): impl BTC (UTxO) for swaps v2#2617
mariocynicys wants to merge 49 commits intodevfrom
btc-walletconnect-for-swaps-v2

Conversation

@mariocynicys
Copy link
Collaborator

This PR adds support for swaps v2 (TPU) via WalletConnect for UTxO.

The only difference in transaction signing between v1 and v2 swaps are just the co-operative signing step in:

  • funding spend (aka taker payment)
  • taker payment spend (aka finalizing tx)

In these two, each side performs pretty much the same P2SH signing call as before but only stores (and sends) the bare signature returned from WalletConnect. This is analogous to calling calc_and_sign_sighash using a KeyPair.

And then the same process as before goes on: signatures are later combined to create the complete script_sig, etc...

A manual test is added for this feat: test_walletconnect_swap_v2, and this: #2566 (comment) is how to run it.

mariocynicys and others added 30 commits July 31, 2025 14:25
this method will be needed in swaps as we can't use sendTransfer for unlocking HTLCs (i.e. needed for swaps v1 and v2)
which forces us to return Public instead of &Public from this function, and a whole wave of ripple effects all over
the caller needs to provide a map of utxo transactions for the p2pkh inputs, otherwise signing will fail
soley contained in geenrate_and_send_tx
…s in utxo_common

so kdf won't panic cuz we don't have walletconnect
we better remove these panics tho

note that not all these methods are needed for swap v1. but i did them
nontheless
requires manual testing with walletconnect capable wallets by the test step by step
idk why we sent the watcher message one time then moved to the next step and created a handle to keep sending it periodically.
this commit makes it so we don't do the initial send but only create the handler to keep sending it periodically as before (this part didin't change, but the log message was put in the appropriate place)
this is to be handled in a different PR since it seems it might be complext.
we need to sign the watcher msg with the htlc privkey which means we will ask walletconnect for one more signature. this might get entangled with p2p crate code
via reverting back to use derive_htlc_key_pair using the unique swap data
Co-authored-by: Onur Özkan <work@onurozkan.dev>
we don't need the custom error message given we already have the error trace using MmError
@shamardy shamardy removed the [] label Dec 9, 2025
@github-actions
Copy link

@dimxy @shamardy @onur-ozkan
Please review it again.

@github-actions github-actions bot added the [] label Dec 11, 2025
@github-actions
Copy link

@dimxy @shamardy @onur-ozkan
Please review it again.

7 similar comments
@github-actions
Copy link

@dimxy @shamardy @onur-ozkan
Please review it again.

@github-actions
Copy link

@dimxy @shamardy @onur-ozkan
Please review it again.

@github-actions
Copy link

@dimxy @shamardy @onur-ozkan
Please review it again.

@github-actions
Copy link

@dimxy @shamardy @onur-ozkan
Please review it again.

@github-actions
Copy link

@dimxy @shamardy @onur-ozkan
Please review it again.

@github-actions
Copy link

@dimxy @shamardy @onur-ozkan
Please review it again.

@github-actions
Copy link

github-actions bot commented Jan 2, 2026

@dimxy @shamardy @onur-ozkan
Please review it again.

@github-actions
Copy link

github-actions bot commented Jan 7, 2026

@shamardy
Please review it again.

1 similar comment
@github-actions
Copy link

github-actions bot commented Jan 9, 2026

@shamardy
Please review it again.

Base automatically changed from btc-walletconnect-for-swaps to dev January 12, 2026 04:36
@github-actions
Copy link

@shamardy
Please review it again.

@github-actions github-actions bot added the [] label Jan 15, 2026
@github-actions
Copy link

@shamardy
Please review it again.

7 similar comments
@github-actions
Copy link

@shamardy
Please review it again.

@github-actions
Copy link

@shamardy
Please review it again.

@github-actions
Copy link

@shamardy
Please review it again.

@github-actions
Copy link

@shamardy
Please review it again.

@github-actions
Copy link

@shamardy
Please review it again.

@github-actions
Copy link

github-actions bot commented Feb 4, 2026

@shamardy
Please review it again.

@github-actions
Copy link

github-actions bot commented Feb 6, 2026

@shamardy
Please review it again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants