You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: searcher-api-types/src/beaver.rs
+34-97Lines changed: 34 additions & 97 deletions
Original file line number
Diff line number
Diff line change
@@ -1,112 +1,43 @@
1
1
//! RPC types that are supported by Beaverbuild
2
2
use alloy_primitives::{hex::FromHex,Address,BlockNumber,Bytes,TxHash};
3
-
use serde::ser::{Serialize,SerializeStruct,Serializer};
3
+
use alloy_rpc_types_mev::EthSendBundle;
4
+
use serde::Serialize;
5
+
use serde_with::{serde_as, skip_serializing_none};
4
6
5
7
/// Bundle as recognised by Beaverbuild
6
8
///
7
9
/// Consult <https://beaverbuild.org/docs.html>. Note that the deprecated `replacementUuid` field
8
10
/// has been omitted.
9
-
#[derive(Clone,Debug,Default)]
11
+
#[serde_as]
12
+
#[skip_serializing_none]
13
+
#[derive(Clone,Debug,Default,Serialize)]
10
14
pubstructBeaverBundle{
11
-
/// List of hex-encoded, raw transactions. Can be empty for cancelling a bundle
12
-
pubtransactions:Vec<Bytes>,
13
-
/// The block that this bundle will be valid for. 0 means it's valid for the next block (and only this one)
14
-
pubblock_number:BlockNumber,
15
-
/// If specified and >0, the bundle will only be valid if the block timestamp is greater or equal to `minTimestamp`
16
-
pubmin_timestamp:Option<u64>,
17
-
/// If specified and >0, the bundle will only be valid if the block timestamp is smaller or equal to `maxTimestamp`
18
-
pubmax_timestamp:Option<u64>,
19
-
/// 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
20
-
pubreverting_transaction_hashes:Vec<TxHash>,
15
+
#[serde(flatten)]
16
+
pubbundle:EthSendBundle,
17
+
#[serde(skip_serializing_if = "Vec::is_empty")]
21
18
/// 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)
22
19
pubdropping_transaction_hashes:Vec<TxHash>,
23
-
/// 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)
24
-
pubuuid:Option<String>,
25
20
/// 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.
26
21
pubrefund_percent:Option<u64>,
27
22
/// 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
28
23
pubrefund_recipient:Option<Address>,
24
+
#[serde(skip_serializing_if = "Vec::is_empty")]
29
25
/// The hashes of transactions in the bundle that the refund will be based on. If it's empty, we'll use the last transaction
let empty_bundle = SendBundleRequest::Beaver(BeaverBundle{
31
-
transactions:vec![],
32
-
block_number:0,
32
+
bundle:EthSendBundle{
33
+
txs:vec![],
34
+
block_number:0,
35
+
..EthSendBundle::default()
36
+
},
33
37
..BeaverBundle::default()
34
38
});
35
39
let res = send_bundle(test_endpoint(),&empty_bundle).await;
@@ -38,7 +42,9 @@ mod test {
38
42
39
43
#[tokio::test]
40
44
asyncfntest_send_bundle_beaver_success(){
41
-
let bundle = SendBundleRequest::Beaver(BeaverBundle::from_rlp_hex(vec!["0x02f8b20181948449bdee618501dcd6500083016b93942dabcea55a12d73191aece59f508b191fb68adac80b844095ea7b300000000000000000000000054e44dbb92dba848ace27f44c0cb4268981ef1cc00000000000000000000000000000000000000000000000052616e065f6915ebc080a0c497b6e53d7cb78e68c37f6186c8bb9e1b8a55c3e22462163495979b25c2caafa052769811779f438b73159c4cc6a05a889da8c1a16e432c2e37e3415c9a0b9887".to_string()],1).expect("illegal RLP bytes for bundle"));
45
+
let bundle = SendBundleRequest::Beaver(
46
+
BeaverBundle{bundle:bundle_from_rlp_hex(vec!["0x02f8b20181948449bdee618501dcd6500083016b93942dabcea55a12d73191aece59f508b191fb68adac80b844095ea7b300000000000000000000000054e44dbb92dba848ace27f44c0cb4268981ef1cc00000000000000000000000000000000000000000000000052616e065f6915ebc080a0c497b6e53d7cb78e68c37f6186c8bb9e1b8a55c3e22462163495979b25c2caafa052769811779f438b73159c4cc6a05a889da8c1a16e432c2e37e3415c9a0b9887".to_string()],1).expect("illegal RLP bytes for bundle"), ..BeaverBundle::default()}
47
+
);
42
48
let res = send_bundle(test_endpoint(),&bundle).await;
0 commit comments