Skip to main content

foundry_primitives/network/
mod.rs

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