pub enum TypedTransaction {
    Legacy(TransactionRequest),
    Eip2930(Eip2930TransactionRequest),
    Eip1559(Eip1559TransactionRequest),
    DepositTransaction(DepositTransaction),
}
Expand description

The TypedTransaction enum represents all Ethereum transaction types.

Its variants correspond to specific allowed transactions:

  1. Legacy (pre-EIP2718) TransactionRequest
  2. EIP2930 (state access lists) Eip2930TransactionRequest
  3. EIP1559 Eip1559TransactionRequest

To support Kovan and other non-London-compatbile networks, please enable the legacy crate feature. This will disable the type flag in the serialized transaction, and cause contract calls and other common actions to default to using the legacy transaction type.

Variants§

Implementations§

source§

impl TypedTransaction

source

pub fn from(&self) -> Option<&Address>

source

pub fn set_from(&mut self, from: Address) -> &mut Self

source

pub fn to(&self) -> Option<&NameOrAddress>

source

pub fn to_addr(&self) -> Option<&Address>

source

pub fn set_to<T: Into<NameOrAddress>>(&mut self, to: T) -> &mut Self

source

pub fn nonce(&self) -> Option<&U256>

source

pub fn set_nonce<T: Into<U256>>(&mut self, nonce: T) -> &mut Self

source

pub fn value(&self) -> Option<&U256>

source

pub fn set_value<T: Into<U256>>(&mut self, value: T) -> &mut Self

source

pub fn gas(&self) -> Option<&U256>

source

pub fn gas_mut(&mut self) -> &mut Option<U256>

source

pub fn set_gas<T: Into<U256>>(&mut self, gas: T) -> &mut Self

source

pub fn gas_price(&self) -> Option<U256>

source

pub fn set_gas_price<T: Into<U256>>(&mut self, gas_price: T) -> &mut Self

source

pub fn chain_id(&self) -> Option<U64>

source

pub fn set_chain_id<T: Into<U64>>(&mut self, chain_id: T) -> &mut Self

source

pub fn data(&self) -> Option<&Bytes>

source

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

source

pub fn set_access_list(&mut self, access_list: AccessList) -> &mut Self

source

pub fn set_data(&mut self, data: Bytes) -> &mut Self

source

pub fn rlp_signed(&self, signature: &Signature) -> Bytes

source

pub fn rlp(&self) -> Bytes

source

pub fn sighash(&self) -> H256

Hashes the transaction’s data. Does not double-RLP encode

source

pub fn max_cost(&self) -> Option<U256>

Max cost of the transaction

source

pub fn hash(&self, signature: &Signature) -> H256

Hashes the transaction’s data with the included signature.

source

pub fn decode_signed( rlp: &Rlp<'_> ) -> Result<(Self, Signature), TypedTransactionError>

Decodes a signed TypedTransaction from a rlp encoded byte stream

source§

impl TypedTransaction

Trait Implementations§

source§

impl Clone for TypedTransaction

source§

fn clone(&self) -> TypedTransaction

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
source§

impl Debug for TypedTransaction

source§

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

Formats the value using the given formatter. Read more
source§

impl Decodable for TypedTransaction

Get a TypedTransaction directly from a rlp encoded byte stream

source§

fn decode(rlp: &Rlp<'_>) -> Result<Self, DecoderError>

Decode a value from RLP bytes
source§

impl Default for TypedTransaction

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for TypedTransaction

source§

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

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

impl From<&Transaction> for TypedTransaction

source§

fn from(tx: &Transaction) -> TypedTransaction

Converts to this type from the input type.
source§

impl From<DepositTransaction> for TypedTransaction

source§

fn from(src: DepositTransaction) -> TypedTransaction

Converts to this type from the input type.
source§

impl From<Eip1559TransactionRequest> for TypedTransaction

source§

fn from(src: Eip1559TransactionRequest) -> TypedTransaction

Converts to this type from the input type.
source§

impl From<Eip2930TransactionRequest> for TypedTransaction

source§

fn from(src: Eip2930TransactionRequest) -> TypedTransaction

Converts to this type from the input type.
source§

impl From<TransactionRequest> for TypedTransaction

source§

fn from(src: TransactionRequest) -> TypedTransaction

Converts to this type from the input type.
source§

impl From<TypedTransaction> for Eip1559TransactionRequest

source§

fn from(src: TypedTransaction) -> Eip1559TransactionRequest

Converts to this type from the input type.
source§

impl From<TypedTransaction> for Eip2930TransactionRequest

source§

fn from(src: TypedTransaction) -> Eip2930TransactionRequest

Converts to this type from the input type.
source§

impl From<TypedTransaction> for TransactionRequest

source§

fn from(src: TypedTransaction) -> TransactionRequest

Converts to this type from the input type.
source§

impl PartialEq for TypedTransaction

source§

fn eq(&self, other: &TypedTransaction) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

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

impl Serialize for TypedTransaction

source§

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

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

impl Eq for TypedTransaction

source§

impl StructuralPartialEq for TypedTransaction

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

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

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> JsonSchemaMaybe for T