esplora_api/data/
blockstream.rs1use serde::Deserialize;
5#[derive(Deserialize, Debug)]
6pub struct BlockFormat {
7 pub id: String,
8 pub height: u32,
9 pub version: u32,
10 pub timestamp: u32,
11 pub bits: u32,
12 pub nonce: u32,
13 pub difficulty: u32,
14 pub merkle_root: String,
15 pub tx_count: u32,
16 pub size: u32,
17 pub weight: u32,
18 pub previousblockhash: String,
19}
20#[derive(Deserialize, Debug)]
21pub struct BlockStatus {
22 pub in_best_chain: bool,
23 pub next_best: String,
24 pub height: u32,
25}
26#[derive(Deserialize, Debug)]
27pub struct VoutFormat {
28 pub scriptpubkey: String,
29 pub scriptpubkey_asm: String,
30 pub scriptpubkey_type: String,
31 pub scriptpubkey_address: Option<String>,
32 pub value: u32,
33}
34#[derive(Deserialize, Debug)]
35pub struct VinFormat {
36 pub txid: String,
37 pub vout: u32,
38 pub is_coinbase: bool,
39 pub scriptsig: String,
40 pub scriptsig_asm: String,
41 pub sequence: u32,
45 pub prevout: Option<VoutFormat>,
49}
50#[derive(Deserialize, Debug)]
51pub struct TxStatusFormat {
52 pub confirmed: bool,
53 pub block_height: Option<u32>,
54 pub block_hash: Option<String>,
55 pub block_time: u32,
56}
57#[derive(Deserialize, Debug)]
58pub struct UtxoFormat {
59 pub txid: String,
60 pub vout: u16,
61 pub status: TxStatusFormat,
62 pub value: u32,
63}
64#[derive(Deserialize, Debug)]
65pub struct TransactionFormat {
66 pub txid: String,
67 pub version: u32,
68 pub locktime: u32,
69 pub size: u32,
70 pub weight: u32,
71 pub fee: u32,
72 pub vin: Vec<VinFormat>,
73 pub vout: Vec<VoutFormat>,
74 pub status: TxStatusFormat,
75}
76#[derive(Deserialize, Debug)]
77pub struct MerkleProofFormat {
78 pub block_height: u32,
79 pub merkle: Vec<String>,
80 pub pos: u32,
81}
82#[derive(Deserialize, Debug)]
83pub struct OutspentFormat {
84 pub spent: bool,
85 pub txid: Option<String>,
86 pub vin: Option<u32>,
87 pub status: Option<TxStatusFormat>,
88}
89#[derive(Deserialize, Debug)]
90pub struct AddressInfoFormat {
91 pub address: Option<String>,
92 pub chain_stats: ChainMempoolStats,
93 pub mempool_stats: ChainMempoolStats,
94 pub scripthash: Option<String>,
95}
96#[derive(Deserialize, Debug)]
97pub struct ChainMempoolStats {
98 pub funded_txo_count: i32,
99 pub funded_txo_sum: i64,
100 pub spent_txo_count: i32,
101 pub spent_txo_sum: i64,
102 pub tx_count: i32,
103}
104#[derive(Deserialize, Debug)]
105pub struct MemPoolFormat {
106 pub count: u32,
107 pub vsize: u32,
108 pub total_fee: u32,
109 pub fee_histogram: Vec<Vec<f32>>,
110}
111#[derive(Deserialize, Debug)]
112pub struct MempoolTxFormat {
113 pub txid: String,
114 pub fee: u32,
115 pub vsize: u32,
116 pub value: u64,
117}