feat: add rpc-api trait for call bundle (#5449)

This commit is contained in:
Matthias Seitz
2023-11-15 22:16:26 +01:00
committed by GitHub
parent f9725a4f88
commit 5e605d20a4
3 changed files with 35 additions and 10 deletions

View File

@@ -1,15 +1,28 @@
//! Additional `eth_` functions for bundles
//!
//! See also <https://docs.flashbots.net/flashbots-auction/searchers/advanced/rpc-endpoint>
use jsonrpsee::proc_macros::rpc;
use reth_primitives::{Bytes, B256};
use reth_rpc_types::{
CancelBundleRequest, CancelPrivateTransactionRequest, EthBundleHash, EthCallBundleResponse,
EthCallBundleTransactionResult, EthSendBundle, PrivateTransactionRequest,
CancelBundleRequest, CancelPrivateTransactionRequest, EthBundleHash, EthCallBundle,
EthCallBundleResponse, EthSendBundle, PrivateTransactionRequest,
};
/// Eth bundle rpc interface.
///
/// See also <https://docs.flashbots.net/flashbots-auction/searchers/advanced/rpc-endpoint>
/// A subset of the [EthBundleApi] API interface that only supports `eth_callBundle`.
#[cfg_attr(not(feature = "client"), rpc(server, namespace = "eth"))]
#[cfg_attr(feature = "client", rpc(server, client, namespace = "eth"))]
#[async_trait::async_trait]
pub trait EthCallBundleApi {
/// `eth_callBundle` can be used to simulate a bundle against a specific block number,
/// including simulating a bundle at the top of the next block.
#[method(name = "callBundle")]
async fn call_bundle(
&self,
request: EthCallBundle,
) -> jsonrpsee::core::RpcResult<EthCallBundleResponse>;
}
/// Eth bundle rpc interface.
/// The __full__ Eth bundle rpc interface.
///
/// See also <https://docs.flashbots.net/flashbots-auction/searchers/advanced/rpc-endpoint>
#[cfg_attr(not(feature = "client"), rpc(server, namespace = "eth"))]
@@ -26,8 +39,8 @@ pub trait EthBundleApi {
#[method(name = "callBundle")]
async fn call_bundle(
&self,
request: EthCallBundleResponse,
) -> jsonrpsee::core::RpcResult<EthCallBundleTransactionResult>;
request: EthCallBundle,
) -> jsonrpsee::core::RpcResult<EthCallBundleResponse>;
/// `eth_cancelBundle` is used to prevent a submitted bundle from being included on-chain. See [bundle cancellations](https://docs.flashbots.net/flashbots-auction/searchers/advanced/bundle-cancellations) for more information.
#[method(name = "cancelBundle")]