Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(rpc-types-mev): Add support for Bundle inside BundleItem #1418

Merged
merged 2 commits into from
Oct 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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