fuel_tx/transaction/
repr.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use crate::Transaction;

#[derive(
    Debug,
    Clone,
    PartialEq,
    Eq,
    Hash,
    serde::Serialize,
    serde::Deserialize,
    fuel_types::canonical::Serialize,
    fuel_types::canonical::Deserialize,
)]
#[repr(u64)]
pub enum TransactionRepr {
    Script = 0x00,
    Create = 0x01,
    Mint = 0x02,
    Upgrade = 0x03,
    Upload = 0x04,
    Blob = 0x05,
}

impl From<&Transaction> for TransactionRepr {
    fn from(tx: &Transaction) -> Self {
        match tx {
            Transaction::Script { .. } => Self::Script,
            Transaction::Create { .. } => Self::Create,
            Transaction::Mint { .. } => Self::Mint,
            Transaction::Upgrade { .. } => Self::Upgrade,
            Transaction::Upload { .. } => Self::Upload,
            Transaction::Blob { .. } => Self::Blob,
        }
    }
}