Skip to content

Commit fb59a2d

Browse files
committed
feat(api): create ScriptHashTxsSummary and ScriptHashStats structs
1 parent e32fb11 commit fb59a2d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/api.rs

Lines changed: 14 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,18 @@ pub struct AddressTxsSummary {
123124
pub tx_count: u32,
124125
}
125126

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

0 commit comments

Comments
 (0)