Skip to content

Commit 5dd6863

Browse files
committed
feat: Add from_unsigned_tx to Psbt
1 parent 5168f34 commit 5dd6863

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

bdk-ffi/src/bitcoin.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,17 @@ impl Psbt {
484484
Ok(Psbt(Mutex::new(psbt)))
485485
}
486486

487+
/// Creates a PSBT from an unsigned transaction.
488+
///
489+
/// # Errors
490+
///
491+
/// If transactions is not unsigned.
492+
#[uniffi::constructor]
493+
pub(crate) fn from_unsigned_tx(tx: Arc<Transaction>) -> Result<Arc<Psbt>, PsbtError> {
494+
let psbt: BdkPsbt = BdkPsbt::from_unsigned_tx(tx.0.clone())?;
495+
Ok(Arc::new(Psbt(Mutex::new(psbt))))
496+
}
497+
487498
/// Serialize the PSBT into a base64-encoded string.
488499
pub(crate) fn serialize(&self) -> String {
489500
let psbt = self.0.lock().unwrap().clone();

0 commit comments

Comments
 (0)