Skip to content

Commit

Permalink
feat: add finalize_psbtmethod to wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
rustaceanrob authored and thunderbiscuit committed Oct 8, 2024
1 parent 53d654c commit 9ea6013
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bdk-ffi/src/bdk.udl
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,9 @@ interface Wallet {
[Throws=SignerError]
boolean sign(Psbt psbt);

[Throws=SignerError]
boolean finalize_psbt(Psbt psbt);

SentAndReceivedValues sent_and_received([ByRef] Transaction tx);

sequence<CanonicalTx> transactions();
Expand Down
7 changes: 7 additions & 0 deletions bdk-ffi/src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ impl Wallet {
.map_err(SignerError::from)
}

pub fn finalize_psbt(&self, psbt: Arc<Psbt>) -> Result<bool, SignerError> {
let mut psbt = psbt.0.lock().unwrap();
self.get_wallet()
.finalize_psbt(&mut psbt, SignOptions::default())
.map_err(SignerError::from)
}

pub fn sent_and_received(&self, tx: &Transaction) -> SentAndReceivedValues {
let (sent, received) = self.get_wallet().sent_and_received(&tx.into());
SentAndReceivedValues {
Expand Down

0 comments on commit 9ea6013

Please sign in to comment.