eest_types/
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,
10 Eip1559,
12 Eip4844,
14 Eip7702,
16 Custom,
19}
20
21impl PartialEq<u8> for TransactionType {
22 fn eq(&self, other: &u8) -> bool { (*self as u8) == *other }
23}
24
25impl PartialEq<TransactionType> for u8 {
26 fn eq(&self, other: &TransactionType) -> bool { *self == (*other as u8) }
27}
28
29impl From<TransactionType> for u8 {
30 fn from(tx_type: TransactionType) -> u8 { tx_type as u8 }
31}
32
33impl From<u8> for TransactionType {
34 fn from(value: u8) -> Self {
35 match value {
36 0 => Self::Legacy,
37 1 => Self::Eip2930,
38 2 => Self::Eip1559,
39 3 => Self::Eip4844,
40 4 => Self::Eip7702,
41 _ => Self::Custom,
42 }
43 }
44}