Skip to content

Commit

Permalink
feat: add L2EthApiExt trait (#13539)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Dec 24, 2024
1 parent 9773b85 commit a4410c8
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crates/rpc/rpc-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub mod servers {
};
pub use reth_rpc_eth_api::{
self as eth, EthApiServer, EthBundleApiServer, EthCallBundleApiServer, EthFilterApiServer,
EthPubSubApiServer,
EthPubSubApiServer, L2EthApiExtServer,
};
}

Expand Down Expand Up @@ -84,5 +84,6 @@ pub mod clients {
};
pub use reth_rpc_eth_api::{
EthApiClient, EthBundleApiClient, EthCallBundleApiClient, EthFilterApiClient,
L2EthApiExtServer,
};
}
18 changes: 18 additions & 0 deletions crates/rpc/rpc-eth-api/src/ext.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//! `eth_` Extension traits.
use alloy_primitives::{Bytes, B256};
use alloy_rpc_types_eth::erc4337::ConditionalOptions;
use jsonrpsee::{core::RpcResult, proc_macros::rpc};

/// Extension trait for `eth_` namespace for L2s.
#[cfg_attr(not(feature = "client"), rpc(server, namespace = "eth"))]
#[cfg_attr(feature = "client", rpc(server, client, namespace = "eth"))]
pub trait L2EthApiExt {
/// Sends signed transaction with the given condition.
#[method(name = "sendRawTransactionConditional")]
async fn send_raw_transaction_conditional(
&self,
bytes: Bytes,
condition: ConditionalOptions,
) -> RpcResult<B256>;
}
4 changes: 4 additions & 0 deletions crates/rpc/rpc-eth-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

pub mod bundle;
pub mod core;
pub mod ext;
pub mod filter;
pub mod helpers;
pub mod node;
Expand All @@ -22,6 +23,7 @@ pub mod types;

pub use bundle::{EthBundleApiServer, EthCallBundleApiServer};
pub use core::{EthApiServer, FullEthApiServer};
pub use ext::L2EthApiExtServer;
pub use filter::EthFilterApiServer;
pub use node::{RpcNodeCore, RpcNodeCoreExt};
pub use pubsub::EthPubSubApiServer;
Expand All @@ -36,6 +38,8 @@ pub use bundle::{EthBundleApiClient, EthCallBundleApiClient};
#[cfg(feature = "client")]
pub use core::EthApiClient;
#[cfg(feature = "client")]
pub use ext::L2EthApiExtClient;
#[cfg(feature = "client")]
pub use filter::EthFilterApiClient;

use reth_trie_common as _;

0 comments on commit a4410c8

Please sign in to comment.