diff --git a/bdk-ffi/src/bdk.udl b/bdk-ffi/src/bdk.udl index 3b9a056..53c0944 100644 --- a/bdk-ffi/src/bdk.udl +++ b/bdk-ffi/src/bdk.udl @@ -582,6 +582,8 @@ interface Transaction { sequence serialize(); u64 weight(); + + sequence input(); }; interface Psbt { @@ -624,3 +626,10 @@ interface FeeRate { u64 to_sat_per_kwu(); }; + +dictionary TxIn { + OutPoint previous_output; + Script script_sig; + u32 sequence; + sequence> witness; +}; diff --git a/bdk-ffi/src/bitcoin.rs b/bdk-ffi/src/bitcoin.rs index 68bb0ed..240fcda 100644 --- a/bdk-ffi/src/bitcoin.rs +++ b/bdk-ffi/src/bitcoin.rs @@ -13,13 +13,14 @@ use bdk::bitcoin::OutPoint as BdkOutPoint; use bdk::bitcoin::Psbt as BdkPsbt; use bdk::bitcoin::Transaction as BdkTransaction; use bdk::bitcoin::Txid; +use bdk::bitcoin::TxIn as BdkTxIn; +use bdk::bitcoin::amount::ParseAmountError; +use bdk::bitcoin::Amount as BdkAmount; use std::io::Cursor; use std::str::FromStr; use std::sync::{Arc, Mutex}; -use bdk::bitcoin::amount::ParseAmountError; -use bdk::bitcoin::Amount as BdkAmount; #[derive(Clone, Debug, PartialEq, Eq)] pub struct Amount(pub(crate) BdkAmount); @@ -169,6 +170,10 @@ impl Transaction { pub fn serialize(&self) -> Vec { serialize(&self.0) } + + pub fn input(&self) -> Vec { + self.0.input.iter().map(|tx_in| tx_in.into()).collect() + } } impl From for Transaction { @@ -239,6 +244,28 @@ impl From<&BdkOutPoint> for OutPoint { } } +#[derive(Debug, Clone)] +pub struct TxIn { + pub previous_output: OutPoint, + pub script_sig: Arc