|
1 | 1 | pub mod handler_cfg;
|
2 | 2 |
|
| 3 | +use alloy_primitives::TxKind; |
3 | 4 | pub use handler_cfg::{CfgEnvWithHandlerCfg, EnvWithHandlerCfg, HandlerCfg};
|
4 | 5 |
|
5 | 6 | use crate::{
|
@@ -503,7 +504,7 @@ pub struct TxEnv {
|
503 | 504 | /// The gas price of the transaction.
|
504 | 505 | pub gas_price: U256,
|
505 | 506 | /// The destination of the transaction.
|
506 |
| - pub transact_to: TransactTo, |
| 507 | + pub transact_to: TxKind, |
507 | 508 | /// The value sent to `transact_to`.
|
508 | 509 | pub value: U256,
|
509 | 510 | /// The data of the transaction.
|
@@ -585,7 +586,7 @@ impl Default for TxEnv {
|
585 | 586 | gas_limit: u64::MAX,
|
586 | 587 | gas_price: U256::ZERO,
|
587 | 588 | gas_priority_fee: None,
|
588 |
| - transact_to: TransactTo::Call(Address::ZERO), // will do nothing |
| 589 | + transact_to: TxKind::Call(Address::ZERO), // will do nothing |
589 | 590 | value: U256::ZERO,
|
590 | 591 | data: Bytes::new(),
|
591 | 592 | chain_id: None,
|
@@ -658,40 +659,8 @@ pub struct OptimismFields {
|
658 | 659 | pub enveloped_tx: Option<Bytes>,
|
659 | 660 | }
|
660 | 661 |
|
661 |
| -/// Transaction destination. |
662 |
| -#[derive(Clone, Debug, PartialEq, Eq, Hash)] |
663 |
| -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] |
664 |
| -pub enum TransactTo { |
665 |
| - /// Simple call to an address. |
666 |
| - Call(Address), |
667 |
| - /// Contract creation. |
668 |
| - Create, |
669 |
| -} |
670 |
| - |
671 |
| -impl TransactTo { |
672 |
| - /// Calls the given address. |
673 |
| - #[inline] |
674 |
| - pub fn call(address: Address) -> Self { |
675 |
| - Self::Call(address) |
676 |
| - } |
677 |
| - |
678 |
| - /// Creates a contract. |
679 |
| - #[inline] |
680 |
| - pub fn create() -> Self { |
681 |
| - Self::Create |
682 |
| - } |
683 |
| - /// Returns `true` if the transaction is `Call`. |
684 |
| - #[inline] |
685 |
| - pub fn is_call(&self) -> bool { |
686 |
| - matches!(self, Self::Call(_)) |
687 |
| - } |
688 |
| - |
689 |
| - /// Returns `true` if the transaction is `Create` or `Create2`. |
690 |
| - #[inline] |
691 |
| - pub fn is_create(&self) -> bool { |
692 |
| - matches!(self, Self::Create) |
693 |
| - } |
694 |
| -} |
| 662 | +/// Transaction destination |
| 663 | +pub type TransactTo = TxKind; |
695 | 664 |
|
696 | 665 | /// Create scheme.
|
697 | 666 | #[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
|
|
0 commit comments