Expand description
§alloy-network-primitives
Response traits and shared types for Alloy’s network abstraction.
The response traits (BlockResponse, HeaderResponse, TransactionResponse, and
ReceiptResponse) let generic code inspect network-specific RPC values. BlockTransactions
represents full transactions, hashes only, or the omitted transaction field used by uncle
responses. Because its JSON representation is untagged, an empty [] deserializes as Full([])
and cannot preserve whether a hashes-only request produced it. Builder capability traits describe
optional transaction fields without choosing a concrete network.
use alloy_network_primitives::BlockResponse;
use alloy_primitives::TxHash;
fn transaction_hashes<B: BlockResponse>(block: &B) -> Vec<TxHash> {
block.transactions().hashes().collect()
}Structs§
- Block
Transaction Hashes - An iterator over transaction hashes by value.
- Inclusion
Info - Metadata locating an included transaction within a block.
- Transaction
Failed Error - Error returned when a transaction failed.
Enums§
- Block
Transactions - Representation of the
transactionsfield in block JSON-RPC responses. - Block
Transactions Kind - Determines how the
transactionsfield of block should be filled.
Traits§
- Block
Response - Block JSON-RPC response.
- Header
Response - Header JSON-RPC response.
- Receipt
Response - Receipt JSON-RPC response.
- Transaction
Builder4844 - Transaction builder type supporting EIP-4844 transaction fields with both EIP-4844 and EIP-7594 sidecar variants.
- Transaction
Builder7702 - Transaction builder type supporting EIP-7702 transaction fields.
- Transaction
Response - Transaction JSON-RPC response. Aggregates transaction data with its block and signer context.