diff --git a/src/bundle.rs b/src/bundle.rs index e6ca824..f12f206 100644 --- a/src/bundle.rs +++ b/src/bundle.rs @@ -1,5 +1,8 @@ -use alloy::rpc::types::mev::EthSendBundle; use serde::{Deserialize, Serialize}; +use std::collections::BTreeMap; + +use alloy::rpc::types::mev::{EthCallBundle, EthCallBundleResponse, EthSendBundle}; +use alloy_primitives::{Address, B256, U256}; use crate::SignedOrder; @@ -15,3 +18,37 @@ pub struct SignetEthBundle { /// TODO: Link to docs pub host_fills: Option, } + +/// Response for `signet_sendBundle` +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SignetEthBundleResponse { + /// The bundle hash of the sent bundle. + /// + /// This is calculated as keccak256(tx_hashes) where tx_hashes are the concatenated transaction hashes. + pub bundle_hash: B256, +} + +/// Bundle of transactions for `signet_callBundle` +/// +/// TODO: Link to docs. +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SignetCallBundle { + /// The bundle of transactions to simulate. Same structure as a Flashbots [EthCallBundle] bundle. + /// see + #[serde(flatten)] + pub bundle: EthCallBundle, + /// Host fills to be applied to the bundle for simulation. The mapping corresponds + /// to asset => user => amount. + pub host_fills: BTreeMap>, +} + +/// Response for `signet_callBundle` +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Default)] +#[serde(rename_all = "camelCase")] +pub struct SignetCallBundleResponse { + /// The flattened "vanilla" response which comes from `eth_callBundle` + #[serde(flatten)] + pub response: EthCallBundleResponse, +} diff --git a/src/lib.rs b/src/lib.rs index cb52f34..18fe3c4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -23,7 +23,9 @@ mod orders; pub use orders::{AggregateOrders, SignedOrder}; mod bundle; -pub use bundle::SignetEthBundle; +pub use bundle::{ + SignetCallBundle, SignetCallBundleResponse, SignetEthBundle, SignetEthBundleResponse, +}; mod req; pub use req::SignRequest;