Skip to content

Commit

Permalink
chore: remove tx types
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-aranha-cw committed Feb 4, 2025
1 parent cf8086c commit 63af6f6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 34 deletions.
2 changes: 0 additions & 2 deletions src/alias.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ pub type AlloyUint256 = alloy_primitives::Uint<256, 4>;
// -----------------------------------------------------------------------------
// Ethers
// -----------------------------------------------------------------------------
pub type AlloyBlockEthersTransaction = alloy_rpc_types_eth::Block<ethers_core::types::Transaction>;
pub type EthersBytes = ethers_core::types::Bytes;
pub type EthersTransaction = ethers_core::types::Transaction;

// -----------------------------------------------------------------------------
// REVM
Expand Down
12 changes: 6 additions & 6 deletions src/eth/primitives/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
}

Expand Down Expand Up @@ -127,10 +127,10 @@ impl Block {
// -----------------------------------------------------------------------------
// Conversions: Self -> Other
// -----------------------------------------------------------------------------
impl From<Block> for AlloyBlockEthersTransaction {
impl From<Block> for AlloyBlockAlloyTransaction {
fn from(block: Block) -> Self {
let alloy_block: AlloyBlockEthersTransaction = block.header.into();
let transactions: Vec<EthersTransaction> = block.transactions.into_iter().map_into().collect();
let alloy_block: AlloyBlockAlloyTransaction = block.header.into();
let transactions: Vec<AlloyTransaction> = block.transactions.into_iter().map_into().collect();

Self {
transactions: BlockTransactions::Full(transactions),
Expand Down
26 changes: 0 additions & 26 deletions src/eth/primitives/transaction_mined.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -97,31 +96,6 @@ impl TransactionMined {
// -----------------------------------------------------------------------------
// Conversions: Self -> Other
// -----------------------------------------------------------------------------
impl From<TransactionMined> 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<TransactionMined> for AlloyTransaction {
fn from(value: TransactionMined) -> Self {
Expand Down

0 comments on commit 63af6f6

Please sign in to comment.