alloy_zksync/network/
header.rs

1use serde::{Deserialize, Serialize};
2
3/// See [Header](https://docs.rs/alloy/latest/alloy/rpc/types/struct.Header.html).
4#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
5pub struct Header {
6    #[serde(flatten)]
7    inner: alloy::consensus::Header,
8}
9
10impl Header {
11    pub fn hash_slow(&self) -> alloy::primitives::B256 {
12        self.inner.hash_slow()
13    }
14}
15
16impl alloy::consensus::BlockHeader for Header {
17    fn parent_hash(&self) -> alloy::primitives::B256 {
18        self.inner.parent_hash()
19    }
20
21    fn ommers_hash(&self) -> alloy::primitives::B256 {
22        self.inner.ommers_hash()
23    }
24
25    fn beneficiary(&self) -> alloy::primitives::Address {
26        self.inner.beneficiary()
27    }
28
29    fn state_root(&self) -> alloy::primitives::B256 {
30        self.inner.state_root()
31    }
32
33    fn transactions_root(&self) -> alloy::primitives::B256 {
34        self.inner.transactions_root()
35    }
36
37    fn receipts_root(&self) -> alloy::primitives::B256 {
38        self.inner.receipts_root()
39    }
40
41    fn withdrawals_root(&self) -> Option<alloy::primitives::B256> {
42        self.inner.withdrawals_root()
43    }
44
45    fn logs_bloom(&self) -> alloy::primitives::Bloom {
46        self.inner.logs_bloom()
47    }
48
49    fn difficulty(&self) -> alloy::primitives::U256 {
50        self.inner.difficulty()
51    }
52
53    fn number(&self) -> alloy::primitives::BlockNumber {
54        self.inner.number()
55    }
56
57    fn gas_limit(&self) -> u64 {
58        self.inner.gas_limit()
59    }
60
61    fn gas_used(&self) -> u64 {
62        self.inner.gas_used()
63    }
64
65    fn timestamp(&self) -> u64 {
66        self.inner.timestamp()
67    }
68
69    fn mix_hash(&self) -> Option<alloy::primitives::B256> {
70        self.inner.mix_hash()
71    }
72
73    fn nonce(&self) -> Option<alloy::primitives::B64> {
74        self.inner.nonce()
75    }
76
77    fn base_fee_per_gas(&self) -> Option<u64> {
78        self.inner.base_fee_per_gas()
79    }
80
81    fn blob_gas_used(&self) -> Option<u64> {
82        self.inner.blob_gas_used()
83    }
84
85    fn excess_blob_gas(&self) -> Option<u64> {
86        self.inner.excess_blob_gas()
87    }
88
89    fn parent_beacon_block_root(&self) -> Option<alloy::primitives::B256> {
90        self.inner.parent_beacon_block_root()
91    }
92
93    fn requests_hash(&self) -> Option<alloy::primitives::B256> {
94        self.inner.requests_hash()
95    }
96
97    fn extra_data(&self) -> &alloy::primitives::Bytes {
98        self.inner.extra_data()
99    }
100}