bitcoindevkit / bdk-ffi

Please consider this project *experimental*. But we hope to have an official release out soon.
Other
88 stars 39 forks source link

Expose add_foreign_utxo for TxBuilder #329

Open BitcoinZavior opened 1 year ago

BitcoinZavior commented 1 year ago

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

notmandatory commented 1 year ago

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

notmandatory commented 1 year ago

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?

BitcoinZavior commented 1 year ago

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.

notmandatory commented 1 year ago

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.