22 crate :: eth_utils:: nonce_manager:: NonceManaged ,
33 anyhow:: { anyhow, Result } ,
44 backoff:: ExponentialBackoff ,
5- ethers:: types:: TransactionReceipt ,
6- ethers:: types:: U256 ,
7- ethers:: { contract:: ContractCall , middleware:: Middleware } ,
8- std:: sync:: atomic:: AtomicU64 ,
9- std:: sync:: Arc ,
5+ ethers:: {
6+ contract:: ContractCall ,
7+ middleware:: Middleware ,
8+ types:: { TransactionReceipt , U256 } ,
9+ } ,
10+ std:: sync:: { atomic:: AtomicU64 , Arc } ,
1011 tokio:: time:: { timeout, Duration } ,
1112 tracing,
1213} ;
1314
15+ pub type ChainId = String ;
16+
1417const TX_CONFIRMATION_TIMEOUT_SECS : u64 = 30 ;
1518
1619#[ derive( Debug ) ]
@@ -154,6 +157,8 @@ pub async fn submit_tx_with_backoff<T: Middleware + NonceManaged + 'static>(
154157 call : ContractCall < T , ( ) > ,
155158 gas_limit : U256 ,
156159 escalation_policy : EscalationPolicy ,
160+ chain_id : ChainId ,
161+ sequence_number : u64 ,
157162) -> Result < SubmitTxResult > {
158163 let start_time = std:: time:: Instant :: now ( ) ;
159164
@@ -178,6 +183,8 @@ pub async fn submit_tx_with_backoff<T: Middleware + NonceManaged + 'static>(
178183 gas_limit,
179184 gas_multiplier_pct,
180185 fee_multiplier_pct,
186+ chain_id. clone ( ) ,
187+ sequence_number,
181188 )
182189 . await
183190 } ,
@@ -217,6 +224,8 @@ pub async fn submit_tx<T: Middleware + NonceManaged + 'static>(
217224 // A value of 100 submits the tx with the same gas/fee as the estimate.
218225 gas_estimate_multiplier_pct : u64 ,
219226 fee_estimate_multiplier_pct : u64 ,
227+ chain_id : ChainId ,
228+ sequence_number : u64 ,
220229) -> Result < TransactionReceipt , backoff:: Error < anyhow:: Error > > {
221230 let gas_estimate_res = call. estimate_gas ( ) . await ;
222231
@@ -261,6 +270,13 @@ pub async fn submit_tx<T: Middleware + NonceManaged + 'static>(
261270 / 100 ,
262271 ) ;
263272
273+ tracing:: info!(
274+ "Chain ID: {}, Sequence Number: {}, Tx: {:?}" ,
275+ chain_id,
276+ sequence_number,
277+ transaction
278+ ) ;
279+
264280 let pending_tx = client
265281 . send_transaction ( transaction. clone ( ) , None )
266282 . await
0 commit comments