From 2e3fd746e0572bc310dadca0226199437d9ab176 Mon Sep 17 00:00:00 2001 From: Rob N Date: Thu, 29 Aug 2024 15:13:05 -1000 Subject: [PATCH] lib: add `TxIn` --- src/bitcoin.udl | 7 +++++++ src/lib.rs | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/src/bitcoin.udl b/src/bitcoin.udl index 04905ef..c4ddc21 100644 --- a/src/bitcoin.udl +++ b/src/bitcoin.udl @@ -47,6 +47,13 @@ dictionary OutPoint { u32 vout; }; +dictionary TxIn { + OutPoint previous_output; + Script script_sig; + u32 sequence; + sequence> witness; +}; + [NonExhaustive] enum Network { "Bitcoin", diff --git a/src/lib.rs b/src/lib.rs index dcfd1fb..19d5652 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,7 +3,9 @@ use bitcoin::Address as BitcoinAddress; use bitcoin::Amount as BitcoinAmount; use bitcoin::FeeRate as BitcoinFeeRate; use bitcoin::ScriptBuf as BitcoinScriptBuf; +use bitcoin::TxIn as BitcoinTxIn; use bitcoin::TxOut as BitcoinTxOut; +use bitcoin::Sequence; pub use bitcoin::BlockHash; pub use bitcoin::OutPoint; @@ -174,6 +176,36 @@ impl Amount { impl_from_core_type!(Amount, BitcoinAmount); impl_from_ffi_type!(Amount, BitcoinAmount); +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct TxIn { + pub previous_output: OutPoint, + pub script_sig: Arc