mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
Replace TransactionKind with alloy_primitives::TxKind (#7859)
This commit is contained in:
@ -2,8 +2,8 @@ use crate::EthPooledTransaction;
|
||||
use rand::Rng;
|
||||
use reth_primitives::{
|
||||
constants::MIN_PROTOCOL_BASE_FEE, sign_message, AccessList, Address, Bytes, Transaction,
|
||||
TransactionKind, TransactionSigned, TryFromRecoveredTransaction, TxEip1559, TxEip4844,
|
||||
TxLegacy, B256, MAINNET, U256,
|
||||
TransactionSigned, TryFromRecoveredTransaction, TxEip1559, TxEip4844, TxKind, TxLegacy, B256,
|
||||
MAINNET, U256,
|
||||
};
|
||||
|
||||
/// A generator for transactions for testing purposes.
|
||||
@ -129,7 +129,7 @@ pub struct TransactionBuilder {
|
||||
/// processing.
|
||||
pub max_priority_fee_per_gas: u128,
|
||||
/// The recipient or contract address of the transaction.
|
||||
pub to: TransactionKind,
|
||||
pub to: TxKind,
|
||||
/// The value to be transferred in the transaction.
|
||||
pub value: U256,
|
||||
/// The list of addresses and storage keys that the transaction can access.
|
||||
@ -246,7 +246,7 @@ impl TransactionBuilder {
|
||||
|
||||
/// Sets the recipient or contract address for the transaction builder.
|
||||
pub const fn to(mut self, to: Address) -> Self {
|
||||
self.to = TransactionKind::Call(to);
|
||||
self.to = TxKind::Call(to);
|
||||
self
|
||||
}
|
||||
|
||||
@ -306,7 +306,7 @@ impl TransactionBuilder {
|
||||
|
||||
/// Sets the recipient or contract address for the transaction, mutable reference version.
|
||||
pub fn set_to(&mut self, to: Address) -> &mut Self {
|
||||
self.to = TransactionKind::Call(to);
|
||||
self.to = TxKind::Call(to);
|
||||
self
|
||||
}
|
||||
|
||||
|
||||
@ -16,8 +16,8 @@ use reth_primitives::{
|
||||
transaction::TryFromRecoveredTransactionError,
|
||||
AccessList, Address, BlobTransactionSidecar, Bytes, FromRecoveredPooledTransaction,
|
||||
IntoRecoveredTransaction, PooledTransactionsElementEcRecovered, Signature, Transaction,
|
||||
TransactionKind, TransactionSigned, TransactionSignedEcRecovered, TryFromRecoveredTransaction,
|
||||
TxEip1559, TxEip2930, TxEip4844, TxHash, TxLegacy, TxType, B256, EIP1559_TX_TYPE_ID,
|
||||
TransactionSigned, TransactionSignedEcRecovered, TryFromRecoveredTransaction, TxEip1559,
|
||||
TxEip2930, TxEip4844, TxHash, TxKind, TxLegacy, TxType, B256, EIP1559_TX_TYPE_ID,
|
||||
EIP2930_TX_TYPE_ID, EIP4844_TX_TYPE_ID, LEGACY_TX_TYPE_ID, U256,
|
||||
};
|
||||
use std::{ops::Range, sync::Arc, time::Instant, vec::IntoIter};
|
||||
@ -105,7 +105,7 @@ pub enum MockTransaction {
|
||||
/// The gas limit for the transaction.
|
||||
gas_limit: u64,
|
||||
/// The transaction's destination.
|
||||
to: TransactionKind,
|
||||
to: TxKind,
|
||||
/// The value of the transaction.
|
||||
value: U256,
|
||||
/// The transaction input data.
|
||||
@ -128,7 +128,7 @@ pub enum MockTransaction {
|
||||
/// The gas limit for the transaction.
|
||||
gas_limit: u64,
|
||||
/// The transaction's destination.
|
||||
to: TransactionKind,
|
||||
to: TxKind,
|
||||
/// The value of the transaction.
|
||||
value: U256,
|
||||
/// The access list associated with the transaction.
|
||||
@ -155,7 +155,7 @@ pub enum MockTransaction {
|
||||
/// The gas limit for the transaction.
|
||||
gas_limit: u64,
|
||||
/// The transaction's destination.
|
||||
to: TransactionKind,
|
||||
to: TxKind,
|
||||
/// The value of the transaction.
|
||||
value: U256,
|
||||
/// The access list associated with the transaction.
|
||||
@ -176,7 +176,7 @@ pub enum MockTransaction {
|
||||
/// The transaction nonce.
|
||||
nonce: u64,
|
||||
/// The transaction's destination.
|
||||
to: TransactionKind,
|
||||
to: TxKind,
|
||||
/// The gas limit for the transaction.
|
||||
gas_limit: u64,
|
||||
/// The transaction input data.
|
||||
@ -213,7 +213,7 @@ impl MockTransaction {
|
||||
nonce: 0,
|
||||
gas_price: 0,
|
||||
gas_limit: 0,
|
||||
to: TransactionKind::Call(Address::random()),
|
||||
to: TxKind::Call(Address::random()),
|
||||
value: Default::default(),
|
||||
input: Default::default(),
|
||||
size: Default::default(),
|
||||
@ -229,7 +229,7 @@ impl MockTransaction {
|
||||
max_fee_per_gas: MIN_PROTOCOL_BASE_FEE as u128,
|
||||
max_priority_fee_per_gas: MIN_PROTOCOL_BASE_FEE as u128,
|
||||
gas_limit: 0,
|
||||
to: TransactionKind::Call(Address::random()),
|
||||
to: TxKind::Call(Address::random()),
|
||||
value: Default::default(),
|
||||
input: Bytes::new(),
|
||||
accesslist: Default::default(),
|
||||
@ -247,7 +247,7 @@ impl MockTransaction {
|
||||
max_priority_fee_per_gas: MIN_PROTOCOL_BASE_FEE as u128,
|
||||
max_fee_per_blob_gas: DATA_GAS_PER_BLOB as u128,
|
||||
gas_limit: 0,
|
||||
to: TransactionKind::Call(Address::random()),
|
||||
to: TxKind::Call(Address::random()),
|
||||
value: Default::default(),
|
||||
input: Bytes::new(),
|
||||
accesslist: Default::default(),
|
||||
@ -272,7 +272,7 @@ impl MockTransaction {
|
||||
hash: B256::random(),
|
||||
sender: Address::random(),
|
||||
nonce: 0,
|
||||
to: TransactionKind::Call(Address::random()),
|
||||
to: TxKind::Call(Address::random()),
|
||||
gas_limit: 0,
|
||||
input: Bytes::new(),
|
||||
value: Default::default(),
|
||||
@ -671,7 +671,7 @@ impl PoolTransaction for MockTransaction {
|
||||
}
|
||||
|
||||
/// Returns the transaction kind associated with the transaction.
|
||||
fn kind(&self) -> &TransactionKind {
|
||||
fn kind(&self) -> &TxKind {
|
||||
match self {
|
||||
MockTransaction::Legacy { to, .. } |
|
||||
MockTransaction::Eip1559 { to, .. } |
|
||||
|
||||
@ -13,9 +13,9 @@ use reth_primitives::{
|
||||
kzg::KzgSettings, transaction::TryFromRecoveredTransactionError, AccessList, Address,
|
||||
BlobTransactionSidecar, BlobTransactionValidationError, FromRecoveredPooledTransaction,
|
||||
IntoRecoveredTransaction, PeerId, PooledTransactionsElement,
|
||||
PooledTransactionsElementEcRecovered, SealedBlock, Transaction, TransactionKind,
|
||||
TransactionSignedEcRecovered, TryFromRecoveredTransaction, TxEip4844, TxHash, B256,
|
||||
EIP1559_TX_TYPE_ID, EIP4844_TX_TYPE_ID, U256,
|
||||
PooledTransactionsElementEcRecovered, SealedBlock, Transaction, TransactionSignedEcRecovered,
|
||||
TryFromRecoveredTransaction, TxEip4844, TxHash, TxKind, B256, EIP1559_TX_TYPE_ID,
|
||||
EIP4844_TX_TYPE_ID, U256,
|
||||
};
|
||||
#[cfg(feature = "serde")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -811,14 +811,14 @@ pub trait PoolTransaction:
|
||||
/// otherwise returns the gas price.
|
||||
fn priority_fee_or_price(&self) -> u128;
|
||||
|
||||
/// Returns the transaction's [`TransactionKind`], which is the address of the recipient or
|
||||
/// [`TransactionKind::Create`] if the transaction is a contract creation.
|
||||
fn kind(&self) -> &TransactionKind;
|
||||
/// Returns the transaction's [`TxKind`], which is the address of the recipient or
|
||||
/// [`TxKind::Create`] if the transaction is a contract creation.
|
||||
fn kind(&self) -> &TxKind;
|
||||
|
||||
/// Returns the recipient of the transaction if it is not a [TransactionKind::Create]
|
||||
/// Returns the recipient of the transaction if it is not a [TxKind::Create]
|
||||
/// transaction.
|
||||
fn to(&self) -> Option<Address> {
|
||||
(*self.kind()).to()
|
||||
(*self.kind()).to().copied()
|
||||
}
|
||||
|
||||
/// Returns the input data of this transaction.
|
||||
@ -1056,9 +1056,9 @@ impl PoolTransaction for EthPooledTransaction {
|
||||
self.transaction.priority_fee_or_price()
|
||||
}
|
||||
|
||||
/// Returns the transaction's [`TransactionKind`], which is the address of the recipient or
|
||||
/// [`TransactionKind::Create`] if the transaction is a contract creation.
|
||||
fn kind(&self) -> &TransactionKind {
|
||||
/// Returns the transaction's [`TxKind`], which is the address of the recipient or
|
||||
/// [`TxKind::Create`] if the transaction is a contract creation.
|
||||
fn kind(&self) -> &TxKind {
|
||||
self.transaction.kind()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user