pub struct AnyRpcTransaction(pub WithOtherFields<Transaction<AnyTxEnvelope>>);
network
only.Expand description
A wrapper for AnyRpcTransaction
that allows for handling unknown transaction types.
Tuple Fields§
§0: WithOtherFields<Transaction<AnyTxEnvelope>>
Implementations§
Source§impl AnyRpcTransaction
impl AnyRpcTransaction
Sourcepub fn new(
inner: WithOtherFields<Transaction<AnyTxEnvelope>>,
) -> AnyRpcTransaction
pub fn new( inner: WithOtherFields<Transaction<AnyTxEnvelope>>, ) -> AnyRpcTransaction
Create a new AnyRpcTransaction
.
Sourcepub fn into_parts(self) -> (Transaction<AnyTxEnvelope>, OtherFields)
pub fn into_parts(self) -> (Transaction<AnyTxEnvelope>, OtherFields)
Split the transaction into its parts.
Sourcepub fn into_inner(self) -> Transaction<AnyTxEnvelope>
pub fn into_inner(self) -> Transaction<AnyTxEnvelope>
Consumes the outer layer for this transaction and returns the inner transaction.
Sourcepub fn as_envelope(&self) -> Option<&TxEnvelope>
pub fn as_envelope(&self) -> Option<&TxEnvelope>
Returns the inner transaction TxEnvelope
if inner tx type if
AnyTxEnvelope::Ethereum
.
Sourcepub fn try_into_envelope(self) -> Result<TxEnvelope, ValueError<AnyTxEnvelope>>
pub fn try_into_envelope(self) -> Result<TxEnvelope, ValueError<AnyTxEnvelope>>
Returns the inner Ethereum transaction envelope, if it is an Ethereum transaction. If the transaction is not an Ethereum transaction, it is returned as an error.
Sourcepub fn try_into_either<T>(
self,
) -> Result<Either<TxEnvelope, T>, <T as TryFrom<UnknownTxEnvelope>>::Error>where
T: TryFrom<UnknownTxEnvelope>,
pub fn try_into_either<T>(
self,
) -> Result<Either<TxEnvelope, T>, <T as TryFrom<UnknownTxEnvelope>>::Error>where
T: TryFrom<UnknownTxEnvelope>,
Attempts to convert the UnknownTxEnvelope
into Either::Right
if this is an unknown
variant.
Returns Either::Left
with the ethereum TxEnvelope
if this is the
AnyTxEnvelope::Ethereum
variant and Either::Right
with the converted variant.
Sourcepub fn map<Tx>(self, f: impl FnOnce(AnyTxEnvelope) -> Tx) -> Transaction<Tx>
pub fn map<Tx>(self, f: impl FnOnce(AnyTxEnvelope) -> Tx) -> Transaction<Tx>
Applies the given closure to the inner transaction type.
alloy_serde::OtherFields
are stripped away while mapping.
Applies the given closure to the inner transaction type.
Sourcepub fn try_map<Tx, E>(
self,
f: impl FnOnce(AnyTxEnvelope) -> Result<Tx, E>,
) -> Result<Transaction<Tx>, E>
pub fn try_map<Tx, E>( self, f: impl FnOnce(AnyTxEnvelope) -> Result<Tx, E>, ) -> Result<Transaction<Tx>, E>
Applies the given fallible closure to the inner transactions.
alloy_serde::OtherFields
are stripped away while mapping.
Sourcepub fn convert<U>(self) -> Transaction<U>where
U: From<AnyTxEnvelope>,
pub fn convert<U>(self) -> Transaction<U>where
U: From<AnyTxEnvelope>,
Converts the transaction type to the given alternative that is From<T>
.
alloy_serde::OtherFields
are stripped away while mapping.
Sourcepub fn try_convert<U>(
self,
) -> Result<Transaction<U>, <U as TryFrom<AnyTxEnvelope>>::Error>where
U: TryFrom<AnyTxEnvelope>,
pub fn try_convert<U>(
self,
) -> Result<Transaction<U>, <U as TryFrom<AnyTxEnvelope>>::Error>where
U: TryFrom<AnyTxEnvelope>,
Converts the transaction to the given alternative that is TryFrom<T>
Returns the transaction with the new transaction type if all conversions were successful.
alloy_serde::OtherFields
are stripped away while mapping.
Methods from Deref<Target = WithOtherFields<Transaction<AnyTxEnvelope>>>§
Trait Implementations§
Source§impl AsRef<AnyTxEnvelope> for AnyRpcTransaction
impl AsRef<AnyTxEnvelope> for AnyRpcTransaction
Source§fn as_ref(&self) -> &AnyTxEnvelope
fn as_ref(&self) -> &AnyTxEnvelope
Source§impl Clone for AnyRpcTransaction
impl Clone for AnyRpcTransaction
Source§fn clone(&self) -> AnyRpcTransaction
fn clone(&self) -> AnyRpcTransaction
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for AnyRpcTransaction
impl Debug for AnyRpcTransaction
Source§impl Deref for AnyRpcTransaction
impl Deref for AnyRpcTransaction
Source§type Target = WithOtherFields<Transaction<AnyTxEnvelope>>
type Target = WithOtherFields<Transaction<AnyTxEnvelope>>
Source§impl DerefMut for AnyRpcTransaction
impl DerefMut for AnyRpcTransaction
Source§impl<'de> Deserialize<'de> for AnyRpcTransaction
impl<'de> Deserialize<'de> for AnyRpcTransaction
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<AnyRpcTransaction, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<AnyRpcTransaction, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl From<AnyRpcTransaction> for AnyTxEnvelope
impl From<AnyRpcTransaction> for AnyTxEnvelope
Source§fn from(tx: AnyRpcTransaction) -> AnyTxEnvelope
fn from(tx: AnyRpcTransaction) -> AnyTxEnvelope
Source§impl From<AnyRpcTransaction> for Transaction<AnyTxEnvelope>
impl From<AnyRpcTransaction> for Transaction<AnyTxEnvelope>
Source§fn from(tx: AnyRpcTransaction) -> Transaction<AnyTxEnvelope>
fn from(tx: AnyRpcTransaction) -> Transaction<AnyTxEnvelope>
Source§impl From<AnyRpcTransaction> for WithOtherFields<Transaction<AnyTxEnvelope>>
impl From<AnyRpcTransaction> for WithOtherFields<Transaction<AnyTxEnvelope>>
Source§fn from(tx: AnyRpcTransaction) -> WithOtherFields<Transaction<AnyTxEnvelope>>
fn from(tx: AnyRpcTransaction) -> WithOtherFields<Transaction<AnyTxEnvelope>>
Source§impl From<Transaction> for AnyRpcTransaction
impl From<Transaction> for AnyRpcTransaction
Source§fn from(tx: Transaction) -> AnyRpcTransaction
fn from(tx: Transaction) -> AnyRpcTransaction
Source§impl From<WithOtherFields<Transaction<AnyTxEnvelope>>> for AnyRpcTransaction
impl From<WithOtherFields<Transaction<AnyTxEnvelope>>> for AnyRpcTransaction
Source§fn from(value: WithOtherFields<Transaction<AnyTxEnvelope>>) -> AnyRpcTransaction
fn from(value: WithOtherFields<Transaction<AnyTxEnvelope>>) -> AnyRpcTransaction
Source§impl PartialEq for AnyRpcTransaction
impl PartialEq for AnyRpcTransaction
Source§impl Serialize for AnyRpcTransaction
impl Serialize for AnyRpcTransaction
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Source§impl Transaction for AnyRpcTransaction
impl Transaction for AnyRpcTransaction
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 effective_gas_price(&self, base_fee: Option<u64>) -> u128
fn effective_gas_price(&self, base_fee: Option<u64>) -> u128
Source§fn is_dynamic_fee(&self) -> bool
fn is_dynamic_fee(&self) -> bool
true
if the transaction supports dynamic fees.Source§fn is_create(&self) -> bool
fn is_create(&self) -> bool
kind
as it copies the 21-byte
TxKind
for this simple check. A proper implementation shouldn’t allocate.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<&[FixedBytes<32>]>
fn blob_versioned_hashes(&self) -> Option<&[FixedBytes<32>]>
None
.SignedAuthorization
list of the transaction. Read moreSource§fn effective_tip_per_gas(&self, base_fee: u64) -> Option<u128>
fn effective_tip_per_gas(&self, base_fee: u64) -> Option<u128>
Source§fn to(&self) -> Option<Address>
fn to(&self) -> Option<Address>
Source§fn function_selector(&self) -> Option<&FixedBytes<4>>
fn function_selector(&self) -> Option<&FixedBytes<4>>
Source§fn blob_count(&self) -> Option<u64>
fn blob_count(&self) -> Option<u64>
Source§fn blob_gas_used(&self) -> Option<u64>
fn blob_gas_used(&self) -> Option<u64>
SignedAuthorization
in this transactions Read moreSource§impl TransactionResponse for AnyRpcTransaction
impl TransactionResponse for AnyRpcTransaction
Source§fn tx_hash(&self) -> FixedBytes<32>
fn tx_hash(&self) -> FixedBytes<32>
Source§fn block_hash(&self) -> Option<FixedBytes<32>>
fn block_hash(&self) -> Option<FixedBytes<32>>
Source§fn block_number(&self) -> Option<u64>
fn block_number(&self) -> Option<u64>
Source§fn transaction_index(&self) -> Option<u64>
fn transaction_index(&self) -> Option<u64>
Source§fn gas_price(&self) -> Option<u128>
fn gas_price(&self) -> Option<u128>
max_fee_per_gas
, pre-eip-1559.Source§fn max_fee_per_gas(&self) -> Option<u128>
fn max_fee_per_gas(&self) -> Option<u128>
gas_price
is used instead.Source§fn transaction_type(&self) -> Option<u8>
fn transaction_type(&self) -> Option<u8>
Source§impl Typed2718 for AnyRpcTransaction
impl Typed2718 for AnyRpcTransaction
Source§fn is_eip2930(&self) -> bool
fn is_eip2930(&self) -> bool
Source§fn is_eip1559(&self) -> bool
fn is_eip1559(&self) -> bool
Source§fn is_eip4844(&self) -> bool
fn is_eip4844(&self) -> bool
Source§fn is_eip7702(&self) -> bool
fn is_eip7702(&self) -> bool
impl Eq for AnyRpcTransaction
impl StructuralPartialEq for AnyRpcTransaction
Auto Trait Implementations§
impl !Freeze for AnyRpcTransaction
impl RefUnwindSafe for AnyRpcTransaction
impl Send for AnyRpcTransaction
impl Sync for AnyRpcTransaction
impl Unpin for AnyRpcTransaction
impl UnwindSafe for AnyRpcTransaction
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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 more