Skip to content

Commit b88837b

Browse files
committed
Initial bundle types
1 parent 56f0e60 commit b88837b

File tree

6 files changed

+68
-0
lines changed

6 files changed

+68
-0
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ members = [
99
"relay-api-types",
1010
"relay-client",
1111
"relay-server",
12+
"searcher-api-types",
1213
"common"
1314
]
1415

searcher-api-types/Cargo.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[package]
2+
name = "searcher-api-types"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[dependencies]
7+
serde = { workspace = true }
8+
9+
serde_with = "3.0.0"
10+
alloy-primitives = "0.8"
11+
alloy-rpc-types-mev = "0.8"
12+
alloy-serde = "0.8"
13+
reth-primitives = { git = "https://github.com/paradigmxyz/reth", rev = "1e965caf5fa176f244a31c0d2662ba1b590938db" } # Reth 1.2

searcher-api-types/src/beaver.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//! RPC types that are supported by Beaverbuild
2+
use alloy_primitives::{Address, BlockNumber, TxHash};
3+
use reth_primitives::TransactionSigned;
4+
use serde::{Deserialize, Serialize};
5+
use serde_with::{serde_as, skip_serializing_none};
6+
7+
/// Bundle as recognised by Beaverbuild
8+
///
9+
/// Consult <https://beaverbuild.org/docs.html>. Note that the deprecated `replacementUuid` field
10+
/// has been omitted.
11+
#[skip_serializing_none]
12+
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
13+
#[serde(rename_all = "camelCase")]
14+
#[serde_as]
15+
pub struct BeaverBundle {
16+
/// List of hex-encoded, raw transactions. Can be empty for cancelling a bundle
17+
#[serde(rename = "txs")]
18+
pub transactions: Vec<TransactionSigned>,
19+
/// The block that this bundle will be valid for. 0 means it's valid for the next block (and only this one)
20+
#[serde(with = "alloy_serde::quantity")]
21+
pub block_number: BlockNumber,
22+
/// If specified and >0, the bundle will only be valid if the block timestamp is greater or equal to `minTimestamp`
23+
pub min_timestamp: Option<u64>,
24+
/// If specified and >0, the bundle will only be valid if the block timestamp is smaller or equal to `maxTimestamp`
25+
pub max_timestamp: Option<u64>,
26+
/// A list of transaction hashes contained in the bundle, that can be allowed to revert, or be removed from your bundle if it's deemed useful
27+
#[serde(skip_serializing_if = "Vec::is_empty")]
28+
pub reverting_transaction_hashes: Vec<TxHash>,
29+
/// A list of transaction hashes contained in the bundle, that can be allowed to be removed from your bundle if it's deemed useful (but not revert)
30+
#[serde(skip_serializing_if = "Vec::is_empty")]
31+
pub dropping_transaction_hashes: Vec<TxHash>,
32+
/// An UUID string, which allows you to update/cancel your bundles: if you specify an uuid and we already have a bundle with an identical one, we'll forget about the old bundle. So we can only have a single bundle with a certain `uuid` at all times (and we keep the most recent)
33+
pub uuid: Option<String>,
34+
/// An integer between 1-99. How much of the total priority fee + coinbase payment you want to be refunded for. This will negatively impact your prioritization because this refund is gonna eat into your bundle payment. Example: if a bundle pays 0.2 ETH of priority fee plus 1 ETH to coinbase, a refundPercent set to 50 will result in a transaction being appended after the bundle, paying 0.59 ETH back to the EOA. This is assuming the payout tx will cost beaver 0.01 ETH in fees, which are deduced from the 0.6 ETH payout.
35+
pub refund_percent: Option<u64>,
36+
/// You can specify an address that the funds from `refundPercent` will be sent to. If not specified, they will be sent to the `from` address of the first transaction
37+
pub refund_recipient: Option<Address>,
38+
/// The hashes of transactions in the bundle that the refund will be based on. If it's empty, we'll use the last transaction
39+
#[serde(skip_serializing_if = "Vec::is_empty")]
40+
pub refund_transaction_hashes: Vec<TxHash>,
41+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
use alloy_rpc_types_mev::EthSendBundle;
2+
3+
pub type FlashbotsBundle = EthSendBundle;

searcher-api-types/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
pub mod beaver;
2+
pub mod flashbots;
3+
pub mod titan;
4+
5+
pub use beaver::*;
6+
pub use flashbots::*;
7+
pub use titan::*;

searcher-api-types/src/titan.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
use crate::beaver::BeaverBundle;
2+
3+
pub type TitanBundle = BeaverBundle;

0 commit comments

Comments
 (0)