@@ -2,6 +2,7 @@ use alloy::primitives::{Address, TxHash};
22use alloy:: providers:: Provider ;
33use alloy:: rpc:: types:: TransactionReceipt ;
44use engine_core:: error:: { AlloyRpcErrorToEngineError , EngineError } ;
5+ use engine_core:: rpc_clients:: TwGetTransactionHashResponse ;
56use engine_core:: {
67 chain:: { Chain , ChainService , RpcCredentials } ,
78 execution_options:: WebhookOptions ,
@@ -31,11 +32,7 @@ pub struct Eip7702ConfirmationJobData {
3132 pub transaction_id : String ,
3233 pub chain_id : u64 ,
3334 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 ,
3936
4037 pub rpc_credentials : RpcCredentials ,
4138 #[ serde( default ) ]
@@ -189,7 +186,7 @@ where
189186 let chain = chain. with_new_default_headers ( chain_auth_headers) ;
190187
191188 // 2. Get transaction hash from bundler
192- let transaction_hash_str = chain
189+ let transaction_hash_res = chain
193190 . bundler_client ( )
194191 . tw_get_transaction_hash ( & job_data. bundler_transaction_id )
195192 . await
@@ -198,16 +195,19 @@ where
198195 } )
199196 . map_err_fail ( ) ?;
200197
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 => {
209209 return Err ( Eip7702ConfirmationError :: TransactionHashError {
210- message : "Transaction not found " . to_string ( ) ,
210+ message : "Transaction not yet confirmed " . to_string ( ) ,
211211 } )
212212 . map_err_nack ( Some ( Duration :: from_secs ( 2 ) ) , RequeuePosition :: Last ) ;
213213 }
@@ -262,25 +262,11 @@ where
262262 "Transaction confirmed successfully"
263263 ) ;
264264
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-
279265 Ok ( Eip7702ConfirmationResult {
280266 transaction_id : job_data. transaction_id . clone ( ) ,
281267 transaction_hash,
282268 receipt,
283- sender_details,
269+ sender_details : job_data . sender_details . clone ( ) ,
284270 } )
285271 }
286272
0 commit comments