@@ -2,6 +2,7 @@ use alloy::primitives::{Address, TxHash};
2
2
use alloy:: providers:: Provider ;
3
3
use alloy:: rpc:: types:: TransactionReceipt ;
4
4
use engine_core:: error:: { AlloyRpcErrorToEngineError , EngineError } ;
5
+ use engine_core:: rpc_clients:: TwGetTransactionHashResponse ;
5
6
use engine_core:: {
6
7
chain:: { Chain , ChainService , RpcCredentials } ,
7
8
execution_options:: WebhookOptions ,
@@ -31,11 +32,7 @@ pub struct Eip7702ConfirmationJobData {
31
32
pub transaction_id : String ,
32
33
pub chain_id : u64 ,
33
34
pub bundler_transaction_id : String ,
34
- /// ! Deprecated todo: remove this field after all jobs are processed
35
- pub eoa_address : Option < Address > ,
36
-
37
- // TODO: make non-optional after all jobs are processed
38
- pub sender_details : Option < Eip7702Sender > ,
35
+ pub sender_details : Eip7702Sender ,
39
36
40
37
pub rpc_credentials : RpcCredentials ,
41
38
#[ serde( default ) ]
@@ -189,7 +186,7 @@ where
189
186
let chain = chain. with_new_default_headers ( chain_auth_headers) ;
190
187
191
188
// 2. Get transaction hash from bundler
192
- let transaction_hash_str = chain
189
+ let transaction_hash_res = chain
193
190
. bundler_client ( )
194
191
. tw_get_transaction_hash ( & job_data. bundler_transaction_id )
195
192
. await
@@ -198,16 +195,19 @@ where
198
195
} )
199
196
. map_err_fail ( ) ?;
200
197
201
- let transaction_hash = match transaction_hash_str {
202
- Some ( hash) => hash. parse :: < TxHash > ( ) . map_err ( |e| {
203
- Eip7702ConfirmationError :: TransactionHashError {
204
- message : format ! ( "Invalid transaction hash format: {}" , e) ,
205
- }
206
- . fail ( )
207
- } ) ?,
208
- None => {
198
+ let transaction_hash = match transaction_hash_res {
199
+ TwGetTransactionHashResponse :: Success { transaction_hash } => {
200
+ transaction_hash. parse :: < TxHash > ( ) . map_err ( |e| {
201
+ Eip7702ConfirmationError :: TransactionHashError {
202
+ message : format ! ( "Invalid transaction hash format: {}" , e) ,
203
+ }
204
+ . fail ( )
205
+ } ) ?
206
+ }
207
+
208
+ TwGetTransactionHashResponse :: Pending => {
209
209
return Err ( Eip7702ConfirmationError :: TransactionHashError {
210
- message : "Transaction not found " . to_string ( ) ,
210
+ message : "Transaction not yet confirmed " . to_string ( ) ,
211
211
} )
212
212
. map_err_nack ( Some ( Duration :: from_secs ( 2 ) ) , RequeuePosition :: Last ) ;
213
213
}
@@ -262,25 +262,11 @@ where
262
262
"Transaction confirmed successfully"
263
263
) ;
264
264
265
- // todo: remove this after all jobs are processed
266
- let sender_details = job_data
267
- . sender_details
268
- . clone ( )
269
- . or_else ( || {
270
- job_data
271
- . eoa_address
272
- . map ( |eoa_address| Eip7702Sender :: Owner { eoa_address } )
273
- } )
274
- . ok_or_else ( || Eip7702ConfirmationError :: InternalError {
275
- message : "No sender details found" . to_string ( ) ,
276
- } )
277
- . map_err_fail ( ) ?;
278
-
279
265
Ok ( Eip7702ConfirmationResult {
280
266
transaction_id : job_data. transaction_id . clone ( ) ,
281
267
transaction_hash,
282
268
receipt,
283
- sender_details,
269
+ sender_details : job_data . sender_details . clone ( ) ,
284
270
} )
285
271
}
286
272
0 commit comments