Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: log transaction when simulating/broadcasting #722

Merged
merged 2 commits into from
May 2, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/ethereum/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ mod write_provider;

#[derive(Clone, Debug)]
pub struct Ethereum {
read_provider: Arc<ReadProvider>,
read_provider: Arc<ReadProvider>,
// Mapping of chain id to provider
secondary_read_providers: HashMap<u64, Arc<ReadProvider>>,
write_provider: Arc<WriteProvider>,
write_provider: Arc<WriteProvider>,
}

impl Ethereum {
Expand Down Expand Up @@ -72,11 +72,13 @@ impl Ethereum {
tx: TypedTransaction,
only_once: bool,
) -> Result<TransactionId, TxError> {
tracing::info!(?tx, "Simulating transaction");
if let Err(err) = self.read_provider.call(&tx, None).await {
tracing::error!("Error simulating transaction: {:?}", err);
return Err(TxError::Simulate(anyhow::Error::new(err)));
}

tracing::info!(?tx, "Sending transaction");
self.write_provider.send_transaction(tx, only_once).await
}

Expand Down
Loading