From 50b396ae7b83c07a34c12a869bfa4abdaaa7a877 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 | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/src/bitcoin.udl b/src/bitcoin.udl index cee7d09..3acafd7 100644 --- a/src/bitcoin.udl +++ b/src/bitcoin.udl @@ -44,6 +44,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 0a54e58..a53c571 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,11 @@ +use std::sync::Arc; + use bitcoin::Amount as BitcoinAmount; use bitcoin::FeeRate as BitcoinFeeRate; use bitcoin::ScriptBuf as BitcoinScriptBuf; +use bitcoin::Sequence; +use bitcoin::TxIn as BitcoinTxIn; + pub use bitcoin::OutPoint; pub use bitcoin::Txid; @@ -85,6 +90,40 @@ 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