11//! RPC types that are supported by Beaverbuild
2- use alloy_primitives:: { hex , Address , BlockNumber , TxHash } ;
3- use alloy_rlp :: Decodable ;
4- use eyre :: eyre ;
5- use reth_primitives :: TransactionSigned ;
2+ use alloy_primitives:: {
3+ hex :: { self , FromHex } ,
4+ Address , BlockNumber , Bytes , TxHash ,
5+ } ;
66use serde:: ser:: { Serialize , SerializeStruct , Serializer } ;
77
88/// Bundle as recognised by Beaverbuild
@@ -12,7 +12,7 @@ use serde::ser::{Serialize, SerializeStruct, Serializer};
1212#[ derive( Clone , Debug , Default ) ]
1313pub struct BeaverBundle {
1414 /// List of hex-encoded, raw transactions. Can be empty for cancelling a bundle
15- pub transactions : Vec < TransactionSigned > ,
15+ pub transactions : Vec < Bytes > ,
1616 /// The block that this bundle will be valid for. 0 means it's valid for the next block (and only this one)
1717 pub block_number : BlockNumber ,
1818 /// If specified and >0, the bundle will only be valid if the block timestamp is greater or equal to `minTimestamp`
@@ -38,15 +38,8 @@ impl BeaverBundle {
3838 Ok ( Self {
3939 transactions : txs
4040 . iter ( )
41- . map ( |hex_string| {
42- hex:: decode ( hex_string)
43- . map_err ( |e| eyre ! ( "Invalid hexadecimal string: {e:?}" ) )
44- . and_then ( |decoded_bytes| {
45- TransactionSigned :: decode ( & mut decoded_bytes. as_slice ( ) )
46- . map_err ( |e| eyre ! ( "Illegal RLP bytes for transaction: {e:?}" ) )
47- } )
48- } )
49- . collect :: < Result < Vec < TransactionSigned > , _ > > ( ) ?,
41+ . map ( |hex_string| Bytes :: from_hex ( hex_string) )
42+ . collect :: < Result < Vec < Bytes > , _ > > ( ) ?,
5043 block_number,
5144 ..Self :: default ( )
5245 } )
@@ -59,14 +52,7 @@ impl Serialize for BeaverBundle {
5952 S : Serializer ,
6053 {
6154 let mut state = serializer. serialize_struct ( "BeaverBundle" , 2 ) ?;
62- state. serialize_field (
63- "txs" ,
64- & self
65- . transactions
66- . iter ( )
67- . map ( |tx| hex:: encode ( alloy_rlp:: encode ( tx) ) )
68- . collect :: < Vec < String > > ( ) ,
69- ) ?;
55+ state. serialize_field ( "txs" , & self . transactions ) ?;
7056 state. serialize_field ( "blockNumber" , & format ! ( "0x{:x}" , self . block_number) ) ?;
7157
7258 if let Some ( ref t) = self . min_timestamp {
0 commit comments