Type Alias PooledTransaction

pub type PooledTransaction = EthereumTxEnvelope<TxEip4844WithSidecar>;
Expand description

All possible transactions that can be included in a response to GetPooledTransactions. A response to GetPooledTransactions. This can include either a blob transaction, or a non-4844 signed transaction.

The difference between this and the [TxEnvelope] is that this type always requires the [TxEip4844WithSidecar] variant, because EIP-4844 transaction can only be propagated with the sidecar over p2p.

Aliased Type§

enum PooledTransaction {
    Legacy(Signed<TxLegacy>),
    Eip2930(Signed<TxEip2930>),
    Eip1559(Signed<TxEip1559>),
    Eip4844(Signed<TxEip4844WithSidecar>),
    Eip7702(Signed<TxEip7702>),
}

Variants§

§

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<TxEip4844WithSidecar>)

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

§

impl<Eip4844> EthereumTxEnvelope<Eip4844>
where Eip4844: RlpEcdsaEncodableTx,

pub const fn is_legacy(&self) -> bool

Returns true if the transaction is a legacy transaction.

pub const fn is_eip2930(&self) -> bool

Returns true if the transaction is an EIP-2930 transaction.

pub const fn is_eip1559(&self) -> bool

Returns true if the transaction is an EIP-1559 transaction.

pub const fn is_eip4844(&self) -> bool

Returns true if the transaction is an EIP-4844 transaction.

pub const fn is_eip7702(&self) -> bool

Returns true if the transaction is an EIP-7702 transaction.

pub fn into_signed(self) -> Signed<EthereumTypedTransaction<Eip4844>>
where EthereumTypedTransaction<Eip4844>: From<Eip4844>,

Consumes the type into a [Signed]

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.

pub const fn as_legacy(&self) -> Option<&Signed<TxLegacy>>

Returns the [TxLegacy] variant if the transaction is a legacy transaction.

pub const fn as_eip2930(&self) -> Option<&Signed<TxEip2930>>

Returns the [TxEip2930] variant if the transaction is an EIP-2930 transaction.

pub const fn as_eip1559(&self) -> Option<&Signed<TxEip1559>>

Returns the [TxEip1559] variant if the transaction is an EIP-1559 transaction.

pub const fn as_eip4844(&self) -> Option<&Signed<Eip4844>>

Returns the [TxEip4844Variant] variant if the transaction is an EIP-4844 transaction.

pub const fn as_eip7702(&self) -> Option<&Signed<TxEip7702>>

Returns the [TxEip7702] variant if the transaction is an EIP-7702 transaction.

pub fn signature_hash(&self) -> FixedBytes<32>
where Eip4844: SignableTransaction<PrimitiveSignature>,

Calculate the signing hash for the transaction.

pub const fn signature(&self) -> &PrimitiveSignature

Return the reference to signature.

pub fn tx_hash(&self) -> &FixedBytes<32>

Return the hash of the inner Signed.

pub fn hash(&self) -> &FixedBytes<32>

Reference to transaction hash. Used to identify transaction.

pub const fn tx_type(&self) -> TxType

Return the TxType of the inner txn.

pub fn eip2718_encoded_length(&self) -> usize

Return the length of the inner txn, including type byte length

§

impl EthereumTxEnvelope<TxEip4844WithSidecar>

pub fn into_envelope(self) -> EthereumTxEnvelope<TxEip4844Variant>

Converts the transaction into [TxEnvelope].

Trait Implementations§

Source§

impl TryFrom<TransactionSigned> for PooledTransaction

Source§

type Error = TransactionConversionError

The type returned in the event of a conversion error.
Source§

fn try_from(tx: TransactionSigned) -> Result<Self, Self::Error>

Performs the conversion.
§

impl<Eip4844> Clone for EthereumTxEnvelope<Eip4844>
where Eip4844: Clone,

§

fn clone(&self) -> EthereumTxEnvelope<Eip4844>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<Eip4844> Debug for EthereumTxEnvelope<Eip4844>
where Eip4844: Debug,

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<Eip4844> Decodable for EthereumTxEnvelope<Eip4844>
where Eip4844: RlpEcdsaDecodableTx,

§

fn decode(buf: &mut &[u8]) -> Result<EthereumTxEnvelope<Eip4844>, Error>

Decodes the blob into the appropriate type. buf must be advanced past the decoded object.
§

impl<Eip4844> Decodable2718 for EthereumTxEnvelope<Eip4844>
where Eip4844: RlpEcdsaDecodableTx,

§

fn typed_decode( ty: u8, buf: &mut &[u8], ) -> Result<EthereumTxEnvelope<Eip4844>, Eip2718Error>

Decode the appropriate variant, based on the type flag. Read more
§

fn fallback_decode( buf: &mut &[u8], ) -> Result<EthereumTxEnvelope<Eip4844>, Eip2718Error>

Decode the default variant. Read more
§

fn extract_type_byte(buf: &mut &[u8]) -> Option<u8>

Extract the type byte from the buffer, if any. The type byte is the first byte, provided that that first byte is 0x7f or lower.
§

fn decode_2718(buf: &mut &[u8]) -> Result<Self, Eip2718Error>

Encode the transaction according to EIP-2718 rules. First a 1-byte type flag in the range 0x0-0x7f, then the body of the transaction. Read more
§

fn network_decode(buf: &mut &[u8]) -> Result<Self, Eip2718Error>

Decode an EIP-2718 transaction in the network format. The network format is used ONLY by the Ethereum p2p protocol. Do not call this method unless you are building a p2p protocol client. Read more
§

impl<'de, Eip4844> Deserialize<'de> for EthereumTxEnvelope<Eip4844>
where Eip4844: Clone + RlpEcdsaEncodableTx + Serialize + DeserializeOwned,

§

fn deserialize<__D>( __deserializer: __D, ) -> Result<EthereumTxEnvelope<Eip4844>, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
§

impl<Eip4844> Encodable for EthereumTxEnvelope<Eip4844>
where EthereumTxEnvelope<Eip4844>: Encodable2718,

§

fn encode(&self, out: &mut dyn BufMut)

Encodes the type into the out buffer.
§

fn length(&self) -> usize

Returns the length of the encoding of this type in bytes. Read more
§

impl<Eip4844> Encodable2718 for EthereumTxEnvelope<Eip4844>
where Eip4844: RlpEcdsaEncodableTx + Typed2718 + Send + Sync,

§

fn encode_2718_len(&self) -> usize

The length of the 2718 encoded envelope. This is the length of the type flag + the length of the inner encoding.
§

fn encode_2718(&self, out: &mut dyn BufMut)

Encode the transaction according to EIP-2718 rules. First a 1-byte type flag in the range 0x0-0x7f, then the body of the transaction. Read more
§

fn trie_hash(&self) -> FixedBytes<32>

Compute the hash as committed to in the MPT trie. This hash is used ONLY by the Ethereum merkle-patricia trie and associated proofs. Do not call this method unless you are building a full or light client. Read more
§

fn type_flag(&self) -> Option<u8>

Return the type flag (if any). Read more
§

fn encoded_2718(&self) -> Vec<u8>

Encode the transaction according to [EIP-2718] rules. First a 1-byte type flag in the range 0x0-0x7f, then the body of the transaction. Read more
§

fn seal(self) -> Sealed<Self>

Seal the encodable, by encoding and hashing it.
§

fn network_len(&self) -> usize

The length of the 2718 encoded envelope in network format. This is the length of the header + the length of the type flag and inner encoding.
§

fn network_encode(&self, out: &mut dyn BufMut)

Encode in the network format. The network format is used ONLY by the Ethereum p2p protocol. Do not call this method unless you are building a p2p protocol client. Read more
§

impl<Eip4844> From<MaybeTaggedTxEnvelope<Eip4844>> for EthereumTxEnvelope<Eip4844>

§

fn from(value: MaybeTaggedTxEnvelope<Eip4844>) -> EthereumTxEnvelope<Eip4844>

Converts to this type from the input type.
§

impl<T, Eip4844> From<Signed<T>> for EthereumTxEnvelope<Eip4844>
where EthereumTypedTransaction<Eip4844>: From<T>, T: RlpEcdsaEncodableTx,

§

fn from(v: Signed<T>) -> EthereumTxEnvelope<Eip4844>

Converts to this type from the input type.
§

impl<Eip4844> From<TaggedTxEnvelope<Eip4844>> for EthereumTxEnvelope<Eip4844>

§

fn from(value: TaggedTxEnvelope<Eip4844>) -> EthereumTxEnvelope<Eip4844>

Converts to this type from the input type.
§

impl<Eip4844> Hash for EthereumTxEnvelope<Eip4844>
where EthereumTxEnvelope<Eip4844>: Encodable2718,

§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl InMemorySize for EthereumTxEnvelope<TxEip4844WithSidecar>

§

fn size(&self) -> usize

Returns a heuristic for the in-memory size of a struct.
§

impl<Eip4844> PartialEq for EthereumTxEnvelope<Eip4844>
where Eip4844: RlpEcdsaEncodableTx + PartialEq,

§

fn eq(&self, other: &EthereumTxEnvelope<Eip4844>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl<Eip4844> Serialize for EthereumTxEnvelope<Eip4844>
where Eip4844: Clone + RlpEcdsaEncodableTx + Serialize + DeserializeOwned,

§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
§

impl SignedTransaction for EthereumTxEnvelope<TxEip4844WithSidecar>

§

fn tx_hash(&self) -> &FixedBytes<32>

Returns reference to transaction hash.
§

fn signature(&self) -> &PrimitiveSignature

Returns reference to signature.
§

fn recover_signer(&self) -> Result<Address, RecoveryError>

Recover signer from signature and hash. Read more
§

fn recover_signer_unchecked_with_buf( &self, buf: &mut Vec<u8>, ) -> Result<Address, RecoveryError>

Same as [Self::recover_signer_unchecked] but receives a buffer to operate on. This is used during batch recovery to avoid allocating a new buffer for each transaction.
§

fn is_broadcastable_in_full(&self) -> bool

Returns whether this transaction type can be broadcasted as full transaction over the network. Read more
§

fn try_recover(&self) -> Result<Address, RecoveryError>

Recover signer from signature and hash. Read more
§

fn recover_signer_unchecked(&self) -> Result<Address, RecoveryError>

Recover signer from signature and hash without ensuring that the signature has a low s value. Read more
§

fn try_recover_unchecked(&self) -> Result<Address, RecoveryError>

Recover signer from signature and hash without ensuring that the signature has a low s value. Read more
§

fn recalculate_hash(&self) -> FixedBytes<32>

Calculate transaction hash, eip2728 transaction does not contain rlp header and start with tx type.
§

fn try_clone_into_recovered(&self) -> Result<Recovered<Self>, RecoveryError>

Tries to recover signer and return [Recovered] by cloning the type.
§

fn try_into_recovered(self) -> Result<Recovered<Self>, Self>

Tries to recover signer and return [Recovered]. Read more
§

fn into_recovered_unchecked(self) -> Result<Recovered<Self>, RecoveryError>

Consumes the type, recover signer and return [Recovered] without ensuring that the signature has a low s value (EIP-2). Read more
§

fn with_signer(self, signer: Address) -> Recovered<Self>

Returns the [Recovered] transaction with the given sender. Read more
§

impl<Eip4844> Transaction for EthereumTxEnvelope<Eip4844>
where EthereumTxEnvelope<Eip4844>: Typed2718, Eip4844: Transaction + Send + Sync,

§

fn chain_id(&self) -> Option<u64>

Get chain_id.
§

fn nonce(&self) -> u64

Get nonce.
§

fn gas_limit(&self) -> u64

Get gas_limit.
§

fn gas_price(&self) -> Option<u128>

Get gas_price.
§

fn max_fee_per_gas(&self) -> u128

Returns the EIP-1559 the maximum fee per gas the caller is willing to pay. Read more
§

fn max_priority_fee_per_gas(&self) -> Option<u128>

Returns the EIP-1559 Priority fee the caller is paying to the block author. Read more
§

fn max_fee_per_blob_gas(&self) -> Option<u128>

Max fee per blob gas for EIP-4844 transaction. Read more
§

fn priority_fee_or_price(&self) -> u128

Return the max priority fee per gas if the transaction is an EIP-1559 transaction, and otherwise return the gas price. Read more
§

fn effective_gas_price(&self, base_fee: Option<u64>) -> u128

Returns the effective gas price for the given base fee. Read more
§

fn is_dynamic_fee(&self) -> bool

Returns true if the transaction supports dynamic fees.
§

fn kind(&self) -> TxKind

Returns the transaction kind.
§

fn is_create(&self) -> bool

Returns true if the transaction is a contract creation. We don’t provide a default implementation via kind as it copies the 21-byte [TxKind] for this simple check. A proper implementation shouldn’t allocate.
§

fn value(&self) -> Uint<256, 4>

Get value.
§

fn input(&self) -> &Bytes

Get data.
§

fn access_list(&self) -> Option<&AccessList>

Returns the EIP-2930 access_list for the particular transaction type. Returns None for older transaction types.
§

fn blob_versioned_hashes(&self) -> Option<&[FixedBytes<32>]>

Blob versioned hashes for eip4844 transaction. For previous transaction types this is None.
§

fn authorization_list(&self) -> Option<&[SignedAuthorization]>

Returns the [SignedAuthorization] list of the transaction. Read more
§

fn effective_tip_per_gas(&self, base_fee: u64) -> Option<u128>

Returns the effective tip for this transaction. Read more
§

fn to(&self) -> Option<Address>

Get the transaction’s address of the contract that will be called, or the address that will receive the transfer. Read more
§

fn function_selector(&self) -> Option<&FixedBytes<4>>

Returns the first 4bytes of the calldata for a function call. Read more
§

fn blob_count(&self) -> Option<u64>

Returns the number of blobs of this transaction. Read more
§

fn blob_gas_used(&self) -> Option<u64>

Returns the total gas for all blobs in this transaction. Read more
§

fn authorization_count(&self) -> Option<u64>

Returns the number of blobs of [SignedAuthorization] in this transactions Read more
§

impl TryFrom<EthereumTxEnvelope<TxEip4844Variant>> for EthereumTxEnvelope<TxEip4844WithSidecar>

§

type Error = ValueError<EthereumTxEnvelope<TxEip4844Variant>>

The type returned in the event of a conversion error.
§

fn try_from( value: EthereumTxEnvelope<TxEip4844Variant>, ) -> Result<EthereumTxEnvelope<TxEip4844WithSidecar>, <EthereumTxEnvelope<TxEip4844WithSidecar> as TryFrom<EthereumTxEnvelope<TxEip4844Variant>>>::Error>

Performs the conversion.
§

impl TryFrom<Signed<TxEip4844Variant>> for EthereumTxEnvelope<TxEip4844WithSidecar>

§

type Error = ValueError<Signed<TxEip4844Variant>>

The type returned in the event of a conversion error.
§

fn try_from( value: Signed<TxEip4844Variant>, ) -> Result<EthereumTxEnvelope<TxEip4844WithSidecar>, <EthereumTxEnvelope<TxEip4844WithSidecar> as TryFrom<Signed<TxEip4844Variant>>>::Error>

Performs the conversion.
§

impl<Eip4844> Typed2718 for EthereumTxEnvelope<Eip4844>
where Eip4844: Typed2718,

§

fn ty(&self) -> u8

Returns the EIP-2718 type flag.
§

fn is_type(&self, ty: u8) -> bool

Returns true if the type matches the given type.
§

fn is_legacy(&self) -> bool

Returns true if the type is a legacy transaction.
§

fn is_eip2930(&self) -> bool

Returns true if the type is an EIP-2930 transaction.
§

fn is_eip1559(&self) -> bool

Returns true if the type is an EIP-1559 transaction.
§

fn is_eip4844(&self) -> bool

Returns true if the type is an EIP-4844 transaction.
§

fn is_eip7702(&self) -> bool

Returns true if the type is an EIP-7702 transaction.
§

impl<Eip4844> Eq for EthereumTxEnvelope<Eip4844>
where Eip4844: RlpEcdsaEncodableTx + PartialEq,

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: 416 bytes

Size for each variant:

  • Legacy: 256 bytes
  • Eip2930: 272 bytes
  • Eip1559: 288 bytes
  • Eip4844: 400 bytes
  • Eip7702: 304 bytes