Skip to content
This repository was archived by the owner on Mar 26, 2025. It is now read-only.

Commit d9a02b6

Browse files
committed
adds more bundle types
- adds the SignetCallBundle types and all of the response types
1 parent bff62db commit d9a02b6

File tree

2 files changed

+41
-2
lines changed

2 files changed

+41
-2
lines changed

src/bundle.rs

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
use alloy::rpc::types::mev::EthSendBundle;
21
use serde::{Deserialize, Serialize};
2+
use std::collections::BTreeMap;
3+
4+
use alloy::rpc::types::mev::{EthCallBundle, EthCallBundleResponse, EthSendBundle};
5+
use alloy_primitives::{Address, B256, U256};
36

47
use crate::SignedOrder;
58

@@ -15,3 +18,37 @@ pub struct SignetEthBundle {
1518
/// TODO: Link to docs
1619
pub host_fills: Option<SignedOrder>,
1720
}
21+
22+
/// Response for `signet_sendBundle`
23+
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
24+
#[serde(rename_all = "camelCase")]
25+
pub struct SignetEthBundleResponse {
26+
/// The bundle hash of the sent bundle.
27+
///
28+
/// This is calculated as keccak256(tx_hashes) where tx_hashes are the concatenated transaction hashes.
29+
pub bundle_hash: B256,
30+
}
31+
32+
/// Bundle of transactions for `signet_callBundle`
33+
///
34+
/// TODO: Link to docs.
35+
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
36+
#[serde(rename_all = "camelCase")]
37+
pub struct SignetCallBundle {
38+
/// The bundle of transactions to simulate. Same structure as a Flashbots [EthCallBundle] bundle.
39+
/// see <https://github.com/alloy-rs/alloy/blob/main/crates/rpc-types-mev/src/eth_calls.rs#L13-L33>
40+
#[serde(flatten)]
41+
pub bundle: EthCallBundle,
42+
/// Host fills to be applied to the bundle for simulation. The mapping corresponds
43+
/// to asset => user => amount.
44+
pub host_fills: BTreeMap<Address, BTreeMap<Address, U256>>,
45+
}
46+
47+
/// Response for `signet_callBundle`
48+
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Default)]
49+
#[serde(rename_all = "camelCase")]
50+
pub struct SignetCallBundleResponse {
51+
/// The flattened "vanilla" response which comes from `eth_callBundle`
52+
#[serde(flatten)]
53+
pub response: EthCallBundleResponse,
54+
}

src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ mod orders;
2323
pub use orders::{AggregateOrders, SignedOrder};
2424

2525
mod bundle;
26-
pub use bundle::SignetEthBundle;
26+
pub use bundle::{
27+
SignetCallBundle, SignetCallBundleResponse, SignetEthBundle, SignetEthBundleResponse,
28+
};
2729

2830
mod req;
2931
pub use req::SignRequest;

0 commit comments

Comments
 (0)