From 63af6f661c39bbdb8a2e9359c07c3ffc19bb5fe9 Mon Sep 17 00:00:00 2001 From: gabriel-aranha-cw Date: Tue, 4 Feb 2025 15:44:43 -0300 Subject: [PATCH] chore: remove tx types --- src/alias.rs | 2 -- src/eth/primitives/block.rs | 12 ++++++------ src/eth/primitives/transaction_mined.rs | 26 ------------------------- 3 files changed, 6 insertions(+), 34 deletions(-) diff --git a/src/alias.rs b/src/alias.rs index 3045619d1..8df7f28f6 100644 --- a/src/alias.rs +++ b/src/alias.rs @@ -33,9 +33,7 @@ pub type AlloyUint256 = alloy_primitives::Uint<256, 4>; // ----------------------------------------------------------------------------- // Ethers // ----------------------------------------------------------------------------- -pub type AlloyBlockEthersTransaction = alloy_rpc_types_eth::Block; pub type EthersBytes = ethers_core::types::Bytes; -pub type EthersTransaction = ethers_core::types::Transaction; // ----------------------------------------------------------------------------- // REVM diff --git a/src/eth/primitives/block.rs b/src/eth/primitives/block.rs index 257785195..85fc3f5f6 100644 --- a/src/eth/primitives/block.rs +++ b/src/eth/primitives/block.rs @@ -5,9 +5,9 @@ use alloy_rpc_types_eth::BlockTransactions; use display_json::DebugAsJson; use itertools::Itertools; -use crate::alias::AlloyBlockEthersTransaction; +use crate::alias::AlloyBlockAlloyTransaction; use crate::alias::AlloyBlockH256; -use crate::alias::EthersTransaction; +use crate::alias::AlloyTransaction; use crate::alias::JsonValue; use crate::eth::primitives::Address; use crate::eth::primitives::BlockHeader; @@ -70,7 +70,7 @@ impl Block { /// Serializes itself to JSON-RPC block format with full transactions included. pub fn to_json_rpc_with_full_transactions(self) -> JsonValue { - let alloy_block: AlloyBlockEthersTransaction = self.into(); + let alloy_block: AlloyBlockAlloyTransaction = self.into(); to_json_value(alloy_block) } @@ -127,10 +127,10 @@ impl Block { // ----------------------------------------------------------------------------- // Conversions: Self -> Other // ----------------------------------------------------------------------------- -impl From for AlloyBlockEthersTransaction { +impl From for AlloyBlockAlloyTransaction { fn from(block: Block) -> Self { - let alloy_block: AlloyBlockEthersTransaction = block.header.into(); - let transactions: Vec = block.transactions.into_iter().map_into().collect(); + let alloy_block: AlloyBlockAlloyTransaction = block.header.into(); + let transactions: Vec = block.transactions.into_iter().map_into().collect(); Self { transactions: BlockTransactions::Full(transactions), diff --git a/src/eth/primitives/transaction_mined.rs b/src/eth/primitives/transaction_mined.rs index 3924d0f90..ed9c3166c 100644 --- a/src/eth/primitives/transaction_mined.rs +++ b/src/eth/primitives/transaction_mined.rs @@ -8,7 +8,6 @@ use itertools::Itertools; use crate::alias::AlloyReceipt; use crate::alias::AlloyTransaction; -use crate::alias::EthersTransaction; use crate::eth::primitives::logs_bloom::LogsBloom; use crate::eth::primitives::BlockNumber; use crate::eth::primitives::EvmExecution; @@ -97,31 +96,6 @@ impl TransactionMined { // ----------------------------------------------------------------------------- // Conversions: Self -> Other // ----------------------------------------------------------------------------- -impl From for EthersTransaction { - fn from(value: TransactionMined) -> Self { - let input = value.input; - Self { - chain_id: input.chain_id.map_into(), - hash: input.hash.into(), - nonce: input.nonce.into(), - block_hash: Some(value.block_hash.into()), - block_number: Some(value.block_number.into()), - transaction_index: Some(value.transaction_index.into()), - from: input.signer.into(), - to: input.to.map_into(), - value: input.value.into(), - gas_price: Some(input.gas_price.into()), - gas: input.gas_limit.into(), - input: input.input.into(), - v: input.v, - r: input.r, - s: input.s, - transaction_type: input.tx_type, - ..Default::default() - } - } -} - // TODO: improve before merging impl From for AlloyTransaction { fn from(value: TransactionMined) -> Self {