Struct alloy_rpc_types_eth::Header
source · pub struct Header<H = Header> {
pub hash: BlockHash,
pub inner: H,
pub total_difficulty: Option<U256>,
pub size: Option<U256>,
}
Expand description
RPC representation of block header, wrapping a consensus header.
This wraps the consensus header and adds additional fields for RPC.
Fields§
§hash: BlockHash
Hash of the block
inner: H
Inner consensus header.
total_difficulty: Option<U256>
Total difficulty
Note: This field is now effectively deprecated: https://github.com/ethereum/execution-apis/pull/570
size: Option<U256>
Integer the size of this block in bytes.
Implementations§
source§impl<H> Header<H>
impl<H> Header<H>
sourcepub fn new(inner: H) -> Selfwhere
H: Sealable,
pub fn new(inner: H) -> Selfwhere
H: Sealable,
Create a new Header
from a consensus header.
Note: This will compute the hash of the header.
sourcepub fn from_sealed(header: Sealed<H>) -> Self
pub fn from_sealed(header: Sealed<H>) -> Self
Create a new Header
from a sealed consensus header.
Note: This does not set the total difficulty or size of the block.
sourcepub fn into_consensus(self) -> H
pub fn into_consensus(self) -> H
Consumes the type and returns the wrapped consensus header.
sourcepub fn from_consensus(
header: Sealed<H>,
total_difficulty: Option<U256>,
size: Option<U256>,
) -> Self
pub fn from_consensus( header: Sealed<H>, total_difficulty: Option<U256>, size: Option<U256>, ) -> Self
Create a new Header
from a sealed consensus header and additional fields.
sourcepub const fn with_total_difficulty(self, total_difficulty: Option<U256>) -> Self
pub const fn with_total_difficulty(self, total_difficulty: Option<U256>) -> Self
Set the total difficulty of the block.
source§impl<H: BlockHeader> Header<H>
impl<H: BlockHeader> Header<H>
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, blob_params: BlobParams) -> Option<u128>
pub fn next_block_blob_fee(&self, blob_params: BlobParams) -> 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, blob_params: BlobParams) -> Option<u64>
pub fn next_block_excess_blob_gas(&self, blob_params: BlobParams) -> 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
Trait Implementations§
source§impl<H: BlockHeader> BlockHeader for Header<H>
impl<H: BlockHeader> BlockHeader for Header<H>
source§fn parent_hash(&self) -> B256
fn parent_hash(&self) -> B256
source§fn ommers_hash(&self) -> B256
fn ommers_hash(&self) -> B256
source§fn beneficiary(&self) -> Address
fn beneficiary(&self) -> Address
source§fn state_root(&self) -> B256
fn state_root(&self) -> B256
source§fn transactions_root(&self) -> B256
fn transactions_root(&self) -> B256
source§fn receipts_root(&self) -> B256
fn receipts_root(&self) -> B256
source§fn withdrawals_root(&self) -> Option<B256>
fn withdrawals_root(&self) -> Option<B256>
source§fn logs_bloom(&self) -> Bloom
fn logs_bloom(&self) -> Bloom
source§fn difficulty(&self) -> U256
fn difficulty(&self) -> U256
source§fn base_fee_per_gas(&self) -> Option<u64>
fn base_fee_per_gas(&self) -> Option<u64>
source§fn blob_gas_used(&self) -> Option<u64>
fn blob_gas_used(&self) -> Option<u64>
source§fn excess_blob_gas(&self) -> Option<u64>
fn excess_blob_gas(&self) -> Option<u64>
source§fn parent_beacon_block_root(&self) -> Option<B256>
fn parent_beacon_block_root(&self) -> Option<B256>
source§fn requests_hash(&self) -> Option<B256>
fn requests_hash(&self) -> Option<B256>
source§fn extra_data(&self) -> &Bytes
fn extra_data(&self) -> &Bytes
source§fn blob_fee(&self, blob_params: BlobParams) -> Option<u128>
fn blob_fee(&self, blob_params: BlobParams) -> Option<u128>
source§fn next_block_excess_blob_gas(&self, blob_params: BlobParams) -> Option<u64>
fn next_block_excess_blob_gas(&self, blob_params: BlobParams) -> Option<u64>
source§fn next_block_blob_fee(&self, blob_params: BlobParams) -> Option<u128>
fn next_block_blob_fee(&self, blob_params: BlobParams) -> Option<u128>
source§fn next_block_base_fee(&self, base_fee_params: BaseFeeParams) -> Option<u64>
fn next_block_base_fee(&self, base_fee_params: BaseFeeParams) -> Option<u64>
source§fn parent_num_hash(&self) -> NumHash
fn parent_num_hash(&self) -> NumHash
source§fn is_empty(&self) -> bool
fn is_empty(&self) -> bool
source§fn is_zero_difficulty(&self) -> bool
fn is_zero_difficulty(&self) -> bool
source§fn exceeds_allowed_future_timestamp(&self, present_timestamp: u64) -> bool
fn exceeds_allowed_future_timestamp(&self, present_timestamp: u64) -> bool
source§fn is_nonce_zero(&self) -> bool
fn is_nonce_zero(&self) -> bool
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<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl<H: BlockHeader> HeaderResponse for Header<H>
impl<H: BlockHeader> HeaderResponse for Header<H>
source§impl<H: PartialEq> PartialEq for Header<H>
impl<H: PartialEq> PartialEq for Header<H>
impl<H: Eq> Eq for Header<H>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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