alloy_rpc_types

Struct Transaction

source
pub struct Transaction {
Show 20 fields pub hash: FixedBytes<32>, pub nonce: u64, pub block_hash: Option<FixedBytes<32>>, pub block_number: Option<u64>, pub transaction_index: Option<u64>, pub from: Address, pub to: Option<Address>, pub value: Uint<256, 4>, pub gas_price: Option<u128>, pub gas: u64, pub max_fee_per_gas: Option<u128>, pub max_priority_fee_per_gas: Option<u128>, pub max_fee_per_blob_gas: Option<u128>, pub input: Bytes, pub signature: Option<Signature>, pub chain_id: Option<u64>, pub blob_versioned_hashes: Option<Vec<FixedBytes<32>>>, pub access_list: Option<AccessList>, pub transaction_type: Option<u8>, pub authorization_list: Option<Vec<SignedAuthorization>>,
}
Available on crate feature eth only.
Expand description

Transaction object used in RPC

Fields§

§hash: FixedBytes<32>

Hash

§nonce: u64

Nonce

§block_hash: Option<FixedBytes<32>>

Block hash

§block_number: Option<u64>

Block number

§transaction_index: Option<u64>

Transaction Index

§from: Address

Sender

§to: Option<Address>

Recipient

§value: Uint<256, 4>

Transferred value

§gas_price: Option<u128>

Gas Price

§gas: u64

Gas amount

§max_fee_per_gas: Option<u128>

Max BaseFeePerGas the user is willing to pay.

§max_priority_fee_per_gas: Option<u128>

The miner’s tip.

§max_fee_per_blob_gas: Option<u128>

Configured max fee per blob gas for eip-4844 transactions

§input: Bytes

Data

§signature: Option<Signature>

All flattened fields of the transaction signature.

Note: this is an option so special transaction types without a signature (e.g. https://github.com/ethereum-optimism/optimism/blob/0bf643c4147b43cd6f25a759d331ef3a2a61a2a3/specs/deposits.md#the-deposited-transaction-type) can be supported.

§chain_id: Option<u64>

The chain id of the transaction, if any.

§blob_versioned_hashes: Option<Vec<FixedBytes<32>>>

Contains the blob hashes for eip-4844 transactions.

§access_list: Option<AccessList>

EIP2930

Pre-pay to warm storage access.

§transaction_type: Option<u8>

EIP2718

Transaction type, Some(4) for EIP-7702 transaction, Some(3) for EIP-4844 transaction, Some(2) for EIP-1559 transaction, Some(1) for AccessList transaction, None or Some(0) for Legacy

§authorization_list: Option<Vec<SignedAuthorization>>

The signed authorization list is a list of tuples that store the address to code which the signer desires to execute in the context of their EOA and their signature.

Implementations§

source§

impl Transaction

source

pub const fn is_legacy_gas(&self) -> bool

Returns true if the transaction is a legacy or 2930 transaction.

source

pub fn into_request(self) -> TransactionRequest

Converts Transaction into TransactionRequest.

During this conversion data for TransactionRequest::sidecar is not populated as it is not part of Transaction.

Trait Implementations§

source§

impl<'arbitrary> Arbitrary<'arbitrary> for Transaction

source§

fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Transaction, Error>

Generate an arbitrary value of Self from the given unstructured data. Read more
source§

fn arbitrary_take_rest( u: Unstructured<'arbitrary>, ) -> Result<Transaction, Error>

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more
source§

fn size_hint(depth: usize) -> (usize, Option<usize>)

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
source§

impl Clone for Transaction

source§

fn clone(&self) -> Transaction

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 Transaction

source§

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

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

impl Default for Transaction

source§

fn default() -> Transaction

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

impl<'de> Deserialize<'de> for Transaction

source§

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

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

impl From<&Transaction> for TransactionInfo

source§

fn from(tx: &Transaction) -> TransactionInfo

Converts to this type from the input type.
source§

impl From<Transaction> for TransactionRequest

source§

fn from(tx: Transaction) -> TransactionRequest

Converts to this type from the input type.
source§

impl PartialEq for Transaction

source§

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

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

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

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

impl Serialize for Transaction

source§

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

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

impl Transaction for Transaction

source§

fn chain_id(&self) -> Option<u64>

Get chain_id.
source§

fn nonce(&self) -> u64

Get nonce.
source§

fn gas_limit(&self) -> u64

Get gas_limit.
source§

fn gas_price(&self) -> Option<u128>

Get gas_price.
source§

fn max_fee_per_gas(&self) -> u128

Returns the EIP-1559 the maximum fee per gas the caller is willing to pay. Read more
source§

fn max_priority_fee_per_gas(&self) -> Option<u128>

Returns the EIP-1559 Priority fee the caller is paying to the block author. Read more
source§

fn max_fee_per_blob_gas(&self) -> Option<u128>

Max fee per blob gas for EIP-4844 transaction. Read more
source§

fn priority_fee_or_price(&self) -> u128

Return the max priority fee per gas if the transaction is an EIP-1559 transaction, and otherwise return the gas price. Read more
source§

fn kind(&self) -> TxKind

Returns the transaction kind.
source§

fn value(&self) -> Uint<256, 4>

Get value.
source§

fn input(&self) -> &Bytes

Get data.
source§

fn ty(&self) -> u8

Returns the transaction type
source§

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

Returns the EIP-2930 access_list for the particular transaction type. Returns None for older transaction types.
source§

fn blob_versioned_hashes(&self) -> Option<&[FixedBytes<32>]>

Blob versioned hashes for eip4844 transaction. For previous transaction types this is None.
source§

fn authorization_list(&self) -> Option<&[SignedAuthorization]>

Returns the SignedAuthorization list of the transaction. Read more
source§

fn effective_tip_per_gas(&self, base_fee: u64) -> Option<u128>

Returns the effective tip for this transaction. Read more
source§

fn to(&self) -> Option<Address>

Get the transaction’s address of the contract that will be called, or the address that will receive the transfer. Read more
source§

impl TransactionResponse for Transaction

source§

fn tx_hash(&self) -> FixedBytes<32>

Hash of the transaction
source§

fn block_hash(&self) -> Option<FixedBytes<32>>

Block hash
source§

fn block_number(&self) -> Option<u64>

Block number
source§

fn transaction_index(&self) -> Option<u64>

Transaction Index
source§

fn from(&self) -> Address

Sender of the transaction
source§

fn to(&self) -> Option<Address>

Recipient of the transaction. Returns None if transaction is a contract creation.
source§

fn gas_price(&self) -> Option<u128>

Gas Price, this is the RPC format for max_fee_per_gas, pre-eip-1559.
source§

fn max_fee_per_gas(&self) -> Option<u128>

Max BaseFeePerGas the user is willing to pay. For pre-eip-1559 transactions, the field label gas_price is used instead.
source§

fn transaction_type(&self) -> Option<u8>

Transaction type format for RPC. This field is included since eip-2930.
source§

impl Eq for Transaction

source§

impl StructuralPartialEq for Transaction

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> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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> IntoEither for T

source§

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

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

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

source§

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>,

source§

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>,

source§

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

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

source§

fn vzip(self) -> V

source§

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