Skip to content

Commit ca74f1d

Browse files
authored
refactor!: use Amount in TxOut
1 parent 5a643d0 commit ca74f1d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

bdk-ffi/src/bitcoin.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -605,15 +605,15 @@ impl From<&BdkTxIn> for TxIn {
605605
#[derive(Debug, Clone, uniffi::Record)]
606606
pub struct TxOut {
607607
/// The value of the output, in satoshis.
608-
pub value: u64,
608+
pub value: Arc<Amount>,
609609
/// The script which must be satisfied for the output to be spent.
610610
pub script_pubkey: Arc<Script>,
611611
}
612612

613613
impl From<&BdkTxOut> for TxOut {
614614
fn from(tx_out: &BdkTxOut) -> Self {
615615
TxOut {
616-
value: tx_out.value.to_sat(),
616+
value: Arc::new(Amount(tx_out.value)),
617617
script_pubkey: Arc::new(Script(tx_out.script_pubkey.clone())),
618618
}
619619
}
@@ -622,7 +622,7 @@ impl From<&BdkTxOut> for TxOut {
622622
impl From<BdkTxOut> for TxOut {
623623
fn from(tx_out: BdkTxOut) -> Self {
624624
Self {
625-
value: tx_out.value.to_sat(),
625+
value: Arc::new(Amount(tx_out.value)),
626626
script_pubkey: Arc::new(Script(tx_out.script_pubkey)),
627627
}
628628
}
@@ -631,7 +631,7 @@ impl From<BdkTxOut> for TxOut {
631631
impl From<TxOut> for BdkTxOut {
632632
fn from(tx_out: TxOut) -> Self {
633633
Self {
634-
value: BdkAmount::from_sat(tx_out.value),
634+
value: tx_out.value.0,
635635
script_pubkey: tx_out.script_pubkey.0.clone(),
636636
}
637637
}

bdk-ffi/src/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ impl From<BdkLocalOutput> for LocalOutput {
248248
vout: local_utxo.outpoint.vout,
249249
},
250250
txout: TxOut {
251-
value: local_utxo.txout.value.to_sat(),
251+
value: Arc::new(Amount(local_utxo.txout.value)),
252252
script_pubkey: Arc::new(Script(local_utxo.txout.script_pubkey)),
253253
},
254254
keychain: local_utxo.keychain,

0 commit comments

Comments
 (0)