Enum alloy_consensus::transaction::envelope::TxEnvelope
source · #[non_exhaustive]pub enum TxEnvelope {
Legacy(Signed<TxLegacy>),
Eip2930(Signed<TxEip2930>),
Eip1559(Signed<TxEip1559>),
Eip4844(Signed<TxEip4844Variant>),
}
Expand description
The Ethereum EIP-2718 Transaction Envelope.
§Note:
This enum distinguishes between tagged and untagged legacy transactions, as
the in-protocol merkle tree may commit to EITHER 0-prefixed or raw.
Therefore we must ensure that encoding returns the precise byte-array that
was decoded, preserving the presence or absence of the TransactionType
flag.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Legacy(Signed<TxLegacy>)
An untagged TxLegacy
.
Eip2930(Signed<TxEip2930>)
A TxEip2930
tagged with type 1.
Eip1559(Signed<TxEip1559>)
A TxEip1559
tagged with type 2.
Eip4844(Signed<TxEip4844Variant>)
A TxEip4844 tagged with type 3. An EIP-4844 transaction has two network representations: 1 - The transaction itself, which is a regular RLP-encoded transaction and used to retrieve historical transactions..
2 - The transaction with a sidecar, which is the form used to send transactions to the network.
Implementations§
source§impl TxEnvelope
impl TxEnvelope
sourcepub const fn is_eip2930(&self) -> bool
pub const fn is_eip2930(&self) -> bool
Returns true if the transaction is an EIP-2930 transaction.
sourcepub const fn is_eip1559(&self) -> bool
pub const fn is_eip1559(&self) -> bool
Returns true if the transaction is an EIP-1559 transaction.
sourcepub const fn is_eip4844(&self) -> bool
pub const fn is_eip4844(&self) -> bool
Returns true if the transaction is an EIP-4844 transaction.
sourcepub const fn as_legacy(&self) -> Option<&Signed<TxLegacy>>
pub const fn as_legacy(&self) -> Option<&Signed<TxLegacy>>
Returns the TxLegacy
variant if the transaction is a legacy transaction.
sourcepub const fn as_eip2930(&self) -> Option<&Signed<TxEip2930>>
pub const fn as_eip2930(&self) -> Option<&Signed<TxEip2930>>
Returns the TxEip2930
variant if the transaction is an EIP-2930 transaction.
sourcepub const fn as_eip1559(&self) -> Option<&Signed<TxEip1559>>
pub const fn as_eip1559(&self) -> Option<&Signed<TxEip1559>>
Returns the TxEip1559
variant if the transaction is an EIP-1559 transaction.
sourcepub const fn as_eip4844(&self) -> Option<&Signed<TxEip4844Variant>>
pub const fn as_eip4844(&self) -> Option<&Signed<TxEip4844Variant>>
Returns the TxEip4844
variant if the transaction is an EIP-4844 transaction.
sourcepub fn recover_signer(&self) -> Result<Address, SignatureError>
Available on crate feature k256
only.
pub fn recover_signer(&self) -> Result<Address, SignatureError>
k256
only.Recover the signer of the transaction.
sourcepub fn signature_hash(&self) -> B256
pub fn signature_hash(&self) -> B256
Calculate the signing hash for the transaction.
sourcepub fn inner_length(&self) -> usize
pub fn inner_length(&self) -> usize
Return the length of the inner txn, without a type byte.
sourcefn rlp_payload_length(&self) -> usize
fn rlp_payload_length(&self) -> usize
Return the RLP payload length of the network-serialized wrapper
Trait Implementations§
source§impl Clone for TxEnvelope
impl Clone for TxEnvelope
source§fn clone(&self) -> TxEnvelope
fn clone(&self) -> TxEnvelope
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for TxEnvelope
impl Debug for TxEnvelope
source§impl Decodable for TxEnvelope
impl Decodable for TxEnvelope
source§impl Decodable2718 for TxEnvelope
impl Decodable2718 for TxEnvelope
source§fn typed_decode(ty: u8, buf: &mut &[u8]) -> Eip2718Result<Self>
fn typed_decode(ty: u8, buf: &mut &[u8]) -> Eip2718Result<Self>
source§fn fallback_decode(buf: &mut &[u8]) -> Eip2718Result<Self>
fn fallback_decode(buf: &mut &[u8]) -> Eip2718Result<Self>
§fn extract_type_byte(buf: &mut &[u8]) -> Option<u8>
fn extract_type_byte(buf: &mut &[u8]) -> Option<u8>
§fn decode_2718(buf: &mut &[u8]) -> Result<Self, Eip2718Error>
fn decode_2718(buf: &mut &[u8]) -> Result<Self, Eip2718Error>
source§impl<'de> Deserialize<'de> for TxEnvelope
impl<'de> Deserialize<'de> for TxEnvelope
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl Encodable for TxEnvelope
impl Encodable for TxEnvelope
source§impl Encodable2718 for TxEnvelope
impl Encodable2718 for TxEnvelope
source§fn encode_2718_len(&self) -> usize
fn encode_2718_len(&self) -> usize
source§fn encode_2718(&self, out: &mut dyn BufMut)
fn encode_2718(&self, out: &mut dyn BufMut)
§fn encoded_2718(&self) -> Vec<u8> ⓘ
fn encoded_2718(&self) -> Vec<u8> ⓘ
§fn trie_hash(&self) -> FixedBytes<32>
fn trie_hash(&self) -> FixedBytes<32>
§fn network_encode(&self, out: &mut dyn BufMut)
fn network_encode(&self, out: &mut dyn BufMut)
source§impl From<Signed<TxEip4844Variant>> for TxEnvelope
impl From<Signed<TxEip4844Variant>> for TxEnvelope
source§fn from(v: Signed<TxEip4844Variant>) -> Self
fn from(v: Signed<TxEip4844Variant>) -> Self
source§impl From<Signed<TxEip4844WithSidecar>> for TxEnvelope
impl From<Signed<TxEip4844WithSidecar>> for TxEnvelope
source§fn from(v: Signed<TxEip4844WithSidecar>) -> Self
fn from(v: Signed<TxEip4844WithSidecar>) -> Self
source§impl From<TxEnvelope> for TypedTransaction
impl From<TxEnvelope> for TypedTransaction
source§fn from(envelope: TxEnvelope) -> Self
fn from(envelope: TxEnvelope) -> Self
source§impl<T: From<TxEnvelope>> From<TxEnvelope> for WithOtherFields<T>
Available on crate feature serde
only.
impl<T: From<TxEnvelope>> From<TxEnvelope> for WithOtherFields<T>
serde
only.source§fn from(value: TxEnvelope) -> Self
fn from(value: TxEnvelope) -> Self
source§impl PartialEq for TxEnvelope
impl PartialEq for TxEnvelope
source§fn eq(&self, other: &TxEnvelope) -> bool
fn eq(&self, other: &TxEnvelope) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for TxEnvelope
impl Serialize for TxEnvelope
impl Eq for TxEnvelope
impl StructuralPartialEq for TxEnvelope
Auto Trait Implementations§
impl !Freeze for TxEnvelope
impl RefUnwindSafe for TxEnvelope
impl Send for TxEnvelope
impl Sync for TxEnvelope
impl Unpin for TxEnvelope
impl UnwindSafe for TxEnvelope
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreimpl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> Eip2718Envelope for Twhere
T: Decodable2718 + Encodable2718,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 480 bytes
Size for each variant:
Legacy
: 320 bytesEip2930
: 336 bytesEip1559
: 352 bytesEip4844
: 480 bytes