diff --git a/crates/rpc-types-eth/src/transaction/request.rs b/crates/rpc-types-eth/src/transaction/request.rs index 7c93d0bc078..1157072f30e 100644 --- a/crates/rpc-types-eth/src/transaction/request.rs +++ b/crates/rpc-types-eth/src/transaction/request.rs @@ -15,6 +15,7 @@ use alloc::{ vec, vec::Vec, }; +use alloy_consensus::transaction::Recovered; /// Represents _all_ transaction requests to/from RPC. #[derive(Clone, Debug, Default, PartialEq, Eq, Hash)] @@ -186,6 +187,12 @@ impl TransactionRequest { } } + /// Initializes the [`TransactionRequest`] with the provided transaction and sender. + pub fn from_recovered_transaction(tx: Recovered) -> Self { + let (tx, from) = tx.into_parts(); + Self::from_transaction(tx).from(from) + } + /// Initializes the [`TransactionRequest`] with the provided transaction and sender. pub fn from_transaction_with_sender(tx: T, from: Address) -> Self { Self::from_transaction(tx).from(from)