Skip to content
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
4 changes: 2 additions & 2 deletions crates/rpc-types-engine/src/superchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub enum ProtocolVersion {
impl core::fmt::Display for ProtocolVersion {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::V0(value) => write!(f, "{}", value),
Self::V0(value) => write!(f, "{value}"),
}
}
}
Expand Down Expand Up @@ -166,7 +166,7 @@ impl ProtocolVersion {
/// Returns a human-readable string representation of the ProtocolVersion
pub fn display(&self) -> String {
match self {
Self::V0(value) => format!("{}", value),
Self::V0(value) => format!("{value}"),
}
}
}
Expand Down
12 changes: 7 additions & 5 deletions crates/rpc-types/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ pub struct Transaction<T = OpTxEnvelope> {
}

impl Transaction {
/// Returns a rpc [`Transaction`] with a [`OpTransactionInfo`] and
/// [`Recovered<OpTxEnvelope>`] as input.
pub fn from_transaction(tx: Recovered<OpTxEnvelope>, tx_info: OpTransactionInfo) -> Self {
/// Converts a consensus `tx` with an additional context `tx_info` into an RPC [`Transaction`].
pub fn from_transaction<T: OpTransaction + TransactionTrait>(
tx: Recovered<T>,
tx_info: OpTransactionInfo,
) -> Transaction<T> {
let base_fee = tx_info.inner.base_fee;
let effective_gas_price = if tx.is_deposit() {
// For deposits, we must always set the `gasPrice` field to 0 in rpc
Expand All @@ -51,7 +53,7 @@ impl Transaction {
.unwrap_or_else(|| tx.max_fee_per_gas())
};

Self {
Transaction {
inner: alloy_rpc_types_eth::Transaction {
inner: tx,
block_hash: tx_info.inner.block_hash,
Expand Down Expand Up @@ -206,7 +208,7 @@ mod tx_serde {
//! [`alloy_consensus::transaction::Recovered::signer`] which resides in
//! [`alloy_rpc_types_eth::Transaction::inner`] and [`op_alloy_consensus::TxDeposit::from`].
//!
//! Additionaly, we need similar logic for the `gasPrice` field
//! Additionally, we need similar logic for the `gasPrice` field
use super::*;
use alloy_consensus::transaction::Recovered;
use op_alloy_consensus::OpTransaction;
Expand Down