Skip to main content

foundry_primitives/network/
mod.rs

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