diff --git a/crates/op-rbuilder/src/primitives/bundle.rs b/crates/op-rbuilder/src/primitives/bundle.rs index 89c530716..c6ed24164 100644 --- a/crates/op-rbuilder/src/primitives/bundle.rs +++ b/crates/op-rbuilder/src/primitives/bundle.rs @@ -1,4 +1,4 @@ -use alloy_primitives::Bytes; +use alloy_primitives::{Bytes, B256}; use alloy_rpc_types_eth::erc4337::TransactionConditional; use serde::{Deserialize, Serialize}; @@ -24,3 +24,9 @@ impl Bundle { } } } + +#[derive(Serialize, Deserialize, Debug, Clone)] +pub struct BundleResult { + #[serde(rename = "bundleHash")] + pub bundle_hash: B256, +} diff --git a/crates/op-rbuilder/src/revert_protection.rs b/crates/op-rbuilder/src/revert_protection.rs index 7f6f42e5c..17ab73682 100644 --- a/crates/op-rbuilder/src/revert_protection.rs +++ b/crates/op-rbuilder/src/revert_protection.rs @@ -1,8 +1,7 @@ use crate::{ - primitives::bundle::{Bundle, MAX_BLOCK_RANGE_BLOCKS}, + primitives::bundle::{Bundle, BundleResult, MAX_BLOCK_RANGE_BLOCKS}, tx::{FBPooledTransaction, MaybeRevertingTransaction}, }; -use alloy_primitives::B256; use jsonrpsee::{ core::{async_trait, RpcResult}, proc_macros::rpc, @@ -17,7 +16,7 @@ use reth_transaction_pool::{PoolTransaction, TransactionOrigin, TransactionPool} #[cfg_attr(test, rpc(server, client, namespace = "eth"))] pub trait EthApiOverride { #[method(name = "sendBundle")] - async fn send_bundle(&self, tx: Bundle) -> RpcResult; + async fn send_bundle(&self, tx: Bundle) -> RpcResult; } pub struct RevertProtectionExt { @@ -37,7 +36,7 @@ where Pool: TransactionPool + Clone + 'static, Provider: StateProviderFactory + Send + Sync + Clone + 'static, { - async fn send_bundle(&self, mut bundle: Bundle) -> RpcResult { + async fn send_bundle(&self, mut bundle: Bundle) -> RpcResult { let last_block_number = self .provider .best_block_number() @@ -92,6 +91,7 @@ where .await .map_err(EthApiError::from)?; - Ok(hash) + let result = BundleResult { bundle_hash: hash }; + Ok(result) } } diff --git a/crates/op-rbuilder/src/tests/framework/txs.rs b/crates/op-rbuilder/src/tests/framework/txs.rs index b4049673f..ce06ef850 100644 --- a/crates/op-rbuilder/src/tests/framework/txs.rs +++ b/crates/op-rbuilder/src/tests/framework/txs.rs @@ -1,4 +1,7 @@ -use crate::{primitives::bundle::Bundle, tx_signer::Signer}; +use crate::{ + primitives::bundle::{Bundle, BundleResult}, + tx_signer::Signer, +}; use alloy_consensus::TxEip1559; use alloy_eips::{eip2718::Encodable2718, BlockNumberOrTag}; use alloy_primitives::{hex, Bytes}; @@ -154,14 +157,14 @@ impl TransactionBuilder { block_number_max: bundle_opts.block_number_max, }; - let tx_hash = provider + let result: BundleResult = provider .client() .request("eth_sendBundle", (bundle,)) .await?; return Ok(PendingTransactionBuilder::new( provider.root().clone(), - tx_hash, + result.bundle_hash, )); }