Skip to content

feat: Add from_unsigned_tx to Psbt #802

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

Merged
merged 1 commit into from
Jul 9, 2025
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