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

feat: remove transaction_to_call_request helper fn #14089

Merged
merged 2 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 0 additions & 8 deletions crates/rpc/rpc-types-compat/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,3 @@ pub trait TransactionCompat<T = TransactionSigned>:
// <https://github.com/alloy-rs/alloy/issues/1315>.
fn otterscan_api_truncate_input(tx: &mut Self::Transaction);
}

/// Convert [`Recovered`] to [`TransactionRequest`]
pub fn transaction_to_call_request<T: alloy_consensus::Transaction>(
tx: Recovered<T>,
) -> TransactionRequest {
let from = tx.signer();
TransactionRequest::from_transaction_with_sender(tx.into_tx(), from)
}
7 changes: 4 additions & 3 deletions examples/custom-inspector/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

use alloy_eips::BlockNumberOrTag;
use alloy_primitives::Address;
use alloy_rpc_types_eth::state::EvmOverrides;
use alloy_rpc_types_eth::{state::EvmOverrides, TransactionRequest};
use clap::Parser;
use futures_util::StreamExt;
use reth::{
Expand All @@ -25,7 +25,7 @@ use reth::{
primitives::{Env, EnvWithHandlerCfg},
Database, Evm, EvmContext, Inspector,
},
rpc::{api::eth::helpers::Call, compat::transaction::transaction_to_call_request},
rpc::api::eth::helpers::Call,
transaction_pool::TransactionPool,
};
use reth_evm::EvmEnv;
Expand Down Expand Up @@ -57,7 +57,8 @@ fn main() {
if let Some(recipient) = tx.to() {
if args.is_match(&recipient) {
// convert the pool transaction
let call_request = transaction_to_call_request(tx.to_consensus());
let call_request =
TransactionRequest::from_recovered_transaction(tx.to_consensus());

let result = eth_api
.spawn_with_call_at(
Expand Down
5 changes: 3 additions & 2 deletions examples/txpool-tracing/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use clap::Parser;
use futures_util::StreamExt;
use reth::{
builder::NodeHandle, chainspec::EthereumChainSpecParser, cli::Cli,
rpc::compat::transaction::transaction_to_call_request, transaction_pool::TransactionPool,
rpc::types::TransactionRequest, transaction_pool::TransactionPool,
};
use reth_node_ethereum::node::EthereumNode;

Expand Down Expand Up @@ -44,7 +44,8 @@ fn main() {
if let Some(recipient) = tx.to() {
if args.is_match(&recipient) {
// trace the transaction with `trace_call`
let callrequest = transaction_to_call_request(tx.to_consensus());
let callrequest =
TransactionRequest::from_recovered_transaction(tx.to_consensus());
let tracerequest = TraceCallRequest::new(callrequest)
.with_trace_type(TraceType::Trace);
if let Ok(trace_result) = traceapi.trace_call(tracerequest).await {
Expand Down
Loading