From 8157a3a2f614b1b85c49cf09663f55398b00dba7 Mon Sep 17 00:00:00 2001 From: thunderbiscuit Date: Fri, 10 Jan 2025 14:34:36 -0500 Subject: [PATCH] feat: add optional sign_options argument to Wallet::finalize_psbt method --- bdk-ffi/src/bdk.udl | 2 +- bdk-ffi/src/wallet.rs | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/bdk-ffi/src/bdk.udl b/bdk-ffi/src/bdk.udl index 539d49d3..99da5531 100644 --- a/bdk-ffi/src/bdk.udl +++ b/bdk-ffi/src/bdk.udl @@ -644,7 +644,7 @@ interface Wallet { /// /// The [`SignOptions`] can be used to tweak the behavior of the finalizer. [Throws=SignerError] - boolean finalize_psbt(Psbt psbt); + boolean finalize_psbt(Psbt psbt, SignOptions? sign_options); /// Compute the `tx`'s sent and received [`Amount`]s. /// diff --git a/bdk-ffi/src/wallet.rs b/bdk-ffi/src/wallet.rs index 6ef24140..c03c0eba 100644 --- a/bdk-ffi/src/wallet.rs +++ b/bdk-ffi/src/wallet.rs @@ -176,10 +176,19 @@ impl Wallet { .map_err(SignerError::from) } - pub fn finalize_psbt(&self, psbt: Arc) -> Result { + pub fn finalize_psbt( + &self, + psbt: Arc, + sign_options: Option, + ) -> Result { let mut psbt = psbt.0.lock().unwrap(); + let bdk_sign_options: BdkSignOptions = match sign_options { + Some(sign_options) => BdkSignOptions::from(sign_options), + None => BdkSignOptions::default() + }; + self.get_wallet() - .finalize_psbt(&mut psbt, BdkSignOptions::default()) + .finalize_psbt(&mut psbt, bdk_sign_options) .map_err(SignerError::from) }