Skip to main content

foundry_primitives/network/
mod.rs

1use alloy_network::Network;
2
3mod receipt;
4
5use alloy_provider::fillers::{
6    BlobGasFiller, ChainIdFiller, GasFiller, JoinFill, NonceFiller, RecommendedFillers,
7};
8pub use receipt::*;
9
10/// Foundry network type.
11///
12/// This network type supports Foundry-specific transaction types, including
13/// op-stack deposit transactions, alongside standard Ethereum transaction types.
14///
15/// Note: This is a basic implementation ("for now") that provides the core Network
16/// trait definitions. Full Foundry-specific RPC types will be implemented in future work.
17/// Currently, this uses Ethereum's Network configuration as a compatibility layer.
18#[derive(Debug, Clone, Copy)]
19pub struct FoundryNetwork {
20    _private: (),
21}
22
23// Use Ethereum's Network trait implementation as the basis.
24// This provides compatibility with the alloy-network ecosystem while we build
25// out Foundry-specific RPC types.
26impl Network for FoundryNetwork {
27    type TxType = crate::FoundryTxType;
28
29    type TxEnvelope = crate::FoundryTxEnvelope;
30
31    type UnsignedTx = crate::FoundryTypedTx;
32
33    type ReceiptEnvelope = crate::FoundryReceiptEnvelope;
34
35    type Header = alloy_consensus::Header;
36
37    type TransactionRequest = crate::FoundryTransactionRequest;
38
39    type TransactionResponse = op_alloy_rpc_types::Transaction<crate::FoundryTxEnvelope>;
40
41    type ReceiptResponse = crate::FoundryTxReceipt;
42
43    type HeaderResponse = alloy_rpc_types_eth::Header;
44
45    type BlockResponse =
46        alloy_rpc_types_eth::Block<Self::TransactionResponse, Self::HeaderResponse>;
47}
48
49impl RecommendedFillers for FoundryNetwork {
50    type RecommendedFillers =
51        JoinFill<GasFiller, JoinFill<BlobGasFiller, JoinFill<NonceFiller, ChainIdFiller>>>;
52
53    fn recommended_fillers() -> Self::RecommendedFillers {
54        Default::default()
55    }
56}