fix: feat: Specify latest block when sending transactions

This commit is contained in:
Sameh Abouelsaad 2025-05-11 22:49:15 +03:00
parent 27e5a6df3e
commit cce530bfdd
2 changed files with 3 additions and 3 deletions

View File

@ -141,7 +141,7 @@ pub async fn call_write_function(
log::debug!("Gas limit: {:?}", tx.gas);
log::debug!("Network: {}", contract.network.name);
let pending_tx = match client.send_transaction(tx, None).await {
let pending_tx = match client.send_transaction(tx, Some(BlockId::Number((BlockNumber::Latest).into()))).await {
Ok(pending_tx) => {
log::debug!("Transaction sent successfully: {:?}", pending_tx.tx_hash());
log::info!("Transaction sent successfully: {:?}", pending_tx.tx_hash());

View File

@ -76,7 +76,7 @@ pub async fn send_eth(
.gas(gas);
// Send the transaction
let pending_tx = client.send_transaction(tx, None)
let pending_tx = client.send_transaction(tx, Some(BlockId::Number((BlockNumber::Latest).into())))
.await
.map_err(|e| CryptoError::SerializationError(format!("Failed to send transaction: {}", e)))?;
@ -118,7 +118,7 @@ pub async fn send_eth_with_provider(
.gas(gas);
// Send the transaction
let pending_tx = client.send_transaction(tx, None)
let pending_tx = client.send_transaction(tx, Some(BlockId::Number((BlockNumber::Latest).into())))
.await
.map_err(|e| CryptoError::SerializationError(format!("Failed to send transaction: {}", e)))?;