From 172ceb7d2311130e8c55748a33544b5b5ada1d31 Mon Sep 17 00:00:00 2001 From: Skanda Bhat Date: Wed, 2 Oct 2024 21:43:34 +0530 Subject: [PATCH] feat(rpc-types-mev): Add support for `Bundle` inside `BundleItem` (#1418) * feat(rpc-types-mev): Add support for `Bundle` inside `BundleItem` * chore: fmt --------- Co-authored-by: Matthias Seitz --- crates/rpc-types-mev/src/mev_calls.rs | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/crates/rpc-types-mev/src/mev_calls.rs b/crates/rpc-types-mev/src/mev_calls.rs index ea4b3950751..688970f0196 100644 --- a/crates/rpc-types-mev/src/mev_calls.rs +++ b/crates/rpc-types-mev/src/mev_calls.rs @@ -94,6 +94,12 @@ pub enum BundleItem { /// If true, the transaction can revert without the bundle being considered invalid. can_revert: bool, }, + /// A nested bundle request. + #[serde(rename_all = "camelCase")] + Bundle { + /// A bundle request of type SendBundleRequest + bundle: SendBundleRequest, + }, } /// Optional fields to override simulation state. @@ -280,6 +286,32 @@ mod tests { assert_eq!(bundle, expected[0]); } + #[test] + fn can_deserialize_nested_bundle_request() { + let str = r#" + [{ + "version": "v0.1", + "inclusion": { + "block": "0x1" + }, + "body": [{ + "bundle": { + "version": "v0.1", + "inclusion": { + "block": "0x1" + }, + "body": [{ + "tx": "0x02f86b0180843b9aca00852ecc889a0082520894c87037874aed04e51c29f582394217a0a2b89d808080c080a0a463985c616dd8ee17d7ef9112af4e6e06a27b071525b42182fe7b0b5c8b4925a00af5ca177ffef2ff28449292505d41be578bebb77110dfc09361d2fb56998260", + "canRevert": false + }] + } + }] + }] + "#; + let res: Result, _> = serde_json::from_str(str); + assert!(res.is_ok()); + } + #[test] fn can_serialize_privacy_hint() { let hint = PrivacyHint {