Enum OpTypedTransaction
pub enum OpTypedTransaction {
Legacy(TxLegacy),
Eip2930(TxEip2930),
Eip1559(TxEip1559),
Eip7702(TxEip7702),
Deposit(TxDeposit),
}Expand description
Typed transaction enum corresponding to the [OpTxEnvelope] envelope.
Variants§
Legacy(TxLegacy)
An untagged [TxLegacy].
Eip2930(TxEip2930)
A [TxEip2930] tagged with type 1.
Eip1559(TxEip1559)
A [TxEip1559] tagged with type 2.
Eip7702(TxEip7702)
A [TxEip7702] tagged with type 4.
Deposit(TxDeposit)
A [TxDeposit] tagged with type 0x7E.
Implementations§
§impl OpTypedTransaction
impl OpTypedTransaction
pub fn checked_signature_hash(&self) -> Option<FixedBytes<32>>
pub fn checked_signature_hash(&self) -> Option<FixedBytes<32>>
Calculates the signing hash for the transaction.
Returns None if the tx is a deposit transaction.
pub const fn eip2930(&self) -> Option<&TxEip2930>
pub const fn eip2930(&self) -> Option<&TxEip2930>
Return the inner EIP-2930 transaction if it exists.
pub const fn eip1559(&self) -> Option<&TxEip1559>
pub const fn eip1559(&self) -> Option<&TxEip1559>
Return the inner EIP-1559 transaction if it exists.
pub const fn is_deposit(&self) -> bool
pub const fn is_deposit(&self) -> bool
Returns true if transaction is deposit transaction.
pub fn tx_hash(&self, signature: &Signature) -> FixedBytes<32>
pub fn tx_hash(&self, signature: &Signature) -> FixedBytes<32>
Calculate the transaction hash for the given signature.
Note: Returns the regular tx hash if this is a deposit variant
pub fn into_envelope(self, signature: Signature) -> OpTxEnvelope
pub fn into_envelope(self, signature: Signature) -> OpTxEnvelope
Convenience function to convert this typed transaction into an [OpTxEnvelope].
Note: If this is a OpTypedTransaction::Deposit variant, the signature will be ignored.
pub fn try_into_eth(
self,
) -> Result<EthereumTypedTransaction<TxEip4844Variant>, ValueError<OpTypedTransaction>>
pub fn try_into_eth( self, ) -> Result<EthereumTypedTransaction<TxEip4844Variant>, ValueError<OpTypedTransaction>>
Attempts to convert the optimism variant into an ethereum [TypedTransaction].
Returns the typed transaction as error if it is a variant unsupported on ethereum:
[TxDeposit]
pub fn try_into_eth_variant<Eip4844>(
self,
) -> Result<EthereumTypedTransaction<Eip4844>, ValueError<OpTypedTransaction>>
pub fn try_into_eth_variant<Eip4844>( self, ) -> Result<EthereumTypedTransaction<Eip4844>, ValueError<OpTypedTransaction>>
Attempts to convert the optimism variant into an ethereum [TypedTransaction].
Returns the typed transaction as error if it is a variant unsupported on ethereum:
[TxDeposit]
Trait Implementations§
§impl Arbitrary<'_> for OpTypedTransactionwhere
TxLegacy: for<'a> Arbitrary<'a>,
TxEip2930: for<'a> Arbitrary<'a>,
TxEip1559: for<'a> Arbitrary<'a>,
TxEip7702: for<'a> Arbitrary<'a>,
TxDeposit: for<'a> Arbitrary<'a>,
impl Arbitrary<'_> for OpTypedTransactionwhere
TxLegacy: for<'a> Arbitrary<'a>,
TxEip2930: for<'a> Arbitrary<'a>,
TxEip1559: for<'a> Arbitrary<'a>,
TxEip7702: for<'a> Arbitrary<'a>,
TxDeposit: for<'a> Arbitrary<'a>,
§fn arbitrary(u: &mut Unstructured<'_>) -> Result<OpTypedTransaction, Error>
fn arbitrary(u: &mut Unstructured<'_>) -> Result<OpTypedTransaction, Error>
Self from the given unstructured data. Read more§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self from the entirety of the given
unstructured data. Read more§impl Clone for OpTypedTransaction
impl Clone for OpTypedTransaction
§fn clone(&self) -> OpTypedTransaction
fn clone(&self) -> OpTypedTransaction
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Compact for OpTypedTransaction
impl Compact for OpTypedTransaction
§fn to_compact<B>(&self, out: &mut B) -> usize
fn to_compact<B>(&self, out: &mut B) -> usize
§fn from_compact(buf: &[u8], identifier: usize) -> (OpTypedTransaction, &[u8])
fn from_compact(buf: &[u8], identifier: usize) -> (OpTypedTransaction, &[u8])
buf with its internal cursor
advanced (eg..advance(len)). Read more§fn specialized_to_compact<B>(&self, buf: &mut B) -> usize
fn specialized_to_compact<B>(&self, buf: &mut B) -> usize
§fn specialized_from_compact(buf: &[u8], len: usize) -> (Self, &[u8])
fn specialized_from_compact(buf: &[u8], len: usize) -> (Self, &[u8])
§impl Debug for OpTypedTransaction
impl Debug for OpTypedTransaction
§impl<'de> Deserialize<'de> for OpTypedTransactionwhere
MaybeTaggedOpTypedTransaction: Deserialize<'de>,
impl<'de> Deserialize<'de> for OpTypedTransactionwhere
MaybeTaggedOpTypedTransaction: Deserialize<'de>,
§fn deserialize<D>(
deserializer: D,
) -> Result<OpTypedTransaction, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<OpTypedTransaction, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
§impl From<MaybeTaggedOpTypedTransaction> for OpTypedTransaction
impl From<MaybeTaggedOpTypedTransaction> for OpTypedTransaction
§fn from(value: MaybeTaggedOpTypedTransaction) -> OpTypedTransaction
fn from(value: MaybeTaggedOpTypedTransaction) -> OpTypedTransaction
§impl From<OpTxEnvelope> for OpTypedTransaction
impl From<OpTxEnvelope> for OpTypedTransaction
§fn from(envelope: OpTxEnvelope) -> OpTypedTransaction
fn from(envelope: OpTxEnvelope) -> OpTypedTransaction
§impl From<TaggedOpTypedTransaction> for OpTypedTransaction
impl From<TaggedOpTypedTransaction> for OpTypedTransaction
§fn from(value: TaggedOpTypedTransaction) -> OpTypedTransaction
fn from(value: TaggedOpTypedTransaction) -> OpTypedTransaction
§impl From<TxDeposit> for OpTypedTransaction
impl From<TxDeposit> for OpTypedTransaction
§fn from(tx: TxDeposit) -> OpTypedTransaction
fn from(tx: TxDeposit) -> OpTypedTransaction
§impl From<TxEip1559> for OpTypedTransaction
impl From<TxEip1559> for OpTypedTransaction
§fn from(tx: TxEip1559) -> OpTypedTransaction
fn from(tx: TxEip1559) -> OpTypedTransaction
§impl From<TxEip2930> for OpTypedTransaction
impl From<TxEip2930> for OpTypedTransaction
§fn from(tx: TxEip2930) -> OpTypedTransaction
fn from(tx: TxEip2930) -> OpTypedTransaction
§impl From<TxEip7702> for OpTypedTransaction
impl From<TxEip7702> for OpTypedTransaction
§fn from(tx: TxEip7702) -> OpTypedTransaction
fn from(tx: TxEip7702) -> OpTypedTransaction
§impl From<TxLegacy> for OpTypedTransaction
impl From<TxLegacy> for OpTypedTransaction
§fn from(tx: TxLegacy) -> OpTypedTransaction
fn from(tx: TxLegacy) -> OpTypedTransaction
§impl Hash for OpTypedTransaction
impl Hash for OpTypedTransaction
§impl InMemorySize for OpTypedTransaction
impl InMemorySize for OpTypedTransaction
§impl IsTyped2718 for OpTypedTransaction
impl IsTyped2718 for OpTypedTransaction
§impl PartialEq for OpTypedTransaction
impl PartialEq for OpTypedTransaction
§impl Serialize for OpTypedTransaction
impl Serialize for OpTypedTransaction
§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,
§impl SignableTransaction<Signature> for OpTypedTransaction
impl SignableTransaction<Signature> for OpTypedTransaction
§fn set_chain_id(&mut self, chain_id: u64)
fn set_chain_id(&mut self, chain_id: u64)
chain_id. Read more§fn encode_for_signing(&self, out: &mut dyn BufMut)
fn encode_for_signing(&self, out: &mut dyn BufMut)
§fn payload_len_for_signature(&self) -> usize
fn payload_len_for_signature(&self) -> usize
§fn into_signed(self, signature: Signature) -> Signed<OpTypedTransaction>where
OpTypedTransaction: Sized,
fn into_signed(self, signature: Signature) -> Signed<OpTypedTransaction>where
OpTypedTransaction: Sized,
Signed] object.§fn set_chain_id_checked(&mut self, chain_id: u64) -> bool
fn set_chain_id_checked(&mut self, chain_id: u64) -> bool
chain_id if it is not already set. Checks that the provided chain_id matches the
existing chain_id if it is already set, returning false if they do not match.§fn encoded_for_signing(&self) -> Vec<u8> ⓘ
fn encoded_for_signing(&self) -> Vec<u8> ⓘ
signature_hash. Read more§fn signature_hash(&self) -> FixedBytes<32>
fn signature_hash(&self) -> FixedBytes<32>
§impl Transaction for OpTypedTransactionwhere
OpTypedTransaction: Debug,
TxLegacy: Transaction,
TxEip2930: Transaction,
TxEip1559: Transaction,
TxEip7702: Transaction,
TxDeposit: Transaction,
impl Transaction for OpTypedTransactionwhere
OpTypedTransaction: Debug,
TxLegacy: Transaction,
TxEip2930: Transaction,
TxEip1559: Transaction,
TxEip7702: Transaction,
TxDeposit: Transaction,
§fn max_fee_per_gas(&self) -> u128
fn max_fee_per_gas(&self) -> u128
§fn max_priority_fee_per_gas(&self) -> Option<u128>
fn max_priority_fee_per_gas(&self) -> Option<u128>
§fn max_fee_per_blob_gas(&self) -> Option<u128>
fn max_fee_per_blob_gas(&self) -> Option<u128>
§fn priority_fee_or_price(&self) -> u128
fn priority_fee_or_price(&self) -> u128
§fn effective_gas_price(&self, base_fee: Option<u64>) -> u128
fn effective_gas_price(&self, base_fee: Option<u64>) -> u128
§fn is_dynamic_fee(&self) -> bool
fn is_dynamic_fee(&self) -> bool
true if the transaction supports dynamic fees.§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.§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.§fn blob_versioned_hashes(&self) -> Option<&[FixedBytes<32>]>
fn blob_versioned_hashes(&self) -> Option<&[FixedBytes<32>]>
None.SignedAuthorization] list of the transaction. Read more§fn effective_tip_per_gas(&self, base_fee: u64) -> Option<u128>
fn effective_tip_per_gas(&self, base_fee: u64) -> Option<u128>
§fn to(&self) -> Option<Address>
fn to(&self) -> Option<Address>
§fn function_selector(&self) -> Option<&FixedBytes<4>>
fn function_selector(&self) -> Option<&FixedBytes<4>>
§fn blob_count(&self) -> Option<u64>
fn blob_count(&self) -> Option<u64>
§fn blob_gas_used(&self) -> Option<u64>
fn blob_gas_used(&self) -> Option<u64>
SignedAuthorization] in this transactions Read more§impl Typed2718 for OpTypedTransactionwhere
TxLegacy: Typed2718,
TxEip2930: Typed2718,
TxEip1559: Typed2718,
TxEip7702: Typed2718,
TxDeposit: Typed2718,
impl Typed2718 for OpTypedTransactionwhere
TxLegacy: Typed2718,
TxEip2930: Typed2718,
TxEip1559: Typed2718,
TxEip7702: Typed2718,
TxDeposit: Typed2718,
§fn is_eip2930(&self) -> bool
fn is_eip2930(&self) -> bool
§fn is_eip1559(&self) -> bool
fn is_eip1559(&self) -> bool
§fn is_eip4844(&self) -> bool
fn is_eip4844(&self) -> bool
§fn is_eip7702(&self) -> bool
fn is_eip7702(&self) -> bool
impl Eq for OpTypedTransaction
impl StructuralPartialEq for OpTypedTransaction
Auto Trait Implementations§
impl !Freeze for OpTypedTransaction
impl RefUnwindSafe for OpTypedTransaction
impl Send for OpTypedTransaction
impl Sync for OpTypedTransaction
impl Unpin for OpTypedTransaction
impl UnwindSafe for OpTypedTransaction
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,
§impl<T> Conv for T
impl<T> Conv for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> FmtForward for T
impl<T> FmtForward for T
§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.§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.§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.§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.§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.§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.§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.§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.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§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 more§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 more§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
§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
§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.§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.§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.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Tap for T
impl<T> Tap for T
§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 more§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 more§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 more§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 more§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 more§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 more§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.§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.§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.§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.§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.§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.§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.§impl<T> TryConv for T
impl<T> TryConv for T
§impl<T> TxHashable<Signature> for Twhere
T: RlpEcdsaEncodableTx,
impl<T> TxHashable<Signature> for Twhere
T: RlpEcdsaEncodableTx,
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<A> ArbInterop for A
impl<'de, T> BorrowedRpcObject<'de> for Twhere
T: RpcBorrow<'de> + RpcSend,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> FullTransaction for Twhere
T: Transaction + MaybeCompact,
impl<T> MaybeCompact for Twhere
T: Compact,
impl<T> MaybeSerde for Twhere
T: Serialize + for<'de> Deserialize<'de>,
impl<'de, T> RpcBorrow<'de> for T
impl<T> RpcObject for Twhere
T: RpcSend + RpcRecv,
impl<T> RpcRecv for T
impl<T> RpcSend for T
impl<T> Transaction for T
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: 208 bytes
Size for each variant:
Legacy: 144 bytesEip2930: 160 bytesEip1559: 176 bytesEip7702: 192 bytesDeposit: 176 bytes