Skip to content

Commit 673264f

Browse files
committed
feat(api): create ScriptHashTxsSummary and ScriptHashStats structs
1 parent 1ccfdf2 commit 673264f

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/api.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ pub use bitcoin::consensus::{deserialize, serialize};
66
pub use bitcoin::hex::FromHex;
77
use bitcoin::Weight;
88
pub use bitcoin::{
9-
transaction, Amount, BlockHash, OutPoint, ScriptBuf, Transaction, TxIn, TxOut, Txid, Witness,
9+
transaction, Amount, BlockHash, OutPoint, ScriptBuf, ScriptHash, Transaction, TxIn, TxOut,
10+
Txid, Witness,
1011
};
1112

1213
use serde::Deserialize;
@@ -123,6 +124,19 @@ pub struct AddressTxsSummary {
123124
pub tx_count: u32,
124125
}
125126

127+
/// [`ScriptHash`] statistics, includes the script hash, and the [`TxOut`] information for the
128+
/// script hash.
129+
#[derive(Debug, Copy, Clone, PartialEq, Eq, Deserialize)]
130+
pub struct ScriptHashStats {
131+
/// The summary of confirmed transactions for this [`ScriptHash`].
132+
pub chain_stats: ScriptHashTxsSummary,
133+
/// The summary of mempool transactions for this [`ScriptHash`].
134+
pub mempool_stats: ScriptHashTxsSummary,
135+
}
136+
137+
/// Contains a summary of the transactions for a [`ScriptHash`].
138+
pub type ScriptHashTxsSummary = AddressTxsSummary;
139+
126140
/// Information about an UTXO's status: confirmation status,
127141
/// confirmation height, confirmation block hash and confirmation block time.
128142
#[derive(Debug, Copy, Clone, PartialEq, Eq, Deserialize)]

0 commit comments

Comments
 (0)