Struct OpTransaction
pub struct OpTransaction<T>where
T: Transaction,{
pub base: T,
pub enveloped_tx: Option<Bytes>,
pub deposit: DepositTransactionParts,
}Expand description
Optimism transaction.
Fields§
§base: TBase transaction fields.
enveloped_tx: Option<Bytes>An enveloped EIP-2718 typed transaction
This is used to compute the L1 tx cost using the L1 block info, as opposed to requiring downstream apps to compute the cost externally.
deposit: DepositTransactionPartsDeposit transaction parts.
Implementations§
§impl<T> OpTransaction<T>where
T: Transaction,
impl<T> OpTransaction<T>where
T: Transaction,
pub fn new(base: T) -> OpTransaction<T>
pub fn new(base: T) -> OpTransaction<T>
Create a new Optimism transaction.
§impl OpTransaction<TxEnv>
impl OpTransaction<TxEnv>
pub fn builder() -> OpTransactionBuilder
pub fn builder() -> OpTransactionBuilder
Create a new Optimism transaction.
Trait Implementations§
§impl<T> AsRef<T> for OpTransaction<T>where
T: Transaction,
impl<T> AsRef<T> for OpTransaction<T>where
T: Transaction,
§impl<T> Clone for OpTransaction<T>where
T: Clone + Transaction,
impl<T> Clone for OpTransaction<T>where
T: Clone + Transaction,
§fn clone(&self) -> OpTransaction<T>
fn clone(&self) -> OpTransaction<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl<T> Debug for OpTransaction<T>where
T: Debug + Transaction,
impl<T> Debug for OpTransaction<T>where
T: Debug + Transaction,
§impl Default for OpTransaction<TxEnv>
impl Default for OpTransaction<TxEnv>
§fn default() -> OpTransaction<TxEnv>
fn default() -> OpTransaction<TxEnv>
Returns the “default value” for a type. Read more
§impl FromRecoveredTx<OpTxEnvelope> for OpTransaction<TxEnv>
impl FromRecoveredTx<OpTxEnvelope> for OpTransaction<TxEnv>
§fn from_recovered_tx(tx: &OpTxEnvelope, sender: Address) -> OpTransaction<TxEnv>
fn from_recovered_tx(tx: &OpTxEnvelope, sender: Address) -> OpTransaction<TxEnv>
Builds a
TxEnv from a transaction and a sender address.§impl FromTxWithEncoded<OpTxEnvelope> for OpTransaction<TxEnv>
impl FromTxWithEncoded<OpTxEnvelope> for OpTransaction<TxEnv>
§fn from_encoded_tx(
tx: &OpTxEnvelope,
caller: Address,
encoded: Bytes,
) -> OpTransaction<TxEnv>
fn from_encoded_tx( tx: &OpTxEnvelope, caller: Address, encoded: Bytes, ) -> OpTransaction<TxEnv>
Builds a
TxEnv from a transaction, its sender, and encoded transaction bytes.§impl<T> IntoTxEnv<OpTransaction<T>> for OpTransaction<T>where
T: Transaction,
impl<T> IntoTxEnv<OpTransaction<T>> for OpTransaction<T>where
T: Transaction,
§fn into_tx_env(self) -> OpTransaction<T>
fn into_tx_env(self) -> OpTransaction<T>
Converts
self into TxEnv.§impl<T> OpTxTr for OpTransaction<T>where
T: Transaction,
impl<T> OpTxTr for OpTransaction<T>where
T: Transaction,
§fn enveloped_tx(&self) -> Option<&Bytes>
fn enveloped_tx(&self) -> Option<&Bytes>
Enveloped transaction bytes.
§fn source_hash(&self) -> Option<FixedBytes<32>>
fn source_hash(&self) -> Option<FixedBytes<32>>
Source hash of the deposit transaction.
§fn is_system_transaction(&self) -> bool
fn is_system_transaction(&self) -> bool
Whether the transaction is a system transaction
§fn is_deposit(&self) -> bool
fn is_deposit(&self) -> bool
Returns
true if transaction is of type DEPOSIT_TRANSACTION_TYPE.§impl<T> PartialEq for OpTransaction<T>where
T: PartialEq + Transaction,
impl<T> PartialEq for OpTransaction<T>where
T: PartialEq + Transaction,
§impl<TX> SystemCallTx for OpTransaction<TX>where
TX: Transaction + SystemCallTx,
impl<TX> SystemCallTx for OpTransaction<TX>where
TX: Transaction + SystemCallTx,
§fn new_system_tx_with_caller(
caller: Address,
system_contract_address: Address,
data: Bytes,
) -> OpTransaction<TX>
fn new_system_tx_with_caller( caller: Address, system_contract_address: Address, data: Bytes, ) -> OpTransaction<TX>
Creates a new system transaction with a custom caller address.
§fn new_system_tx(system_contract_address: Address, data: Bytes) -> Self
fn new_system_tx(system_contract_address: Address, data: Bytes) -> Self
Creates new transaction for system call.
§impl<T> Transaction for OpTransaction<T>where
T: Transaction,
impl<T> Transaction for OpTransaction<T>where
T: Transaction,
§type AccessListItem<'a> = <T as Transaction>::AccessListItem<'a>
where
T: 'a
type AccessListItem<'a> = <T as Transaction>::AccessListItem<'a> where T: 'a
EIP-2930 Access list item type.
§type Authorization<'a> = <T as Transaction>::Authorization<'a>
where
T: 'a
type Authorization<'a> = <T as Transaction>::Authorization<'a> where T: 'a
EIP-7702 Authorization type.
§fn value(&self) -> Uint<256, 4>
fn value(&self) -> Uint<256, 4>
The value sent to the receiver of
TxKind::Call. Read more§fn access_list(
&self,
) -> Option<impl Iterator<Item = <OpTransaction<T> as Transaction>::AccessListItem<'_>>>
fn access_list( &self, ) -> Option<impl Iterator<Item = <OpTransaction<T> as Transaction>::AccessListItem<'_>>>
Access list for the transaction. Read more
§fn max_priority_fee_per_gas(&self) -> Option<u128>
fn max_priority_fee_per_gas(&self) -> Option<u128>
Maximum priority fee per gas.
§fn max_fee_per_gas(&self) -> u128
fn max_fee_per_gas(&self) -> u128
Returns maximum fee that can be paid for the transaction.
§fn gas_price(&self) -> u128
fn gas_price(&self) -> u128
Gas price for the transaction.
It is only applicable for Legacy and EIP-2930 transactions.
For Eip1559 it is max_fee_per_gas.
§fn blob_versioned_hashes(&self) -> &[FixedBytes<32>]
fn blob_versioned_hashes(&self) -> &[FixedBytes<32>]
Returns vector of fixed size hash(32 bytes) Read more
§fn max_fee_per_blob_gas(&self) -> u128
fn max_fee_per_blob_gas(&self) -> u128
Max fee per data gas Read more
§fn effective_gas_price(&self, base_fee: u128) -> u128
fn effective_gas_price(&self, base_fee: u128) -> u128
Returns effective gas price is gas price field for Legacy and Eip2930 transaction. Read more
Returns length of the authorization list. Read more
List of authorizations, that contains the signature that authorizes this
caller to place the code to signer account. Read more
§fn total_blob_gas(&self) -> u64
fn total_blob_gas(&self) -> u64
Total gas for all blobs. Max number of blocks is already checked
so we dont need to check for overflow.
§fn calc_max_data_fee(&self) -> Uint<256, 4>
fn calc_max_data_fee(&self) -> Uint<256, 4>
Calculates the maximum [EIP-4844]
data_fee of the transaction. Read more§fn max_balance_spending(&self) -> Result<Uint<256, 4>, InvalidTransaction>
fn max_balance_spending(&self) -> Result<Uint<256, 4>, InvalidTransaction>
Returns the maximum balance that can be spent by the transaction. Read more
§fn ensure_enough_balance(
&self,
balance: Uint<256, 4>,
) -> Result<(), InvalidTransaction>
fn ensure_enough_balance( &self, balance: Uint<256, 4>, ) -> Result<(), InvalidTransaction>
Checks if the caller has enough balance to cover the maximum balance spending of this transaction. Read more
§fn effective_balance_spending(
&self,
base_fee: u128,
blob_price: u128,
) -> Result<Uint<256, 4>, InvalidTransaction>
fn effective_balance_spending( &self, base_fee: u128, blob_price: u128, ) -> Result<Uint<256, 4>, InvalidTransaction>
Returns the effective balance that is going to be spent that depends on base_fee
Multiplication for gas are done in u128 type (saturated) and value is added as U256 type. Read more
§fn gas_balance_spending(
&self,
base_fee: u128,
blob_price: u128,
) -> Result<Uint<256, 4>, InvalidTransaction>
fn gas_balance_spending( &self, base_fee: u128, blob_price: u128, ) -> Result<Uint<256, 4>, InvalidTransaction>
Returns the effective balance calculated with
Self::effective_balance_spending but without the value. Read moreSource§impl<T: TransactionEnv> TransactionEnv for OpTransaction<T>
Available on crate feature op only.
impl<T: TransactionEnv> TransactionEnv for OpTransaction<T>
Available on crate feature
op only.Source§fn set_gas_limit(&mut self, gas_limit: u64)
fn set_gas_limit(&mut self, gas_limit: u64)
Set the gas limit.
Source§fn set_access_list(&mut self, access_list: AccessList)
fn set_access_list(&mut self, access_list: AccessList)
Set access list.
Source§fn with_gas_limit(self, gas_limit: u64) -> Self
fn with_gas_limit(self, gas_limit: u64) -> Self
Set the gas limit.
Source§fn with_nonce(self, nonce: u64) -> Self
fn with_nonce(self, nonce: u64) -> Self
Sets the nonce.
Source§fn with_access_list(self, access_list: AccessList) -> Self
fn with_access_list(self, access_list: AccessList) -> Self
Set access list.
impl<T> Eq for OpTransaction<T>where
T: Eq + Transaction,
impl<T> StructuralPartialEq for OpTransaction<T>where
T: Transaction,
Auto Trait Implementations§
impl<T> !Freeze for OpTransaction<T>
impl<T> RefUnwindSafe for OpTransaction<T>where
T: RefUnwindSafe,
impl<T> Send for OpTransaction<T>where
T: Send,
impl<T> Sync for OpTransaction<T>where
T: Sync,
impl<T> Unpin for OpTransaction<T>where
T: Unpin,
impl<T> UnwindSafe for OpTransaction<T>where
T: UnwindSafe,
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
Mutably borrows from an owned value. Read more
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
Compare self to
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,
Causes
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,
Causes
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,
Causes
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,
Causes
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,
Causes
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,
Causes
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,
Causes
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,
Causes
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,
Formats each item in a sequence. Read more
§impl<TxEnv, T> FromRecoveredTx<&T> for TxEnvwhere
TxEnv: FromRecoveredTx<T>,
impl<TxEnv, T> FromRecoveredTx<&T> for TxEnvwhere
TxEnv: FromRecoveredTx<T>,
§fn from_recovered_tx(tx: &&T, sender: Address) -> TxEnv
fn from_recovered_tx(tx: &&T, sender: Address) -> TxEnv
Builds a
TxEnv from a transaction and a sender address.§impl<TxEnv, T> FromTxWithEncoded<&T> for TxEnvwhere
TxEnv: FromTxWithEncoded<T>,
impl<TxEnv, T> FromTxWithEncoded<&T> for TxEnvwhere
TxEnv: FromTxWithEncoded<T>,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
Converts
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> ⓘ
Converts
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,
Pipes by value. This is generally the method you want to use. Read more
§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,
Borrows
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,
Mutably borrows
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
Borrows
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
Mutably borrows
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
Borrows
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
Immutable access to the
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
Mutable access to the
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
Immutable access to the
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
Mutable access to the
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
Immutable access to the
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
Mutable access to the
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
Calls
.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
Calls
.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
Calls
.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
Calls
.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
Calls
.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
Calls
.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
Calls
.tap_deref() only in debug builds, and is erased in release
builds.§impl<T> TryConv for T
impl<T> TryConv for T
§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<T> MaybeDebug for Twhere
T: Debug,
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.