Skip to content

Commit

Permalink
feat: add optional sign_options argument to Wallet::finalize_psbt method
Browse files Browse the repository at this point in the history
  • Loading branch information
thunderbiscuit committed Jan 10, 2025
1 parent 536aff8 commit 8157a3a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bdk-ffi/src/bdk.udl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down
13 changes: 11 additions & 2 deletions bdk-ffi/src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,19 @@ impl Wallet {
.map_err(SignerError::from)
}

pub fn finalize_psbt(&self, psbt: Arc<Psbt>) -> Result<bool, SignerError> {
pub fn finalize_psbt(
&self,
psbt: Arc<Psbt>,
sign_options: Option<SignOptions>,
) -> Result<bool, SignerError> {
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)
}

Expand Down

0 comments on commit 8157a3a

Please sign in to comment.