Skip to main content

Block

Struct Block 

pub struct Block<T = Transaction, H = Header> {
    pub header: H,
    pub uncles: Vec<FixedBytes<32>>,
    pub transactions: BlockTransactions<T>,
    pub withdrawals: Option<Withdrawals>,
}
Available on crate feature rpc only.
Expand description

Block representation for RPC.

Fields§

§header: H

Header of the block.

§uncles: Vec<FixedBytes<32>>

Uncles’ hashes.

§transactions: BlockTransactions<T>

Block Transactions. In the case of an uncle block, this field is not included in RPC responses, and when deserialized, it will be set to BlockTransactions::Uncle.

§withdrawals: Option<Withdrawals>

Withdrawals in the block.

Implementations§

§

impl<T, H> Block<T, H>

pub const fn empty(header: H) -> Block<T, H>

Available on crate feature node-api only.

Creates a new empty block (without transactions).

pub const fn new(header: H, transactions: BlockTransactions<T>) -> Block<T, H>

Available on crate feature node-api only.

Creates a new Block with the given header and transactions.

Note: This does not set the withdrawals for the block.

use alloy_eips::eip4895::Withdrawals;
use alloy_network_primitives::BlockTransactions;
use alloy_rpc_types_eth::{Block, Header, Transaction};
let block = Block::new(
    Header::new(alloy_consensus::Header::default()),
    BlockTransactions::<Transaction>::Full(vec![]),
)
.with_withdrawals(Some(Withdrawals::default()));

pub fn number(&self) -> u64
where H: BlockHeader,

Available on crate feature node-api only.

Returns the block’s number.

pub fn apply<F>(self, f: F) -> Block<T, H>
where F: FnOnce(Block<T, H>) -> Block<T, H>,

Available on crate feature node-api only.

Apply a function to the block, returning the modified block.

pub fn with_transactions( self, transactions: BlockTransactions<T>, ) -> Block<T, H>

Available on crate feature node-api only.

Sets the transactions for the block.

pub fn with_withdrawals(self, withdrawals: Option<Withdrawals>) -> Block<T, H>

Available on crate feature node-api only.

Sets the withdrawals for the block.

pub fn with_uncles(self, uncles: Vec<FixedBytes<32>>) -> Block<T, H>

Available on crate feature node-api only.

Sets the uncles for the block.

pub fn try_into_transactions( self, ) -> Result<Vec<T>, ValueError<BlockTransactions<T>>>

Available on crate feature node-api only.

Tries to convert inner transactions into a vector of full transactions

Returns an error if the block contains only transaction hashes or if it is an uncle block.

pub fn into_transactions_vec(self) -> Vec<T>

Available on crate feature node-api only.

Consumes the type and returns the transactions as a vector.

Note: if this is an uncle or hashes, this will return an empty vector.

pub fn into_hashes_vec(self) -> Vec<FixedBytes<32>>
where T: TransactionResponse,

Available on crate feature node-api only.

Consumes the type and returns the transaction hashes as a vector.

Note: if this is an uncle, this will return an empty vector.

pub fn try_into_block_body( self, ) -> Result<BlockBody<T, H>, ValueError<Block<T, H>>>

Available on crate feature node-api only.

Converts this block into a [BlockBody].

Returns an error if the transactions are not full or if the block has uncles.

pub fn into_block_body_unchecked(self) -> BlockBody<T, H>

Available on crate feature node-api only.

Converts this block into a [BlockBody]

Caution: The body will have empty transactions unless the block’s transactions are BlockTransactions::Full. This will disregard ommers/uncles and always return an empty ommers vec.

pub fn into_consensus_block(self) -> Block<T, H>

Available on crate feature node-api only.

Consumes the block and returns the [alloy_consensus::Block] with the current transaction and header type.

Note: Unlike Self::into_consensus, this method returns the Header type H as-is without converting it to alloy_consensus::Header, See Header::into_consensus.

This has two caveats:

  • The returned block will always have empty uncles.
  • If the block’s transaction is not BlockTransactions::Full, the returned block will have an empty transaction vec.

pub fn map_header<U>(self, f: impl FnOnce(H) -> U) -> Block<T, U>

Available on crate feature node-api only.

Converts the block’s header type by applying a function to it.

pub fn into_header(self) -> H

Available on crate feature node-api only.

Consumes the block and returns its header.

To obtain the underlying alloy_consensus::Header use Block::into_consensus_header.

pub fn try_convert_header<U>( self, ) -> Result<Block<T, U>, <U as TryFrom<H>>::Error>
where U: TryFrom<H>,

Available on crate feature node-api only.

Converts the block’s header type to the given alternative that is TryFrom<H>

pub fn try_map_header<U, E>( self, f: impl FnOnce(H) -> Result<U, E>, ) -> Result<Block<T, U>, E>

Available on crate feature node-api only.

Converts the block’s header type by applying a fallible function to it.

pub fn convert_transactions<U>(self) -> Block<U, H>
where U: From<T>,

Available on crate feature node-api only.

Converts the block’s transaction type to the given alternative that is From<T>

pub fn try_convert_transactions<U>( self, ) -> Result<Block<U, H>, <U as TryFrom<T>>::Error>
where U: TryFrom<T>,

Available on crate feature node-api only.

Converts the block’s transaction to the given alternative that is TryFrom<T>

Returns the block with the new transaction type if all conversions were successful.

pub fn map_transactions<U>(self, f: impl FnMut(T) -> U) -> Block<U, H>

Available on crate feature node-api only.

Converts the block’s transaction type by applying a function to each transaction.

Returns the block with the new transaction type.

pub fn try_map_transactions<U, E>( self, f: impl FnMut(T) -> Result<U, E>, ) -> Result<Block<U, H>, E>

Available on crate feature node-api only.

Converts the block’s transaction type by applying a fallible function to each transaction.

Returns the block with the new transaction type if all transactions were mapped successfully.

pub fn calculate_transactions_root(&self) -> Option<FixedBytes<32>>
where T: Encodable2718,

Available on crate feature node-api only.

Calculate the transaction root for the full transactions in this block type.

Returns None if the transactions is not the BlockTransactions::Full variant.

§

impl<T, H> Block<T, H>
where T: TransactionResponse,

pub fn into_full_block(self, txs: Vec<T>) -> Block<T, H>

Available on crate feature node-api only.

Converts a block with transaction hashes into a full block.

This replaces the transaction representation without validating the supplied transaction hashes, count, or order against the original block or its transactions root.

§

impl<T, H> Block<T, Header<H>>
where H: Sealable + Encodable,

pub fn uncle_from_header(header: H) -> Block<T, Header<H>>

Available on crate feature node-api only.

Constructs an “uncle block” from the provided header.

This function creates a new Block structure for uncle blocks (ommer blocks), using the provided header.

§

impl<T> Block<T>

pub const fn hash(&self) -> FixedBytes<32>

Available on crate feature node-api only.

Returns the block’s hash as received from rpc.

pub const fn sealed_header(&self) -> Sealed<&Header>

Available on crate feature node-api only.

Returns a sealed reference of the header using its stored RPC hash without verification.

pub fn into_sealed_header(self) -> Sealed<Header>

Available on crate feature node-api only.

Consumes the type and returns the sealed alloy_consensus::Header.

pub fn into_consensus_header(self) -> Header

Available on crate feature node-api only.

Consumes the type, strips away the rpc context from the rpc Header type and just returns the alloy_consensus::Header.

pub fn from_consensus( block: Block<T>, total_difficulty: Option<Uint<256, 4>>, ) -> Block<T>
where T: Encodable,

Available on crate feature node-api only.

Constructs block from a consensus block and total_difficulty.

pub fn into_consensus(self) -> Block<T>

Available on crate feature node-api only.

Consumes the block and returns the ethereum [alloy_consensus::Block] with the ethereum header type.

This has two caveats:

  • The returned block will always have empty uncles.
  • If the block’s transaction is not BlockTransactions::Full, the returned block will have an empty transaction vec.

pub fn into_consensus_sealed(self) -> Sealed<Block<T>>

Available on crate feature node-api only.

Same as Self::into_consensus but returns the block as [Sealed] with its stored RPC hash, without verification or recomputation.

Trait Implementations§

§

impl<T, H> BlockResponse for Block<T, H>
where T: TransactionResponse,

§

type Header = H

Concrete RPC header representation.
§

type Transaction = T

Full-transaction representation used by BlockTransactions::Full.
§

fn header(&self) -> &<Block<T, H> as BlockResponse>::Header

Block header
§

fn transactions(&self) -> &BlockTransactions<T>

Block transactions
§

fn transactions_mut( &mut self, ) -> &mut BlockTransactions<<Block<T, H> as BlockResponse>::Transaction>

Returns a mutable reference to the block transactions. Read more
§

fn other_fields(&self) -> Option<&OtherFields>

Returns flattened chain- or client-specific RPC fields when they were retained. Read more
§

impl<T, H> Clone for Block<T, H>
where T: Clone, H: Clone,

§

fn clone(&self) -> Block<T, H>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
§

impl<T, H> Debug for Block<T, H>
where T: Debug, H: Debug,

§

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

Formats the value using the given formatter. Read more
§

impl<T, H> Default for Block<T, H>
where H: Default,

§

fn default() -> Block<T, H>

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

impl<'de, T, H> Deserialize<'de> for Block<T, H>
where T: Deserialize<'de>, H: Deserialize<'de>,

§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Block<T, H>, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

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

impl<Eth, EthFilter> EngineEthApiServer<<<Eth as EthApiTypes>::NetworkTypes as RpcTypes>::TransactionRequest, Block<<<Eth as EthApiTypes>::NetworkTypes as RpcTypes>::TransactionResponse, <<Eth as EthApiTypes>::NetworkTypes as RpcTypes>::Header>, <<Eth as EthApiTypes>::NetworkTypes as RpcTypes>::Receipt, <<Eth as EthApiTypes>::NetworkTypes as RpcTypes>::Log> for EngineEthApi<Eth, EthFilter>

Source§

fn syncing(&self) -> Result<SyncStatus, ErrorObject<'static>>

Handler for: eth_syncing

Source§

async fn chain_id(&self) -> Result<Option<Uint<64, 1>>, ErrorObject<'static>>

Handler for: eth_chainId

Source§

fn block_number(&self) -> Result<Uint<256, 4>, ErrorObject<'static>>

Handler for: eth_blockNumber

Source§

async fn call( &self, request: <<Eth as EthApiTypes>::NetworkTypes as RpcTypes>::TransactionRequest, block_id: Option<BlockId>, state_overrides: Option<HashMap<Address, AccountOverride, FbBuildHasher<20>>>, block_overrides: Option<Box<BlockOverrides>>, ) -> Result<Bytes, ErrorObject<'static>>

Handler for: eth_call

Source§

async fn get_code( &self, address: Address, block_id: Option<BlockId>, ) -> Result<Bytes, ErrorObject<'static>>

Handler for: eth_getCode

Source§

async fn block_by_hash( &self, hash: FixedBytes<32>, full: bool, ) -> Result<Option<Block<<<Eth as EthApiTypes>::NetworkTypes as RpcTypes>::TransactionResponse, <<Eth as EthApiTypes>::NetworkTypes as RpcTypes>::Header>>, ErrorObject<'static>>

Handler for: eth_getBlockByHash

Source§

async fn block_by_number( &self, number: BlockNumberOrTag, full: bool, ) -> Result<Option<Block<<<Eth as EthApiTypes>::NetworkTypes as RpcTypes>::TransactionResponse, <<Eth as EthApiTypes>::NetworkTypes as RpcTypes>::Header>>, ErrorObject<'static>>

Handler for: eth_getBlockByNumber

Source§

async fn raw_transaction_by_block_hash_and_index( &self, hash: FixedBytes<32>, index: Index, ) -> Result<Option<Bytes>, ErrorObject<'static>>

Handler for: eth_getRawTransactionByBlockHashAndIndex

Source§

async fn raw_transaction_by_block_number_and_index( &self, number: BlockNumberOrTag, index: Index, ) -> Result<Option<Bytes>, ErrorObject<'static>>

Handler for: eth_getRawTransactionByBlockNumberAndIndex

Source§

async fn send_raw_transaction( &self, bytes: Bytes, ) -> Result<FixedBytes<32>, ErrorObject<'static>>

Handler for: eth_sendRawTransaction

Source§

async fn logs( &self, filter: Filter, ) -> Result<Vec<<<Eth as EthApiTypes>::NetworkTypes as RpcTypes>::Log>, ErrorObject<'static>>

Handler for eth_getLogs

Source§

async fn get_proof( &self, address: Address, keys: Vec<JsonStorageKey>, block_number: Option<BlockId>, ) -> Result<EIP1186AccountProofResponse, ErrorObject<'static>>

Handler for eth_getProof

Source§

async fn get_multi_proof( &self, targets: Vec<(Address, Vec<FixedBytes<32>>)>, block_number: Option<BlockId>, ) -> Result<Vec<EIP1186AccountProofResponse>, ErrorObject<'static>>

Handler for eth_getMultiProof

Source§

async fn block_access_list_by_block_hash( &self, hash: FixedBytes<32>, ) -> Result<Option<Vec<AccountChanges>>, ErrorObject<'static>>

Handler for eth_getBlockAccessListByBlockHash

Source§

async fn block_access_list_by_block_number( &self, block_number: BlockNumberOrTag, ) -> Result<Option<Vec<AccountChanges>>, ErrorObject<'static>>

Handler for eth_getBlockAccessListByBlockNumber

Source§

async fn block_access_list( &self, block_id: BlockId, ) -> Result<Option<Vec<AccountChanges>>, ErrorObject<'static>>

Handler for eth_getBlockAccessList

Source§

async fn block_access_list_raw( &self, block: BlockId, ) -> Result<Option<Bytes>, ErrorObject<'static>>

Handler for getBlockAccessListRaw

Source§

async fn block_receipts( &self, block_id: BlockId, ) -> Result<Option<Vec<<<Eth as EthApiTypes>::NetworkTypes as RpcTypes>::Receipt>>, ErrorObject<'static>>

Returns all transaction receipts for a given block.
Source§

async fn transaction_receipt( &self, hash: FixedBytes<32>, ) -> Result<Option<<<Eth as EthApiTypes>::NetworkTypes as RpcTypes>::Receipt>, ErrorObject<'static>>

Returns the receipt of a transaction by transaction hash.
Source§

fn into_rpc(self) -> RpcModule<Self>
where TxReq: Send + Sync + 'static + DeserializeOwned, B: Send + Sync + 'static + Clone + Serialize, R: Send + Sync + 'static + Clone + Serialize, L: Send + Sync + 'static + Clone + Serialize,

Collects all the methods and subscriptions defined in the trait and adds them into a single RpcModule.
§

impl<T, H> Eq for Block<T, H>
where T: Eq, H: Eq,

§

impl From<AnyRpcBlock> for Block<AnyRpcTransaction, Header<AnyHeader>>

§

fn from(value: AnyRpcBlock) -> Block<AnyRpcTransaction, Header<AnyHeader>>

Converts to this type from the input type.
§

impl<T, S> From<Block<T>> for Block<S>
where S: From<T>,

§

fn from(block: Block<T>) -> Block<S>

Converts to this type from the input type.
§

impl<T, H> PartialEq for Block<T, H>
where T: PartialEq, H: PartialEq,

§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
§

impl<T, H> Serialize for Block<T, H>
where T: Serialize, H: Serialize,

§

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<T, H> StructuralPartialEq for Block<T, H>
where T: PartialEq, H: PartialEq,

§

impl<T, U> TryFrom<Block<U>> for RecoveredBlock<Block<T>>
where T: SignedTransaction + From<U>,

§

type Error = BlockRecoveryError<Block<T>>

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

fn try_from( block: Block<U>, ) -> Result<RecoveredBlock<Block<T>>, <RecoveredBlock<Block<T>> as TryFrom<Block<U>>>::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl<T, H> Freeze for Block<T, H>

§

impl<T, H> RefUnwindSafe for Block<T, H>

§

impl<T, H> Send for Block<T, H>
where H: Send, BlockTransactions<T>: Send,

§

impl<T, H> Sync for Block<T, H>
where H: Sync, BlockTransactions<T>: Sync,

§

impl<T, H> Unpin for Block<T, H>

§

impl<T, H> UnsafeUnpin for Block<T, H>

§

impl<T, H> UnwindSafe for Block<T, H>

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
§

impl<'de, T> BorrowedRpcObject<'de> for T
where T: RpcBorrow<'de> + RpcSend,

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

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

impl<T> Conv for T

§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
Source§

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

Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

§

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

§

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

Compare self to key and return true if they are equal.
§

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

§

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

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

impl<T> EthApiServer<<<T as EthApiTypes>::NetworkTypes as RpcTypes>::TransactionRequest, <<T as EthApiTypes>::NetworkTypes as RpcTypes>::TransactionResponse, Block<<<T as EthApiTypes>::NetworkTypes as RpcTypes>::TransactionResponse, <<T as EthApiTypes>::NetworkTypes as RpcTypes>::Header>, <<T as EthApiTypes>::NetworkTypes as RpcTypes>::Receipt, <<T as EthApiTypes>::NetworkTypes as RpcTypes>::Header, <<T as RpcNodeCore>::Primitives as NodePrimitives>::SignedTx> for T
where T: FullEthApi, ErrorObject<'static>: From<<T as EthApiTypes>::Error>,

Source§

async fn protocol_version(&self) -> Result<Uint<64, 1>, ErrorObject<'static>>

Handler for: eth_protocolVersion

Source§

fn syncing(&self) -> Result<SyncStatus, ErrorObject<'static>>

Handler for: eth_syncing

Source§

async fn author(&self) -> Result<Address, ErrorObject<'static>>

Handler for: eth_coinbase

Source§

fn accounts(&self) -> Result<Vec<Address>, ErrorObject<'static>>

Handler for: eth_accounts

Source§

fn block_number(&self) -> Result<Uint<256, 4>, ErrorObject<'static>>

Handler for: eth_blockNumber

Source§

async fn chain_id(&self) -> Result<Option<Uint<64, 1>>, ErrorObject<'static>>

Handler for: eth_chainId

Source§

fn capabilities(&self) -> Result<EthCapabilities, ErrorObject<'static>>

Handler for: eth_capabilities

Source§

async fn block_by_hash( &self, hash: FixedBytes<32>, full: bool, ) -> Result<Option<Block<<<T as EthApiTypes>::NetworkTypes as RpcTypes>::TransactionResponse, <<T as EthApiTypes>::NetworkTypes as RpcTypes>::Header>>, ErrorObject<'static>>

Handler for: eth_getBlockByHash

Source§

async fn block_by_number( &self, number: BlockNumberOrTag, full: bool, ) -> Result<Option<Block<<<T as EthApiTypes>::NetworkTypes as RpcTypes>::TransactionResponse, <<T as EthApiTypes>::NetworkTypes as RpcTypes>::Header>>, ErrorObject<'static>>

Handler for: eth_getBlockByNumber

Source§

async fn block_transaction_count_by_hash( &self, hash: FixedBytes<32>, ) -> Result<Option<Uint<256, 4>>, ErrorObject<'static>>

Handler for: eth_getBlockTransactionCountByHash

Source§

async fn block_transaction_count_by_number( &self, number: BlockNumberOrTag, ) -> Result<Option<Uint<256, 4>>, ErrorObject<'static>>

Handler for: eth_getBlockTransactionCountByNumber

Source§

async fn block_uncles_count_by_hash( &self, hash: FixedBytes<32>, ) -> Result<Option<Uint<256, 4>>, ErrorObject<'static>>

Handler for: eth_getUncleCountByBlockHash

Source§

async fn block_uncles_count_by_number( &self, number: BlockNumberOrTag, ) -> Result<Option<Uint<256, 4>>, ErrorObject<'static>>

Handler for: eth_getUncleCountByBlockNumber

Source§

async fn block_receipts( &self, block_id: BlockId, ) -> Result<Option<Vec<<<T as EthApiTypes>::NetworkTypes as RpcTypes>::Receipt>>, ErrorObject<'static>>

Handler for: eth_getBlockReceipts

Source§

async fn uncle_by_block_hash_and_index( &self, hash: FixedBytes<32>, index: Index, ) -> Result<Option<Block<<<T as EthApiTypes>::NetworkTypes as RpcTypes>::TransactionResponse, <<T as EthApiTypes>::NetworkTypes as RpcTypes>::Header>>, ErrorObject<'static>>

Handler for: eth_getUncleByBlockHashAndIndex

Source§

async fn uncle_by_block_number_and_index( &self, number: BlockNumberOrTag, index: Index, ) -> Result<Option<Block<<<T as EthApiTypes>::NetworkTypes as RpcTypes>::TransactionResponse, <<T as EthApiTypes>::NetworkTypes as RpcTypes>::Header>>, ErrorObject<'static>>

Handler for: eth_getUncleByBlockNumberAndIndex

Source§

async fn raw_transaction_by_hash( &self, hash: FixedBytes<32>, ) -> Result<Option<Bytes>, ErrorObject<'static>>

Handler for: eth_getRawTransactionByHash

Source§

async fn transaction_by_hash( &self, hash: FixedBytes<32>, ) -> Result<Option<<<T as EthApiTypes>::NetworkTypes as RpcTypes>::TransactionResponse>, ErrorObject<'static>>

Handler for: eth_getTransactionByHash

Source§

async fn raw_transaction_by_block_hash_and_index( &self, hash: FixedBytes<32>, index: Index, ) -> Result<Option<Bytes>, ErrorObject<'static>>

Handler for: eth_getRawTransactionByBlockHashAndIndex

Source§

async fn transaction_by_block_hash_and_index( &self, hash: FixedBytes<32>, index: Index, ) -> Result<Option<<<T as EthApiTypes>::NetworkTypes as RpcTypes>::TransactionResponse>, ErrorObject<'static>>

Handler for: eth_getTransactionByBlockHashAndIndex

Source§

async fn raw_transaction_by_block_number_and_index( &self, number: BlockNumberOrTag, index: Index, ) -> Result<Option<Bytes>, ErrorObject<'static>>

Handler for: eth_getRawTransactionByBlockNumberAndIndex

Source§

async fn transaction_by_block_number_and_index( &self, number: BlockNumberOrTag, index: Index, ) -> Result<Option<<<T as EthApiTypes>::NetworkTypes as RpcTypes>::TransactionResponse>, ErrorObject<'static>>

Handler for: eth_getTransactionByBlockNumberAndIndex

Source§

async fn transaction_by_sender_and_nonce( &self, sender: Address, nonce: Uint<64, 1>, ) -> Result<Option<<<T as EthApiTypes>::NetworkTypes as RpcTypes>::TransactionResponse>, ErrorObject<'static>>

Handler for: eth_getTransactionBySenderAndNonce

Source§

fn pending_transactions( &self, ) -> Result<Vec<<<T as EthApiTypes>::NetworkTypes as RpcTypes>::TransactionResponse>, ErrorObject<'static>>

Handler for: eth_pendingTransactions

Source§

async fn transaction_receipt( &self, hash: FixedBytes<32>, ) -> Result<Option<<<T as EthApiTypes>::NetworkTypes as RpcTypes>::Receipt>, ErrorObject<'static>>

Handler for: eth_getTransactionReceipt

Source§

async fn balance( &self, address: Address, block_number: Option<BlockId>, ) -> Result<Uint<256, 4>, ErrorObject<'static>>

Handler for: eth_getBalance

Source§

async fn storage_at( &self, address: Address, index: JsonStorageKey, block_number: Option<BlockId>, ) -> Result<FixedBytes<32>, ErrorObject<'static>>

Handler for: eth_getStorageAt

Source§

async fn storage_values( &self, requests: HashMap<Address, Vec<JsonStorageKey>>, block_number: Option<BlockId>, ) -> Result<HashMap<Address, Vec<FixedBytes<32>>>, ErrorObject<'static>>

Handler for: eth_getStorageValues

Source§

async fn transaction_count( &self, address: Address, block_number: Option<BlockId>, ) -> Result<Uint<256, 4>, ErrorObject<'static>>

Handler for: eth_getTransactionCount

Source§

async fn get_code( &self, address: Address, block_number: Option<BlockId>, ) -> Result<Bytes, ErrorObject<'static>>

Handler for: eth_getCode

Source§

async fn header_by_number( &self, block_number: BlockNumberOrTag, ) -> Result<Option<<<T as EthApiTypes>::NetworkTypes as RpcTypes>::Header>, ErrorObject<'static>>

Handler for: eth_getHeaderByNumber

Source§

async fn header_by_hash( &self, hash: FixedBytes<32>, ) -> Result<Option<<<T as EthApiTypes>::NetworkTypes as RpcTypes>::Header>, ErrorObject<'static>>

Handler for: eth_getHeaderByHash

Source§

async fn simulate_v1( &self, payload: SimulatePayload<<<T as EthApiTypes>::NetworkTypes as RpcTypes>::TransactionRequest>, block_number: Option<BlockId>, ) -> Result<Vec<SimulatedBlock<Block<<<T as EthApiTypes>::NetworkTypes as RpcTypes>::TransactionResponse, <<T as EthApiTypes>::NetworkTypes as RpcTypes>::Header>>>, ErrorObject<'static>>

Handler for: eth_simulateV1

Source§

async fn call( &self, request: <<T as EthApiTypes>::NetworkTypes as RpcTypes>::TransactionRequest, block_number: Option<BlockId>, state_overrides: Option<HashMap<Address, AccountOverride, FbBuildHasher<20>>>, block_overrides: Option<Box<BlockOverrides>>, ) -> Result<Bytes, ErrorObject<'static>>

Handler for: eth_call

Source§

async fn fill_transaction( &self, request: <<T as EthApiTypes>::NetworkTypes as RpcTypes>::TransactionRequest, ) -> Result<FillTransaction<<<T as RpcNodeCore>::Primitives as NodePrimitives>::SignedTx>, ErrorObject<'static>>

Handler for: eth_fillTransaction

Source§

async fn call_many( &self, bundles: Vec<Bundle<<<T as EthApiTypes>::NetworkTypes as RpcTypes>::TransactionRequest>>, state_context: Option<StateContext>, state_override: Option<HashMap<Address, AccountOverride, FbBuildHasher<20>>>, ) -> Result<Vec<Vec<EthCallResponse>>, ErrorObject<'static>>

Handler for: eth_callMany

Source§

async fn create_access_list( &self, request: <<T as EthApiTypes>::NetworkTypes as RpcTypes>::TransactionRequest, block_number: Option<BlockId>, state_override: Option<HashMap<Address, AccountOverride, FbBuildHasher<20>>>, ) -> Result<AccessListResult, ErrorObject<'static>>

Handler for: eth_createAccessList

Source§

async fn estimate_gas( &self, request: <<T as EthApiTypes>::NetworkTypes as RpcTypes>::TransactionRequest, block_number: Option<BlockId>, state_override: Option<HashMap<Address, AccountOverride, FbBuildHasher<20>>>, block_overrides: Option<Box<BlockOverrides>>, ) -> Result<Uint<256, 4>, ErrorObject<'static>>

Handler for: eth_estimateGas

Source§

async fn gas_price(&self) -> Result<Uint<256, 4>, ErrorObject<'static>>

Handler for: eth_gasPrice

Source§

async fn get_account( &self, address: Address, block: BlockId, ) -> Result<Option<TrieAccount>, ErrorObject<'static>>

Handler for: eth_getAccount

Source§

async fn max_priority_fee_per_gas( &self, ) -> Result<Uint<256, 4>, ErrorObject<'static>>

Handler for: eth_maxPriorityFeePerGas

Source§

async fn blob_base_fee(&self) -> Result<Uint<256, 4>, ErrorObject<'static>>

Handler for: eth_blobBaseFee

Source§

async fn base_fee(&self) -> Result<Option<Uint<256, 4>>, ErrorObject<'static>>

Handler for: eth_baseFee

Source§

async fn fee_history( &self, block_count: Uint<64, 1>, newest_block: BlockNumberOrTag, reward_percentiles: Option<Vec<f64>>, ) -> Result<FeeHistory, ErrorObject<'static>>

Handler for: eth_feeHistory

Source§

async fn is_mining(&self) -> Result<bool, ErrorObject<'static>>

Handler for: eth_mining

Source§

async fn hashrate(&self) -> Result<Uint<256, 4>, ErrorObject<'static>>

Handler for: eth_hashrate

Source§

async fn get_work(&self) -> Result<Work, ErrorObject<'static>>

Handler for: eth_getWork

Source§

async fn submit_hashrate( &self, _hashrate: Uint<256, 4>, _id: FixedBytes<32>, ) -> Result<bool, ErrorObject<'static>>

Handler for: eth_submitHashrate

Source§

async fn submit_work( &self, _nonce: FixedBytes<8>, _pow_hash: FixedBytes<32>, _mix_digest: FixedBytes<32>, ) -> Result<bool, ErrorObject<'static>>

Handler for: eth_submitWork

Source§

async fn send_transaction( &self, request: <<T as EthApiTypes>::NetworkTypes as RpcTypes>::TransactionRequest, ) -> Result<FixedBytes<32>, ErrorObject<'static>>

Handler for: eth_sendTransaction

Source§

async fn send_raw_transaction( &self, tx: Bytes, ) -> Result<FixedBytes<32>, ErrorObject<'static>>

Handler for: eth_sendRawTransaction

Source§

async fn send_raw_transaction_sync( &self, tx: Bytes, timeout_ms: Option<u64>, ) -> Result<<<T as EthApiTypes>::NetworkTypes as RpcTypes>::Receipt, ErrorObject<'static>>

Handler for: eth_sendRawTransactionSync

Source§

async fn sign( &self, address: Address, message: Bytes, ) -> Result<Bytes, ErrorObject<'static>>

Handler for: eth_sign

Source§

async fn sign_transaction( &self, request: <<T as EthApiTypes>::NetworkTypes as RpcTypes>::TransactionRequest, ) -> Result<Bytes, ErrorObject<'static>>

Handler for: eth_signTransaction

Source§

async fn sign_typed_data( &self, address: Address, data: TypedData, ) -> Result<Bytes, ErrorObject<'static>>

Handler for: eth_signTypedData

Source§

async fn get_proof( &self, address: Address, keys: Vec<JsonStorageKey>, block_number: Option<BlockId>, ) -> Result<EIP1186AccountProofResponse, ErrorObject<'static>>

Handler for: eth_getProof

Source§

async fn get_multi_proof( &self, targets: Vec<(Address, Vec<FixedBytes<32>>)>, block_number: Option<BlockId>, ) -> Result<Vec<EIP1186AccountProofResponse>, ErrorObject<'static>>

Handler for: eth_getMultiProof

Source§

async fn get_account_info( &self, address: Address, block: BlockId, ) -> Result<AccountInfo, ErrorObject<'static>>

Handler for: eth_getAccountInfo

Source§

async fn block_access_list_by_block_hash( &self, block_hash: FixedBytes<32>, ) -> Result<Option<Vec<AccountChanges>>, ErrorObject<'static>>

Handler for: eth_getBlockAccessListByBlockHash

Source§

async fn block_access_list_by_block_number( &self, number: BlockNumberOrTag, ) -> Result<Option<Vec<AccountChanges>>, ErrorObject<'static>>

Handler for: eth_getBlockAccessListByBlockNumber

Source§

async fn block_access_list( &self, block_id: BlockId, ) -> Result<Option<Vec<AccountChanges>>, ErrorObject<'static>>

Handler for: eth_getBlockAccessList

Source§

async fn block_access_list_raw( &self, block: BlockId, ) -> Result<Option<Bytes>, ErrorObject<'static>>

Handler for: eth_getBlockAccessListRaw

Source§

fn into_rpc(self) -> RpcModule<Self>
where TxReq: Send + Sync + 'static + DeserializeOwned, T: Send + Sync + 'static + Clone + Serialize, B: Send + Sync + 'static + Clone + Serialize, R: Send + Sync + 'static + Clone + Serialize, H: Send + Sync + 'static + Clone + Serialize, RawTx: Send + Sync + 'static + Clone + Serialize,

Collects all the methods and subscriptions defined in the trait and adds them into a single RpcModule.
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self> ⓘ

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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
§

impl<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [Layered].
§

impl<T> MaybeDebug for T
where T: Debug,

§

impl<T> MaybeSerde for T
where T: Serialize + for<'de> Deserialize<'de>,

Source§

impl<T> NippyJarHeader for T
where T: Send + Sync + Serialize + for<'b> Deserialize<'b> + Debug + 'static,

§

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

§

fn type_id(&self) -> TypeId

Returns the lifetime-erased type ID of self.
§

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

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<'de, T> RpcBorrow<'de> for T
where T: Deserialize<'de> + Debug + Send + Sync + Unpin,

§

impl<T> RpcObject for T
where T: RpcSend + RpcRecv,

§

impl<T> RpcRecv for T
where T: DeserializeOwned + Debug + Send + Sync + Unpin + 'static,

§

impl<T> RpcSend for T
where T: Serialize + Clone + Debug + Send + Sync + Unpin,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
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
§

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

§

fn try_clone(&self) -> Result<T, Error>

Clones self, possibly returning an error.
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more

Layout§

Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.