alloy_rpc_types_eth

Struct 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.

Fields§

§hash: BlockHash

Hash of the block

§inner: H

Inner consensus header.

§total_difficulty: Option<U256>

Total difficulty

§size: Option<U256>

Integer the size of this block in bytes.

Implementations§

Source§

impl<H: BlockHeader> Header<H>

Source

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

Source

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

Source

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

Source

pub fn from_consensus( header: Sealed<H>, total_difficulty: Option<U256>, size: Option<U256>, ) -> Self

Create a new Header from a sealed alloy_consensus::Header and additional fields.

Trait Implementations§

Source§

impl<'arbitrary, H: Arbitrary<'arbitrary>> Arbitrary<'arbitrary> for Header<H>

Source§

fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>

Generate an arbitrary value of Self from the given unstructured data. Read more
Source§

fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more
Source§

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 more
Source§

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 more
Source§

impl<H> AsRef<H> for Header<H>

Source§

fn as_ref(&self) -> &H

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<H: BlockHeader> BlockHeader for Header<H>

Source§

fn parent_hash(&self) -> B256

Retrieves the parent hash of the block
Source§

fn ommers_hash(&self) -> B256

Retrieves the ommers hash of the block
Source§

fn beneficiary(&self) -> Address

Retrieves the beneficiary (miner) of the block
Source§

fn state_root(&self) -> B256

Retrieves the state root hash of the block
Source§

fn transactions_root(&self) -> B256

Retrieves the transactions root hash of the block
Source§

fn receipts_root(&self) -> B256

Retrieves the receipts root hash of the block
Source§

fn withdrawals_root(&self) -> Option<B256>

Retrieves the withdrawals root hash of the block, if available
Source§

fn logs_bloom(&self) -> Bloom

Retrieves the logs bloom filter of the block
Source§

fn difficulty(&self) -> U256

Retrieves the difficulty of the block
Source§

fn number(&self) -> u64

Retrieves the block number
Source§

fn gas_limit(&self) -> u64

Retrieves the gas limit of the block
Source§

fn gas_used(&self) -> u64

Retrieves the gas used by the block
Source§

fn timestamp(&self) -> u64

Retrieves the timestamp of the block
Source§

fn extra_data(&self) -> &Bytes

Retrieves the block’s extra data field
Source§

fn mix_hash(&self) -> Option<B256>

Retrieves the mix hash of the block, if available
Source§

fn nonce(&self) -> Option<B64>

Retrieves the nonce of the block, if avaialble
Source§

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>

Retrieves the blob gas used by the block, if available
Source§

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<B256>

Retrieves the parent beacon block root of the block, if available
Source§

fn requests_hash(&self) -> Option<B256>

Retrieves the requests hash of the block, if available
Source§

fn next_block_excess_blob_gas(&self) -> Option<u64>

Calculate excess blob gas for the next block according to the EIP-4844 spec. Read more
Source§

fn next_block_blob_fee(&self) -> Option<u128>

Returns the blob fee for the next block according to the EIP-4844 spec. Read more
Source§

impl<H: Clone> Clone for Header<H>

Source§

fn clone(&self) -> Header<H>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<H: Debug> Debug for Header<H>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<H: Default> Default for Header<H>

Source§

fn default() -> Header<H>

Returns the “default value” for a type. Read more
Source§

impl<H> Deref for Header<H>

Source§

type Target = H

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<H> DerefMut for Header<H>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

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>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<Header> for WithOtherFields<Header>

Available on crate feature serde only.
Source§

fn from(inner: Header) -> Self

Converts to this type from the input type.
Source§

impl<H: Hash> Hash for Header<H>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<H: BlockHeader> HeaderResponse for Header<H>

Source§

fn hash(&self) -> BlockHash

Block hash
Source§

impl<H: PartialEq> PartialEq for Header<H>

Source§

fn eq(&self, other: &Header<H>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<H> Serialize for Header<H>
where H: Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<H: Eq> Eq for Header<H>

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,