Skip to content

Commit

Permalink
feat(rpc-types-mev): Add support for Bundle inside BundleItem (#1418
Browse files Browse the repository at this point in the history
)

* feat(rpc-types-mev): Add support for `Bundle` inside `BundleItem`

* chore: fmt

---------

Co-authored-by: Matthias Seitz <[email protected]>
  • Loading branch information
SkandaBhat and mattsse authored Oct 2, 2024
1 parent 8d99c28 commit 172ceb7
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions crates/rpc-types-mev/src/mev_calls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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<Vec<SendBundleRequest>, _> = serde_json::from_str(str);
assert!(res.is_ok());
}

#[test]
fn can_serialize_privacy_hint() {
let hint = PrivacyHint {
Expand Down

0 comments on commit 172ceb7

Please sign in to comment.