Skip to content

[Feature] Add network-parameterized block responses #267

@onbjerg

Description

@onbjerg

Component

network, json-rpc, providers, pubsub

Describe the feature you would like

#190 replaced the provider with a network-parameterized provider, but block responses are still just Ethereum headers and Ethereum transactions. We need a Block type generic for networks.

We have one in alloy-network but we need to check that it is correct and use it in alloy-providers:

pub enum TransactionList<T> {
/// Hashes only.
Hashes(Vec<B256>),
/// Hydrated tx objects.
Hydrated(Vec<T>),
/// Special case for uncle response
Uncled,
}
/// A block response
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
pub struct BlockResponse<N: Network> {
#[serde(flatten)]
header: N::HeaderResponse,
transactions: TransactionList<N::TransactionResponse>,
}

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    debtTech debt which needs to be addressedenhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions