@@ -21,34 +21,24 @@ pub struct ZenithEthBundle {
21
21
pub host_fills : Option < SignedOrder > ,
22
22
}
23
23
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
-
34
24
impl ZenithEthBundle {
35
25
/// Returns the transactions in this bundle.
36
26
pub fn txs ( & self ) -> & [ Bytes ] {
37
27
& self . bundle . txs
38
28
}
39
29
40
30
/// Returns the block number for this bundle.
41
- pub fn block_number ( & self ) -> u64 {
31
+ pub const fn block_number ( & self ) -> u64 {
42
32
self . bundle . block_number
43
33
}
44
34
45
35
/// Returns the minimum timestamp for this bundle.
46
- pub fn min_timestamp ( & self ) -> Option < u64 > {
36
+ pub const fn min_timestamp ( & self ) -> Option < u64 > {
47
37
self . bundle . min_timestamp
48
38
}
49
39
50
40
/// Returns the maximum timestamp for this bundle.
51
- pub fn max_timestamp ( & self ) -> Option < u64 > {
41
+ pub const fn max_timestamp ( & self ) -> Option < u64 > {
52
42
self . bundle . max_timestamp
53
43
}
54
44
@@ -63,6 +53,16 @@ impl ZenithEthBundle {
63
53
}
64
54
}
65
55
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
+
66
66
/// Bundle of transactions for `zenith_callBundle`
67
67
#[ derive( Debug , Clone , PartialEq , Eq , Serialize , Deserialize ) ]
68
68
#[ serde( rename_all = "camelCase" ) ]
@@ -76,18 +76,9 @@ pub struct ZenithCallBundle {
76
76
pub host_fills : BTreeMap < Address , BTreeMap < Address , U256 > > ,
77
77
}
78
78
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
-
88
79
impl ZenithCallBundle {
89
80
/// 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 > > {
91
82
& self . host_fills
92
83
}
93
84
@@ -97,32 +88,32 @@ impl ZenithCallBundle {
97
88
}
98
89
99
90
/// Returns the block number for this bundle.
100
- pub fn block_number ( & self ) -> u64 {
91
+ pub const fn block_number ( & self ) -> u64 {
101
92
self . bundle . block_number
102
93
}
103
94
104
95
/// 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 {
106
97
self . bundle . state_block_number
107
98
}
108
99
109
100
/// Returns the timestamp for this bundle.
110
- pub fn timestamp ( & self ) -> Option < u64 > {
101
+ pub const fn timestamp ( & self ) -> Option < u64 > {
111
102
self . bundle . timestamp
112
103
}
113
104
114
105
/// Returns the gas limit for this bundle.
115
- pub fn gas_limit ( & self ) -> Option < u64 > {
106
+ pub const fn gas_limit ( & self ) -> Option < u64 > {
116
107
self . bundle . gas_limit
117
108
}
118
109
119
110
/// Returns the difficulty for this bundle.
120
- pub fn difficulty ( & self ) -> Option < U256 > {
111
+ pub const fn difficulty ( & self ) -> Option < U256 > {
121
112
self . bundle . difficulty
122
113
}
123
114
124
115
/// Returns the base fee for this bundle.
125
- pub fn base_fee ( & self ) -> Option < u128 > {
116
+ pub const fn base_fee ( & self ) -> Option < u128 > {
126
117
self . bundle . base_fee
127
118
}
128
119
@@ -230,7 +221,7 @@ impl ZenithCallBundle {
230
221
/// The tx_preimage is calculated as `keccak(tx_hash1 + tx_hash2 + ... + tx_hashn)`.
231
222
/// The host_preimage is calculated as
232
223
/// `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.
234
225
pub fn bundle_hash ( & self ) -> B256 {
235
226
let mut hasher = alloy_primitives:: Keccak256 :: new ( ) ;
236
227
@@ -277,3 +268,12 @@ impl ZenithCallBundle {
277
268
pre_image. finalize ( )
278
269
}
279
270
}
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