bdk-ffi icon indicating copy to clipboard operation
bdk-ffi copied to clipboard

Expose add_foreign_utxo for TxBuilder

Open BitcoinZavior opened this issue 1 year ago • 4 comments

At the moment TxBuilder does not have add_foreign_utxo

https://bitcoindevkit.org/docs-rs/bdk/nightly/latest/bdk/wallet/tx_builder/struct.TxBuilder.html#method.add_foreign_utxo

It will be great to have this method exposed so that it can be used in the language and framework bindings.

There is interest from the community in using this method in apps.

Ref: https://github.com/LtbLightning/bdk-flutter/issues/63

BitcoinZavior avatar Mar 24 '23 14:03 BitcoinZavior

@thunderbiscuit can you put this on the agenda for Tues call? Let's see if we can get it into the next release.

notmandatory avatar May 25 '23 17:05 notmandatory

Looks like there are a few other changes needed before we can enable this function. Per @BitcoinZavior's example in https://github.com/LtbLightning/bdk-flutter/issues/63 other structs and functions we're missing in bdk-ffi are:

  1. psbt::Input, shouldn't need to expose internals
  2. psbt::PsbtSighashType, only add to UDL?
  3. Wallet::get_psbt_input
  4. Descriptor::max_satisfaction_weight

Should we divide and conquer and do in multiple PRs or all in one?

notmandatory avatar May 31 '23 20:05 notmandatory

This comparison shows the Rust file changes: https://github.com/LtbLightning/bdk-flutter/compare/main...foreign-utxo?expand=1

This branch was made as an example for someone to use.

BitcoinZavior avatar May 31 '23 21:05 BitcoinZavior

I went ahead and created #362 to add the Input, PsbtSighashType structs and the Wallet::get_psbt_input function. Once those are in it should be easier to finish up this PR.

EDIT: forgot about the Descriptor::max_satisfaction_weightfunction, I'll add that too.

notmandatory avatar Jun 01 '23 00:06 notmandatory