@@ -14,9 +14,7 @@ use serde::{Deserialize, Serialize};
14
14
use thiserror:: Error ;
15
15
16
16
#[ cfg( feature = "optimism" ) ]
17
- use super :: optimism_deposited:: {
18
- OptimismDepositedRequestError , OptimismDepositedTransactionRequest ,
19
- } ;
17
+ use super :: optimism:: { DepositTransaction , DepositTransactionError } ;
20
18
21
19
/// The TypedTransaction enum represents all Ethereum transaction types.
22
20
///
@@ -45,7 +43,7 @@ pub enum TypedTransaction {
45
43
// 0x7E
46
44
#[ cfg( feature = "optimism" ) ]
47
45
#[ serde( rename = "0x7E" ) ]
48
- OptimismDeposited ( OptimismDepositedTransactionRequest ) ,
46
+ DepositTransaction ( DepositTransaction ) ,
49
47
}
50
48
51
49
/// An error involving a typed transaction request.
@@ -63,7 +61,7 @@ pub enum TypedTransactionError {
63
61
/// When decoding a signed Optimism Deposited transaction
64
62
#[ cfg( feature = "optimism" ) ]
65
63
#[ error( transparent) ]
66
- OptimismDepositedError ( #[ from] OptimismDepositedRequestError ) ,
64
+ DepositTransactionError ( #[ from] DepositTransactionError ) ,
67
65
/// Error decoding the transaction type from the transaction's RLP encoding
68
66
#[ error( transparent) ]
69
67
TypeDecodingError ( #[ from] rlp:: DecoderError ) ,
@@ -98,7 +96,7 @@ impl TypedTransaction {
98
96
Eip2930 ( inner) => inner. tx . from . as_ref ( ) ,
99
97
Eip1559 ( inner) => inner. from . as_ref ( ) ,
100
98
#[ cfg( feature = "optimism" ) ]
101
- OptimismDeposited ( inner) => inner. tx . from . as_ref ( ) ,
99
+ DepositTransaction ( inner) => inner. tx . from . as_ref ( ) ,
102
100
}
103
101
}
104
102
@@ -108,7 +106,7 @@ impl TypedTransaction {
108
106
Eip2930 ( inner) => inner. tx . from = Some ( from) ,
109
107
Eip1559 ( inner) => inner. from = Some ( from) ,
110
108
#[ cfg( feature = "optimism" ) ]
111
- OptimismDeposited ( inner) => inner. tx . from = Some ( from) ,
109
+ DepositTransaction ( inner) => inner. tx . from = Some ( from) ,
112
110
} ;
113
111
self
114
112
}
@@ -119,7 +117,7 @@ impl TypedTransaction {
119
117
Eip2930 ( inner) => inner. tx . to . as_ref ( ) ,
120
118
Eip1559 ( inner) => inner. to . as_ref ( ) ,
121
119
#[ cfg( feature = "optimism" ) ]
122
- OptimismDeposited ( inner) => inner. tx . to . as_ref ( ) ,
120
+ DepositTransaction ( inner) => inner. tx . to . as_ref ( ) ,
123
121
}
124
122
}
125
123
@@ -134,7 +132,7 @@ impl TypedTransaction {
134
132
Eip2930 ( inner) => inner. tx . to = Some ( to) ,
135
133
Eip1559 ( inner) => inner. to = Some ( to) ,
136
134
#[ cfg( feature = "optimism" ) ]
137
- OptimismDeposited ( inner) => inner. tx . to = Some ( to) ,
135
+ DepositTransaction ( inner) => inner. tx . to = Some ( to) ,
138
136
} ;
139
137
self
140
138
}
@@ -145,7 +143,7 @@ impl TypedTransaction {
145
143
Eip2930 ( inner) => inner. tx . nonce . as_ref ( ) ,
146
144
Eip1559 ( inner) => inner. nonce . as_ref ( ) ,
147
145
#[ cfg( feature = "optimism" ) ]
148
- OptimismDeposited ( inner) => inner. tx . nonce . as_ref ( ) ,
146
+ DepositTransaction ( inner) => inner. tx . nonce . as_ref ( ) ,
149
147
}
150
148
}
151
149
@@ -156,7 +154,7 @@ impl TypedTransaction {
156
154
Eip2930 ( inner) => inner. tx . nonce = Some ( nonce) ,
157
155
Eip1559 ( inner) => inner. nonce = Some ( nonce) ,
158
156
#[ cfg( feature = "optimism" ) ]
159
- OptimismDeposited ( inner) => inner. tx . nonce = Some ( nonce) ,
157
+ DepositTransaction ( inner) => inner. tx . nonce = Some ( nonce) ,
160
158
} ;
161
159
self
162
160
}
@@ -167,7 +165,7 @@ impl TypedTransaction {
167
165
Eip2930 ( inner) => inner. tx . value . as_ref ( ) ,
168
166
Eip1559 ( inner) => inner. value . as_ref ( ) ,
169
167
#[ cfg( feature = "optimism" ) ]
170
- OptimismDeposited ( inner) => inner. tx . value . as_ref ( ) ,
168
+ DepositTransaction ( inner) => inner. tx . value . as_ref ( ) ,
171
169
}
172
170
}
173
171
@@ -178,7 +176,7 @@ impl TypedTransaction {
178
176
Eip2930 ( inner) => inner. tx . value = Some ( value) ,
179
177
Eip1559 ( inner) => inner. value = Some ( value) ,
180
178
#[ cfg( feature = "optimism" ) ]
181
- OptimismDeposited ( inner) => inner. tx . value = Some ( value) ,
179
+ DepositTransaction ( inner) => inner. tx . value = Some ( value) ,
182
180
} ;
183
181
self
184
182
}
@@ -189,7 +187,7 @@ impl TypedTransaction {
189
187
Eip2930 ( inner) => inner. tx . gas . as_ref ( ) ,
190
188
Eip1559 ( inner) => inner. gas . as_ref ( ) ,
191
189
#[ cfg( feature = "optimism" ) ]
192
- OptimismDeposited ( inner) => inner. tx . gas . as_ref ( ) ,
190
+ DepositTransaction ( inner) => inner. tx . gas . as_ref ( ) ,
193
191
}
194
192
}
195
193
@@ -199,7 +197,7 @@ impl TypedTransaction {
199
197
Eip2930 ( inner) => & mut inner. tx . gas ,
200
198
Eip1559 ( inner) => & mut inner. gas ,
201
199
#[ cfg( feature = "optimism" ) ]
202
- OptimismDeposited ( inner) => & mut inner. tx . gas ,
200
+ DepositTransaction ( inner) => & mut inner. tx . gas ,
203
201
}
204
202
}
205
203
@@ -210,7 +208,7 @@ impl TypedTransaction {
210
208
Eip2930 ( inner) => inner. tx . gas = Some ( gas) ,
211
209
Eip1559 ( inner) => inner. gas = Some ( gas) ,
212
210
#[ cfg( feature = "optimism" ) ]
213
- OptimismDeposited ( inner) => inner. tx . gas = Some ( gas) ,
211
+ DepositTransaction ( inner) => inner. tx . gas = Some ( gas) ,
214
212
} ;
215
213
self
216
214
}
@@ -228,7 +226,7 @@ impl TypedTransaction {
228
226
}
229
227
}
230
228
#[ cfg( feature = "optimism" ) ]
231
- OptimismDeposited ( inner) => inner. tx . gas_price ,
229
+ DepositTransaction ( inner) => inner. tx . gas_price ,
232
230
}
233
231
}
234
232
@@ -242,7 +240,7 @@ impl TypedTransaction {
242
240
inner. max_priority_fee_per_gas = Some ( gas_price) ;
243
241
}
244
242
#[ cfg( feature = "optimism" ) ]
245
- OptimismDeposited ( inner) => inner. tx . gas_price = Some ( gas_price) ,
243
+ DepositTransaction ( inner) => inner. tx . gas_price = Some ( gas_price) ,
246
244
} ;
247
245
self
248
246
}
@@ -253,7 +251,7 @@ impl TypedTransaction {
253
251
Eip2930 ( inner) => inner. tx . chain_id ,
254
252
Eip1559 ( inner) => inner. chain_id ,
255
253
#[ cfg( feature = "optimism" ) ]
256
- OptimismDeposited ( inner) => inner. tx . chain_id ,
254
+ DepositTransaction ( inner) => inner. tx . chain_id ,
257
255
}
258
256
}
259
257
@@ -264,7 +262,7 @@ impl TypedTransaction {
264
262
Eip2930 ( inner) => inner. tx . chain_id = Some ( chain_id) ,
265
263
Eip1559 ( inner) => inner. chain_id = Some ( chain_id) ,
266
264
#[ cfg( feature = "optimism" ) ]
267
- OptimismDeposited ( inner) => inner. tx . chain_id = Some ( chain_id) ,
265
+ DepositTransaction ( inner) => inner. tx . chain_id = Some ( chain_id) ,
268
266
} ;
269
267
self
270
268
}
@@ -275,7 +273,7 @@ impl TypedTransaction {
275
273
Eip2930 ( inner) => inner. tx . data . as_ref ( ) ,
276
274
Eip1559 ( inner) => inner. data . as_ref ( ) ,
277
275
#[ cfg( feature = "optimism" ) ]
278
- OptimismDeposited ( inner) => inner. tx . data . as_ref ( ) ,
276
+ DepositTransaction ( inner) => inner. tx . data . as_ref ( ) ,
279
277
}
280
278
}
281
279
@@ -285,7 +283,7 @@ impl TypedTransaction {
285
283
Eip2930 ( inner) => Some ( & inner. access_list ) ,
286
284
Eip1559 ( inner) => Some ( & inner. access_list ) ,
287
285
#[ cfg( feature = "optimism" ) ]
288
- OptimismDeposited ( _) => None ,
286
+ DepositTransaction ( _) => None ,
289
287
}
290
288
}
291
289
@@ -295,7 +293,7 @@ impl TypedTransaction {
295
293
Eip2930 ( inner) => inner. access_list = access_list,
296
294
Eip1559 ( inner) => inner. access_list = access_list,
297
295
#[ cfg( feature = "optimism" ) ]
298
- OptimismDeposited ( _) => { }
296
+ DepositTransaction ( _) => { }
299
297
} ;
300
298
self
301
299
}
@@ -306,7 +304,7 @@ impl TypedTransaction {
306
304
Eip2930 ( inner) => inner. tx . data = Some ( data) ,
307
305
Eip1559 ( inner) => inner. data = Some ( data) ,
308
306
#[ cfg( feature = "optimism" ) ]
309
- OptimismDeposited ( inner) => inner. tx . data = Some ( data) ,
307
+ DepositTransaction ( inner) => inner. tx . data = Some ( data) ,
310
308
} ;
311
309
self
312
310
}
@@ -326,7 +324,7 @@ impl TypedTransaction {
326
324
encoded. extend_from_slice ( inner. rlp_signed ( signature) . as_ref ( ) ) ;
327
325
}
328
326
#[ cfg( feature = "optimism" ) ]
329
- OptimismDeposited ( inner) => {
327
+ DepositTransaction ( inner) => {
330
328
encoded. extend_from_slice ( & [ 0x7E ] ) ;
331
329
encoded. extend_from_slice ( inner. rlp ( ) . as_ref ( ) ) ;
332
330
}
@@ -349,7 +347,7 @@ impl TypedTransaction {
349
347
encoded. extend_from_slice ( inner. rlp ( ) . as_ref ( ) ) ;
350
348
}
351
349
#[ cfg( feature = "optimism" ) ]
352
- OptimismDeposited ( inner) => {
350
+ DepositTransaction ( inner) => {
353
351
encoded. extend_from_slice ( & [ 0x7E ] ) ;
354
352
encoded. extend_from_slice ( inner. rlp ( ) . as_ref ( ) ) ;
355
353
}
@@ -407,8 +405,8 @@ impl TypedTransaction {
407
405
#[ cfg( feature = "optimism" ) ]
408
406
if first == 0x7E {
409
407
// Optimism Deposited (0x7E)
410
- let decoded_request = OptimismDepositedTransactionRequest :: decode_signed_rlp ( & rest) ?;
411
- return Ok ( ( Self :: OptimismDeposited ( decoded_request. 0 ) , decoded_request. 1 ) )
408
+ let decoded_request = DepositTransaction :: decode_signed_rlp ( & rest) ?;
409
+ return Ok ( ( Self :: DepositTransaction ( decoded_request. 0 ) , decoded_request. 1 ) )
412
410
}
413
411
414
412
Err ( rlp:: DecoderError :: Custom ( "invalid tx type" ) . into ( ) )
@@ -438,7 +436,7 @@ impl Decodable for TypedTransaction {
438
436
#[ cfg( feature = "optimism" ) ]
439
437
Some ( x) if x == U64 :: from ( 0x7E ) => {
440
438
// Optimism Deposited (0x7E)
441
- Ok ( Self :: OptimismDeposited ( OptimismDepositedTransactionRequest :: decode ( & rest) ?) )
439
+ Ok ( Self :: DepositTransaction ( DepositTransaction :: decode ( & rest) ?) )
442
440
}
443
441
_ => {
444
442
// Legacy (0x00)
@@ -468,9 +466,9 @@ impl From<Eip1559TransactionRequest> for TypedTransaction {
468
466
}
469
467
470
468
#[ cfg( feature = "optimism" ) ]
471
- impl From < OptimismDepositedTransactionRequest > for TypedTransaction {
472
- fn from ( src : OptimismDepositedTransactionRequest ) -> TypedTransaction {
473
- TypedTransaction :: OptimismDeposited ( src)
469
+ impl From < DepositTransaction > for TypedTransaction {
470
+ fn from ( src : DepositTransaction ) -> TypedTransaction {
471
+ TypedTransaction :: DepositTransaction ( src)
474
472
}
475
473
}
476
474
@@ -490,7 +488,7 @@ impl From<&Transaction> for TypedTransaction {
490
488
#[ cfg( feature = "optimism" ) ]
491
489
// Optimism Deposited (0x7E)
492
490
Some ( x) if x == U64 :: from ( 0x7E ) => {
493
- let request: OptimismDepositedTransactionRequest = tx. into ( ) ;
491
+ let request: DepositTransaction = tx. into ( ) ;
494
492
request. into ( )
495
493
}
496
494
// Legacy (0x00)
@@ -522,9 +520,9 @@ impl TypedTransaction {
522
520
}
523
521
}
524
522
#[ cfg( feature = "optimism" ) ]
525
- pub fn as_optimism_deposited_ref ( & self ) -> Option < & OptimismDepositedTransactionRequest > {
523
+ pub fn as_optimism_deposited_ref ( & self ) -> Option < & DepositTransaction > {
526
524
match self {
527
- OptimismDeposited ( tx) => Some ( tx) ,
525
+ DepositTransaction ( tx) => Some ( tx) ,
528
526
_ => None ,
529
527
}
530
528
}
@@ -548,11 +546,9 @@ impl TypedTransaction {
548
546
}
549
547
}
550
548
#[ cfg( feature = "optimism" ) ]
551
- pub fn as_optimism_deposited_mut (
552
- & mut self ,
553
- ) -> Option < & mut OptimismDepositedTransactionRequest > {
549
+ pub fn as_optimism_deposited_mut ( & mut self ) -> Option < & mut DepositTransaction > {
554
550
match self {
555
- OptimismDeposited ( tx) => Some ( tx) ,
551
+ DepositTransaction ( tx) => Some ( tx) ,
556
552
_ => None ,
557
553
}
558
554
}
@@ -608,7 +604,7 @@ impl TypedTransaction {
608
604
gateway_fee : None ,
609
605
} ,
610
606
#[ cfg( feature = "optimism" ) ]
611
- OptimismDeposited ( tx) => tx. tx ,
607
+ DepositTransaction ( tx) => tx. tx ,
612
608
}
613
609
}
614
610
}
@@ -649,7 +645,7 @@ impl TypedTransaction {
649
645
access_list,
650
646
} ,
651
647
#[ cfg( feature = "optimism" ) ]
652
- OptimismDeposited ( tx) => Eip2930TransactionRequest { tx : tx. tx , access_list } ,
648
+ DepositTransaction ( tx) => Eip2930TransactionRequest { tx : tx. tx , access_list } ,
653
649
}
654
650
}
655
651
}
0 commit comments