pub struct AnyRpcTransaction(pub WithOtherFields<Transaction<AnyTxEnvelope>>);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 const fn new(inner: WithOtherFields<Transaction<AnyTxEnvelope>>) -> Self
pub const fn new(inner: WithOtherFields<Transaction<AnyTxEnvelope>>) -> Self
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 as_legacy(&self) -> Option<&Signed<TxLegacy>>
pub fn as_legacy(&self) -> Option<&Signed<TxLegacy>>
Returns the TxLegacy variant if the transaction is a legacy transaction.
Sourcepub fn as_eip2930(&self) -> Option<&Signed<TxEip2930>>
pub fn as_eip2930(&self) -> Option<&Signed<TxEip2930>>
Returns the TxEip2930 variant if the transaction is an EIP-2930 transaction.
Sourcepub fn as_eip1559(&self) -> Option<&Signed<TxEip1559>>
pub fn as_eip1559(&self) -> Option<&Signed<TxEip1559>>
Returns the TxEip1559 variant if the transaction is an EIP-1559 transaction.
Sourcepub fn as_eip4844(&self) -> Option<&Signed<TxEip4844Variant>>
pub fn as_eip4844(&self) -> Option<&Signed<TxEip4844Variant>>
Returns the TxEip4844Variant variant if the transaction is an EIP-4844 transaction.
Sourcepub fn as_eip7702(&self) -> Option<&Signed<TxEip7702>>
pub fn as_eip7702(&self) -> Option<&Signed<TxEip7702>>
Returns the TxEip7702 variant if the transaction is an EIP-7702 transaction.
Sourcepub fn is_eip2930(&self) -> bool
pub fn is_eip2930(&self) -> bool
Returns true if the transaction is an EIP-2930 transaction.
Sourcepub fn is_eip1559(&self) -> bool
pub fn is_eip1559(&self) -> bool
Returns true if the transaction is an EIP-1559 transaction.
Sourcepub fn is_eip4844(&self) -> bool
pub fn is_eip4844(&self) -> bool
Returns true if the transaction is an EIP-4844 transaction.
Sourcepub fn is_eip7702(&self) -> bool
pub fn is_eip7702(&self) -> bool
Returns true if the transaction is an EIP-7702 transaction.
Sourcepub fn try_into_either<T>(self) -> Result<Either<TxEnvelope, T>, T::Error>where
T: TryFrom<Self>,
pub fn try_into_either<T>(self) -> Result<Either<TxEnvelope, T>, T::Error>where
T: TryFrom<Self>,
Attempts to convert the AnyRpcTransaction 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 try_unknown_into_either<T>(
self,
) -> Result<Either<TxEnvelope, T>, T::Error>where
T: TryFrom<UnknownTxEnvelope>,
pub fn try_unknown_into_either<T>(
self,
) -> Result<Either<TxEnvelope, T>, T::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::Error>where
U: TryFrom<AnyTxEnvelope>,
pub fn try_convert<U>(self) -> Result<Transaction<U>, U::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<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<AnyRpcTransaction> for AnyTxEnvelope
impl From<AnyRpcTransaction> for AnyTxEnvelope
Source§fn from(tx: AnyRpcTransaction) -> Self
fn from(tx: AnyRpcTransaction) -> Self
Source§impl From<AnyRpcTransaction> for Recovered<AnyTxEnvelope>
impl From<AnyRpcTransaction> for Recovered<AnyTxEnvelope>
Source§fn from(tx: AnyRpcTransaction) -> Self
fn from(tx: AnyRpcTransaction) -> Self
Source§impl From<AnyRpcTransaction> for Transaction<AnyTxEnvelope>
impl From<AnyRpcTransaction> for Transaction<AnyTxEnvelope>
Source§fn from(tx: AnyRpcTransaction) -> Self
fn from(tx: AnyRpcTransaction) -> Self
Source§impl From<AnyRpcTransaction> for WithOtherFields<Transaction<AnyTxEnvelope>>
impl From<AnyRpcTransaction> for WithOtherFields<Transaction<AnyTxEnvelope>>
Source§fn from(tx: AnyRpcTransaction) -> Self
fn from(tx: AnyRpcTransaction) -> Self
Source§impl From<Transaction> for AnyRpcTransaction
impl From<Transaction> for AnyRpcTransaction
Source§fn from(tx: Transaction<TxEnvelope>) -> Self
fn from(tx: Transaction<TxEnvelope>) -> Self
Source§impl From<WithOtherFields<Transaction<AnyTxEnvelope>>> for AnyRpcTransaction
impl From<WithOtherFields<Transaction<AnyTxEnvelope>>> for AnyRpcTransaction
Source§fn from(value: WithOtherFields<Transaction<AnyTxEnvelope>>) -> Self
fn from(value: WithOtherFields<Transaction<AnyTxEnvelope>>) -> Self
Source§impl PartialEq for AnyRpcTransaction
impl PartialEq for AnyRpcTransaction
Source§impl Serialize for AnyRpcTransaction
impl Serialize for AnyRpcTransaction
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<&[B256]>
fn blob_versioned_hashes(&self) -> Option<&[B256]>
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 block_hash(&self) -> Option<BlockHash>
fn block_hash(&self) -> Option<BlockHash>
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 TryFrom<AnyRpcTransaction> for TxEnvelope
impl TryFrom<AnyRpcTransaction> for TxEnvelope
Source§type Error = ValueError<AnyTxEnvelope>
type Error = ValueError<AnyTxEnvelope>
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§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.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 moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.