Skip to content
Open
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
14 changes: 14 additions & 0 deletions bdk-ffi/src/bitcoin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,15 @@ impl_into_core_type!(FeeRate, BdkFeeRate);
/// underflow occurs. Also note that since the internal representation of amounts is unsigned,
/// subtracting below zero is considered an underflow and will cause a panic.
#[derive(Debug, Clone, PartialEq, Eq, uniffi::Object)]
#[uniffi::export(Display)]
pub struct Amount(pub(crate) BdkAmount);

impl Display for Amount {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{}", self.0)
}
}

#[uniffi::export]
impl Amount {
/// Create an Amount with satoshi precision and the given number of satoshis.
Expand Down Expand Up @@ -1389,8 +1396,15 @@ impl From<&BdkOutput> for Output {

/// A Partially Signed Transaction.
#[derive(uniffi::Object)]
#[uniffi::export(Display)]
pub struct Psbt(pub(crate) Mutex<BdkPsbt>);

impl Display for Psbt {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{}", self.0.lock().unwrap())
}
}

#[uniffi::export]
impl Psbt {
/// Creates a new `Psbt` instance from a base64-encoded string.
Expand Down