diff --git a/crates/consensus/src/transaction/envelope.rs b/crates/consensus/src/transaction/envelope.rs index 9af4c1a5d27..6ac86b18d38 100644 --- a/crates/consensus/src/transaction/envelope.rs +++ b/crates/consensus/src/transaction/envelope.rs @@ -9,7 +9,7 @@ use alloy_eips::{ eip2718::{Decodable2718, Eip2718Error, Eip2718Result, Encodable2718}, eip2930::AccessList, }; -use alloy_primitives::{Bytes, TxKind, B256}; +use alloy_primitives::{Bytes, PrimitiveSignature as Signature, TxKind, B256}; use alloy_rlp::{Decodable, Encodable}; use core::fmt; @@ -272,6 +272,17 @@ impl TxEnvelope { } } + /// Return the reference to signature. + pub const fn signature(&self) -> &Signature { + match self { + Self::Legacy(tx) => tx.signature(), + Self::Eip2930(tx) => tx.signature(), + Self::Eip1559(tx) => tx.signature(), + Self::Eip4844(tx) => tx.signature(), + Self::Eip7702(tx) => tx.signature(), + } + } + /// Return the hash of the inner Signed. #[doc(alias = "transaction_hash")] pub const fn tx_hash(&self) -> &B256 {