@@ -21,34 +21,24 @@ pub struct ZenithEthBundle {
2121 pub host_fills : Option < SignedOrder > ,
2222}
2323
24- /// Response for `zenith_sendBundle`
25- #[ derive( Debug , Clone , Copy , PartialEq , Eq , Serialize , Deserialize ) ]
26- #[ serde( rename_all = "camelCase" ) ]
27- pub struct ZenithEthBundleResponse {
28- /// The bundle hash of the sent bundle.
29- ///
30- /// This is calculated as keccak256(tx_hashes) where tx_hashes are the concatenated transaction hashes.
31- pub bundle_hash : B256 ,
32- }
33-
3424impl ZenithEthBundle {
3525 /// Returns the transactions in this bundle.
3626 pub fn txs ( & self ) -> & [ Bytes ] {
3727 & self . bundle . txs
3828 }
3929
4030 /// Returns the block number for this bundle.
41- pub fn block_number ( & self ) -> u64 {
31+ pub const fn block_number ( & self ) -> u64 {
4232 self . bundle . block_number
4333 }
4434
4535 /// Returns the minimum timestamp for this bundle.
46- pub fn min_timestamp ( & self ) -> Option < u64 > {
36+ pub const fn min_timestamp ( & self ) -> Option < u64 > {
4737 self . bundle . min_timestamp
4838 }
4939
5040 /// Returns the maximum timestamp for this bundle.
51- pub fn max_timestamp ( & self ) -> Option < u64 > {
41+ pub const fn max_timestamp ( & self ) -> Option < u64 > {
5242 self . bundle . max_timestamp
5343 }
5444
@@ -63,6 +53,16 @@ impl ZenithEthBundle {
6353 }
6454}
6555
56+ /// Response for `zenith_sendBundle`
57+ #[ derive( Debug , Clone , Copy , PartialEq , Eq , Serialize , Deserialize ) ]
58+ #[ serde( rename_all = "camelCase" ) ]
59+ pub struct ZenithEthBundleResponse {
60+ /// The bundle hash of the sent bundle.
61+ ///
62+ /// This is calculated as keccak256(tx_hashes) where tx_hashes are the concatenated transaction hashes.
63+ pub bundle_hash : B256 ,
64+ }
65+
6666/// Bundle of transactions for `zenith_callBundle`
6767#[ derive( Debug , Clone , PartialEq , Eq , Serialize , Deserialize ) ]
6868#[ serde( rename_all = "camelCase" ) ]
@@ -76,18 +76,9 @@ pub struct ZenithCallBundle {
7676 pub host_fills : BTreeMap < Address , BTreeMap < Address , U256 > > ,
7777}
7878
79- /// Response for `zenith_callBundle`
80- #[ derive( Debug , Clone , PartialEq , Eq , Serialize , Deserialize , Default ) ]
81- #[ serde( rename_all = "camelCase" ) ]
82- pub struct ZenithCallBundleResponse {
83- /// The flattened "vanilla" response which comes from `eth_callBundle`
84- #[ serde( flatten) ]
85- pub response : EthCallBundleResponse ,
86- }
87-
8879impl ZenithCallBundle {
8980 /// Returns the host fills for this bundle.
90- pub fn host_fills ( & self ) -> & BTreeMap < Address , BTreeMap < Address , U256 > > {
81+ pub const fn host_fills ( & self ) -> & BTreeMap < Address , BTreeMap < Address , U256 > > {
9182 & self . host_fills
9283 }
9384
@@ -97,32 +88,32 @@ impl ZenithCallBundle {
9788 }
9889
9990 /// Returns the block number for this bundle.
100- pub fn block_number ( & self ) -> u64 {
91+ pub const fn block_number ( & self ) -> u64 {
10192 self . bundle . block_number
10293 }
10394
10495 /// Returns the state block number for this bundle.
105- pub fn state_block_number ( & self ) -> BlockNumberOrTag {
96+ pub const fn state_block_number ( & self ) -> BlockNumberOrTag {
10697 self . bundle . state_block_number
10798 }
10899
109100 /// Returns the timestamp for this bundle.
110- pub fn timestamp ( & self ) -> Option < u64 > {
101+ pub const fn timestamp ( & self ) -> Option < u64 > {
111102 self . bundle . timestamp
112103 }
113104
114105 /// Returns the gas limit for this bundle.
115- pub fn gas_limit ( & self ) -> Option < u64 > {
106+ pub const fn gas_limit ( & self ) -> Option < u64 > {
116107 self . bundle . gas_limit
117108 }
118109
119110 /// Returns the difficulty for this bundle.
120- pub fn difficulty ( & self ) -> Option < U256 > {
111+ pub const fn difficulty ( & self ) -> Option < U256 > {
121112 self . bundle . difficulty
122113 }
123114
124115 /// Returns the base fee for this bundle.
125- pub fn base_fee ( & self ) -> Option < u128 > {
116+ pub const fn base_fee ( & self ) -> Option < u128 > {
126117 self . bundle . base_fee
127118 }
128119
@@ -230,7 +221,7 @@ impl ZenithCallBundle {
230221 /// The tx_preimage is calculated as `keccak(tx_hash1 + tx_hash2 + ... + tx_hashn)`.
231222 /// The host_preimage is calculated as
232223 /// `keccak(NUM_OF_ASSETS_LE + asset1 + NUM_OF_FILLS_LE + asset1_user1 + user1_amount2 + ... + asset1_usern + asset1_amountn + ...)`.
233- /// For the number of users/fills and amounts amounts in the host_preimage, the amounts are serialized as little-endian U256 slice.
224+ /// For the number of users/fills and amounts in the host_preimage, the amounts are serialized as little-endian U256 slice.
234225 pub fn bundle_hash ( & self ) -> B256 {
235226 let mut hasher = alloy_primitives:: Keccak256 :: new ( ) ;
236227
@@ -277,3 +268,12 @@ impl ZenithCallBundle {
277268 pre_image. finalize ( )
278269 }
279270}
271+
272+ /// Response for `zenith_callBundle`
273+ #[ derive( Debug , Clone , PartialEq , Eq , Serialize , Deserialize , Default ) ]
274+ #[ serde( rename_all = "camelCase" ) ]
275+ pub struct ZenithCallBundleResponse {
276+ /// The flattened "vanilla" response which comes from `eth_callBundle`
277+ #[ serde( flatten) ]
278+ pub response : EthCallBundleResponse ,
279+ }
0 commit comments