pub struct Header<H = Header> {
pub hash: FixedBytes<32>,
pub inner: H,
pub total_difficulty: Option<Uint<256, 4>>,
pub size: Option<Uint<256, 4>>,
}
Available on crate feature
eth
only.Expand description
RPC representation of block header, wrapping a consensus header.
Fields§
§hash: FixedBytes<32>
Hash of the block
inner: H
Inner consensus header.
total_difficulty: Option<Uint<256, 4>>
Total difficulty
size: Option<Uint<256, 4>>
Integer the size of this block in bytes.
Implementations§
Source§impl<H> Header<H>where
H: BlockHeader,
impl<H> Header<H>where
H: BlockHeader,
Sourcepub fn blob_fee(&self) -> Option<u128>
pub fn blob_fee(&self) -> Option<u128>
Returns the blob fee for this block according to the EIP-4844 spec.
Returns None
if excess_blob_gas
is None
Sourcepub fn next_block_blob_fee(&self) -> Option<u128>
pub fn next_block_blob_fee(&self) -> Option<u128>
Returns the blob fee for the next block according to the EIP-4844 spec.
Returns None
if excess_blob_gas
is None.
See also Self::next_block_excess_blob_gas
Sourcepub fn next_block_excess_blob_gas(&self) -> Option<u64>
pub fn next_block_excess_blob_gas(&self) -> Option<u64>
Calculate excess blob gas for the next block according to the EIP-4844 spec.
Returns a None
if no excess blob gas is set, no EIP-4844 support
Sourcepub fn from_consensus(
header: Sealed<H>,
total_difficulty: Option<Uint<256, 4>>,
size: Option<Uint<256, 4>>,
) -> Header<H>
pub fn from_consensus( header: Sealed<H>, total_difficulty: Option<Uint<256, 4>>, size: Option<Uint<256, 4>>, ) -> Header<H>
Create a new Header
from a sealed alloy_consensus::Header
and additional fields.
Trait Implementations§
Source§impl<'arbitrary, H> Arbitrary<'arbitrary> for Header<H>where
H: Arbitrary<'arbitrary>,
impl<'arbitrary, H> Arbitrary<'arbitrary> for Header<H>where
H: Arbitrary<'arbitrary>,
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Header<H>, Error>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Header<H>, Error>
Generate an arbitrary value of
Self
from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Header<H>, Error>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Header<H>, Error>
Generate an arbitrary value of
Self
from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Get a size hint for how many bytes out of an
Unstructured
this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Get a size hint for how many bytes out of an
Unstructured
this type
needs to construct itself. Read moreSource§impl<H> BlockHeader for Header<H>where
H: BlockHeader,
impl<H> BlockHeader for Header<H>where
H: BlockHeader,
Source§fn parent_hash(&self) -> FixedBytes<32>
fn parent_hash(&self) -> FixedBytes<32>
Retrieves the parent hash of the block
Source§fn ommers_hash(&self) -> FixedBytes<32>
fn ommers_hash(&self) -> FixedBytes<32>
Retrieves the ommers hash of the block
Source§fn beneficiary(&self) -> Address
fn beneficiary(&self) -> Address
Retrieves the beneficiary (miner) of the block
Source§fn state_root(&self) -> FixedBytes<32>
fn state_root(&self) -> FixedBytes<32>
Retrieves the state root hash of the block
Source§fn transactions_root(&self) -> FixedBytes<32>
fn transactions_root(&self) -> FixedBytes<32>
Retrieves the transactions root hash of the block
Source§fn receipts_root(&self) -> FixedBytes<32>
fn receipts_root(&self) -> FixedBytes<32>
Retrieves the receipts root hash of the block
Source§fn withdrawals_root(&self) -> Option<FixedBytes<32>>
fn withdrawals_root(&self) -> Option<FixedBytes<32>>
Retrieves the withdrawals root hash of the block, if available
Source§fn logs_bloom(&self) -> Bloom
fn logs_bloom(&self) -> Bloom
Retrieves the logs bloom filter of the block
Source§fn difficulty(&self) -> Uint<256, 4>
fn difficulty(&self) -> Uint<256, 4>
Retrieves the difficulty of the block
Source§fn extra_data(&self) -> &Bytes
fn extra_data(&self) -> &Bytes
Retrieves the block’s extra data field
Source§fn mix_hash(&self) -> Option<FixedBytes<32>>
fn mix_hash(&self) -> Option<FixedBytes<32>>
Retrieves the mix hash of the block, if available
Source§fn nonce(&self) -> Option<FixedBytes<8>>
fn nonce(&self) -> Option<FixedBytes<8>>
Retrieves the nonce of the block, if avaialble
Source§fn base_fee_per_gas(&self) -> Option<u64>
fn base_fee_per_gas(&self) -> Option<u64>
Retrieves the base fee per gas of the block, if available
Source§fn blob_gas_used(&self) -> Option<u64>
fn blob_gas_used(&self) -> Option<u64>
Retrieves the blob gas used by the block, if available
Source§fn excess_blob_gas(&self) -> Option<u64>
fn excess_blob_gas(&self) -> Option<u64>
Retrieves the excess blob gas of the block, if available
Source§fn parent_beacon_block_root(&self) -> Option<FixedBytes<32>>
fn parent_beacon_block_root(&self) -> Option<FixedBytes<32>>
Retrieves the parent beacon block root of the block, if available
Source§fn requests_hash(&self) -> Option<FixedBytes<32>>
fn requests_hash(&self) -> Option<FixedBytes<32>>
Retrieves the requests hash of the block, if available
Source§impl<'de, H> Deserialize<'de> for Header<H>where
H: Deserialize<'de>,
impl<'de, H> Deserialize<'de> for Header<H>where
H: Deserialize<'de>,
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Header<H>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Header<H>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<H> HeaderResponse for Header<H>where
H: BlockHeader,
impl<H> HeaderResponse for Header<H>where
H: BlockHeader,
Source§fn hash(&self) -> FixedBytes<32>
fn hash(&self) -> FixedBytes<32>
Block hash
Source§impl<H> Serialize for Header<H>where
H: Serialize,
impl<H> Serialize for Header<H>where
H: Serialize,
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<H> Eq for Header<H>where
H: Eq,
impl<H> StructuralPartialEq for Header<H>
Auto Trait Implementations§
impl<H> Freeze for Header<H>where
H: Freeze,
impl<H> RefUnwindSafe for Header<H>where
H: RefUnwindSafe,
impl<H> Send for Header<H>where
H: Send,
impl<H> Sync for Header<H>where
H: Sync,
impl<H> Unpin for Header<H>where
H: Unpin,
impl<H> UnwindSafe for Header<H>where
H: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more