revm_context_interface/transaction/
transaction_type.rs1#[repr(u8)]
3#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
4#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
5pub enum TransactionType {
6 Legacy = 0,
8 Eip2930 = 1,
10 Eip1559 = 2,
12 Eip4844 = 3,
14 Eip7702 = 4,
16 Custom = 0xFF,
21}
22
23impl PartialEq<u8> for TransactionType {
24 fn eq(&self, other: &u8) -> bool {
25 (*self as u8) == *other
26 }
27}
28
29impl PartialEq<TransactionType> for u8 {
30 fn eq(&self, other: &TransactionType) -> bool {
31 *self == (*other as u8)
32 }
33}
34
35impl From<TransactionType> for u8 {
36 fn from(tx_type: TransactionType) -> u8 {
37 tx_type as u8
38 }
39}
40
41impl From<u8> for TransactionType {
42 fn from(value: u8) -> Self {
43 match value {
44 0 => Self::Legacy,
45 1 => Self::Eip2930,
46 2 => Self::Eip1559,
47 3 => Self::Eip4844,
48 4 => Self::Eip7702,
49 _ => Self::Custom,
52 }
53 }
54}