From c2480ce20ddffc94075b11c2f5bfe8d9ff6a1c5f Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Tue, 24 Sep 2024 10:24:41 +0200 Subject: [PATCH] feat: add convenience conversion --- src/tracing/mod.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/tracing/mod.rs b/src/tracing/mod.rs index 703b34ca..c9dc2eb8 100644 --- a/src/tracing/mod.rs +++ b/src/tracing/mod.rs @@ -726,3 +726,13 @@ impl TransactionContext { self } } + +impl From for TransactionContext { + fn from(tx_info: alloy_rpc_types_eth::TransactionInfo) -> Self { + Self { + block_hash: tx_info.block_hash, + tx_index: tx_info.index.map(|idx| idx as usize), + tx_hash: tx_info.hash, + } + } +}