From 537532a647570ddf4623715d2d1104c9925d5a18 Mon Sep 17 00:00:00 2001 From: Matthew Ramsden <6657488+reez@users.noreply.github.com> Date: Thu, 12 Sep 2024 11:51:27 -0500 Subject: [PATCH] feat: add txout type --- src/bitcoin.udl | 5 +++++ src/lib.rs | 38 +++++++++++++++++++++++++++++++++++++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/src/bitcoin.udl b/src/bitcoin.udl index 2cdbba4..de7cd10 100644 --- a/src/bitcoin.udl +++ b/src/bitcoin.udl @@ -67,6 +67,11 @@ interface Address { boolean is_valid_for_network(Network network); }; +dictionary TxOut { + Amount value; + Script script_pubkey; +}; + // ------------------------------------------------------------------------ // Errors // ------------------------------------------------------------------------ diff --git a/src/lib.rs b/src/lib.rs index e284c83..9790d59 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,7 +4,9 @@ use bitcoin::Amount as BitcoinAmount; use bitcoin::FeeRate as BitcoinFeeRate; pub use bitcoin::OutPoint; use bitcoin::ScriptBuf as BitcoinScriptBuf; +use bitcoin::TxOut as BitcoinTxOut; pub use bitcoin::Txid; +use std::sync::Arc; use error::AddressParseError; use error::FeeRateError; @@ -13,7 +15,6 @@ use error::ParseAmountError; use std::fmt::Display; use std::str::FromStr; -use std::sync::Arc; #[macro_use] mod macros; @@ -112,6 +113,41 @@ impl Script { impl_from_core_type!(Script, BitcoinScriptBuf); impl_from_ffi_type!(Script, BitcoinScriptBuf); +#[derive(Debug, Clone)] +pub struct TxOut { + pub value: Arc, + pub script_pubkey: Arc