Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add finalize_psbtmethod to wallet #604

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading