Skip to content
Merged
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
11 changes: 11 additions & 0 deletions bdk-ffi/src/bitcoin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,17 @@ impl Psbt {
Ok(Psbt(Mutex::new(psbt)))
}

/// Creates a PSBT from an unsigned transaction.
///
/// # Errors
///
/// If transactions is not unsigned.
#[uniffi::constructor]
pub(crate) fn from_unsigned_tx(tx: Arc<Transaction>) -> Result<Arc<Psbt>, PsbtError> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 nice, follows existing pattern for return type of similar methods

let psbt: BdkPsbt = BdkPsbt::from_unsigned_tx(tx.0.clone())?;
Ok(Arc::new(Psbt(Mutex::new(psbt))))
}

/// Serialize the PSBT into a base64-encoded string.
pub(crate) fn serialize(&self) -> String {
let psbt = self.0.lock().unwrap().clone();
Expand Down
Loading