#[non_exhaustive]pub enum TxEnvelope {
Legacy(Signed<TxLegacy>),
Eip2930(Signed<TxEip2930>),
Eip1559(Signed<TxEip1559>),
Eip4844(Signed<TxEip4844Variant>),
Eip7702(Signed<TxEip7702>),
}
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.
Eip7702(Signed<TxEip7702>)
A TxEip7702
tagged with type 4.
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 is_eip7702(&self) -> bool
pub const fn is_eip7702(&self) -> bool
Returns true if the transaction is an EIP-7702 transaction.
Sourcepub const fn is_replay_protected(&self) -> bool
pub const fn is_replay_protected(&self) -> bool
Returns true if the transaction is replay protected.
All non-legacy transactions are replay protected, as the chain id is
included in the transaction body. Legacy transactions are considered
replay protected if the v
value is not 27 or 28, according to the
rules of EIP-155.
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 const fn as_eip7702(&self) -> Option<&Signed<TxEip7702>>
pub const fn as_eip7702(&self) -> Option<&Signed<TxEip7702>>
Returns the TxEip7702
variant if the transaction is an EIP-7702 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 eip2718_encoded_length(&self) -> usize
pub fn eip2718_encoded_length(&self) -> usize
Return the length of the inner txn, including type byte length
Trait Implementations§
Source§impl<'arbitrary> Arbitrary<'arbitrary> for TxEnvelope
impl<'arbitrary> Arbitrary<'arbitrary> for TxEnvelope
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
Self
from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
Self
from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured
this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured
this type
needs to construct itself. Read moreSource§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>
Source§fn extract_type_byte(buf: &mut &[u8]) -> Option<u8>
fn extract_type_byte(buf: &mut &[u8]) -> Option<u8>
Source§fn decode_2718(buf: &mut &[u8]) -> Result<Self, Eip2718Error>
fn decode_2718(buf: &mut &[u8]) -> Result<Self, Eip2718Error>
Source§fn network_decode(buf: &mut &[u8]) -> Result<Self, Eip2718Error>
fn network_decode(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)
Source§fn trie_hash(&self) -> B256
fn trie_hash(&self) -> B256
Source§fn encoded_2718(&self) -> Vec<u8> ⓘ
fn encoded_2718(&self) -> Vec<u8> ⓘ
Source§fn network_len(&self) -> usize
fn network_len(&self) -> usize
Source§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§impl Serialize for TxEnvelope
impl Serialize for TxEnvelope
Source§impl Transaction for TxEnvelope
impl Transaction for TxEnvelope
Source§fn max_fee_per_gas(&self) -> u128
fn max_fee_per_gas(&self) -> u128
Source§fn max_priority_fee_per_gas(&self) -> Option<u128>
fn max_priority_fee_per_gas(&self) -> Option<u128>
Source§fn max_fee_per_blob_gas(&self) -> Option<u128>
fn max_fee_per_blob_gas(&self) -> Option<u128>
Source§fn priority_fee_or_price(&self) -> u128
fn priority_fee_or_price(&self) -> u128
Source§fn access_list(&self) -> Option<&AccessList>
fn access_list(&self) -> Option<&AccessList>
access_list
for the particular transaction type. Returns None
for
older transaction types.Source§fn blob_versioned_hashes(&self) -> Option<&[B256]>
fn blob_versioned_hashes(&self) -> Option<&[B256]>
None
.SignedAuthorization
list of the transaction. Read moreimpl 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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)