Crate eth
Expand description
§alloy-rpc-types-eth
Types for the eth Ethereum JSON-RPC namespace.
Common entry points are TransactionRequest for calls and transaction construction, Filter and
Log for log queries, Block and Header for block responses, TransactionReceipt for execution
results, and StateOverride for temporary call state.
Transaction type inference is driven by populated fields, while event filters require the complete canonical event signature:
use alloy_consensus::TxType;
use alloy_rpc_types_eth::{Filter, TransactionRequest};
let request = TransactionRequest::default();
assert_eq!(request.preferred_type(), TxType::Eip1559);
let filter = Filter::new().event("Transfer(address,address,uint256)");
assert!(filter.has_topics());Modules§
- erc4337
- This module provides implementations for ERC-4337.
- error
- Commonly used errors for the
eth_namespace. - pubsub
serde - Ethereum types for pub-sub
- simulate
- ‘eth_simulateV1’ Request / Response types: https://github.com/ethereum/execution-apis/pull/484
- state
- bindings for state overrides in eth_call
- transaction
- RPC types for transactions
Structs§
- Access
List - AccessList as defined in EIP-2930
- Access
List Item - A list of addresses and storage keys that the transaction plans to access. Accesses outside the list are possible, but become more expensive.
- Access
List Result AccessListResultfor handling errors frometh_createAccessList- Account
- Represents an TrieAccount in the account trie.
- Account
Info - Account information.
- AnyReceipt
Envelope - Receipt envelope, as defined in EIP-2718.
- Authorization
- An unsigned EIP-7702 authorization.
- BadBlock
- Bad block representation.
- Blob
Transaction Sidecar - This represents a set of blobs, and its corresponding commitments and proofs.
- Blob
Transaction Sidecar Eip7594 - This represents a set of blobs, and its corresponding commitments and cell proofs.
- Block
- Block representation for RPC.
- Block
Overrides - BlockOverrides is a set of header fields to override.
- Block
Transaction Hashes - An iterator over transaction hashes by value.
- Bloom
Filter - Helper type to represent a bloom filter used for matching logs.
- Bundle
- Bundle of transactions
- Chain
Status - Chain status.
- EIP1186
Account Proof Response serde - Response for EIP-1186 account proof
eth_getProof - EIP1186
Storage Proof serde - Data structure with proof for one single storage-entry
- EthCall
Response - CallResponse for eth_callMany
- ExtAccount
Info - Extended account information (used by
parity_allAccountInfo). - FeeHistory
- Response type for
eth_feeHistory. - Fill
Transaction - Response type for
eth_fillTransaction. - Filter
- Filter for logs.
- Filter
Receipts Iter - Iterator that yields logs from receipts that match a filter.
- Filter
Set - A set of values used to filter logs.
- Filtered
Params - Support for matching Filters
- Header
- RPC representation of block header, wrapping a consensus header.
- Index
- A hex encoded or decimal index that’s intended to be used as a rust index, hence it’s
deserialized into a
usize. - Log
- Ethereum Log emitted by a transaction
- Packed
User Operation PackedUserOperationin the spec: Entry Point V0.7- Peer
EthProtocol Info - Peer Ethereum protocol information
- Peer
Info - Peer connection information
- Peer
Network Info - Peer network information
- Peer
Protocols Info - Peer protocols information
- Peers
- Peers info
- PipProtocol
Info - Peer PIP protocol information
- RawLog
- Ethereum Log
- Receipt
- Receipt containing result of transaction execution.
- Receipt
With Bloom - A receipt paired with a precomputed logs bloom.
- Recovered
Account - account derived from a signature as well as information that tells if it is valid for the current chain
- RpcBlock
Hash - A block hash which may have a boolean
requireCanonicalfield. - Send
User Operation Response - Response to sending a user operation.
- Signed
Authorization - A signed EIP-7702 authorization.
- Stage
- The detail of the sync stages.
- State
Context - State context for callMany
- Storage
Values Request - Request type for
eth_getStorageValues. - Storage
Values Response - Response type for
eth_getStorageValues. - Sync
Info - Syncing info
- Transaction
- Transaction object used in RPC.
- Transaction
Info - Additional fields in the context of a (maybe) pending block that contains this transaction.
- Transaction
Input - Helper type that supports both
dataandinputfields that map to transaction input data. - Transaction
Receipt - Transaction receipt
- Transaction
Request - Represents all transaction requests to/from RPC.
- Transaction
Stats - Propagation statistics for pending transaction.
- TxGas
AndReward - Internal struct to calculate reward percentiles
- User
Operation UserOperationin the spec: Entry Point V0.6- User
Operation GasEstimation - Represents the gas estimation for a user operation.
- User
Operation Receipt - Represents the receipt of a user operation.
- Withdrawal
- Withdrawal represents a validator withdrawal from the consensus layer.
- Withdrawals
- Represents a collection of Withdrawals.
- Work
- The result of an
eth_getWorkrequest
Enums§
- Block
Error - Error that can occur when converting other types to blocks
- BlockId
- A Block Identifier. https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1898.md
- Block
Number OrTag - A block Number (or tag - “latest”, “earliest”, “pending”)
- Block
Transactions - Representation of the
transactionsfield in block JSON-RPC responses. - Block
Transactions Kind - Determines how the
transactionsfield of block should be filled. - Conversion
Error - Error variants when converting from crate::Transaction to [alloy_consensus::Signed] transaction.
- Filter
Block Error - Represents errors that can occur when setting block filters in
FilterBlockOption. - Filter
Block Option - Represents the target range of blocks for the filter
- Filter
Changes - Response of the
eth_getFilterChangesRPC. - Filter
Id - Owned equivalent of a
SubscriptionId - Pending
Transaction Filter Kind - Specifies the kind of information you wish to receive from the
eth_newPendingTransactionFilterRPC endpoint. - Receipt
Envelope - Receipt envelope, as defined in EIP-2718.
- Send
User Operation - Send User Operation
- Sync
Status - Sync status
- Transaction
Index - Represents a transaction index where -1 means all transactions
- Transaction
Input Kind - Represents how a
TransactionRequesthandles input/data fields. - Value
OrArray - Union type for representing a single value or a vector of values inside a filter.
Traits§
- Transaction
Trait - Represents a minimal EVM transaction. Currently, EIP-1559, EIP-4844, and EIP-7702 support dynamic fees. We call these transactions “dynamic fee transactions”. We call non dynamic fee transactions(EIP-155, EIP-2930) “legacy fee transactions”.
Functions§
- calc_
blob_ gasprice - Calculates the blob gas price from the header’s excess blob gas field.
- calc_
excess_ blob_ gas - Calculates the
excess_blob_gasfrom the parent header’sblob_gas_usedandexcess_blob_gas. - logs_
bloom - Calculate receipt logs bloom.
Type Aliases§
- Block
Hash OrNumber - A block hash or a block number
- Block
NumHash - A block number and a hash
- Fork
Block - Block number and hash of the forked block.
- Topic
- A single topic