Skip to main content

Crate alloy_network_primitives

Crate alloy_network_primitives 

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

BlockTransactionHashes
An iterator over transaction hashes by value.
InclusionInfo
Metadata locating an included transaction within a block.
TransactionFailedError
Error returned when a transaction failed.

Enums§

BlockTransactions
Representation of the transactions field in block JSON-RPC responses.
BlockTransactionsKind
Determines how the transactions field of block should be filled.

Traits§

BlockResponse
Block JSON-RPC response.
HeaderResponse
Header JSON-RPC response.
ReceiptResponse
Receipt JSON-RPC response.
TransactionBuilder4844
Transaction builder type supporting EIP-4844 transaction fields with both EIP-4844 and EIP-7594 sidecar variants.
TransactionBuilder7702
Transaction builder type supporting EIP-7702 transaction fields.
TransactionResponse
Transaction JSON-RPC response. Aggregates transaction data with its block and signer context.