fuel_tx/transaction/
repr.rs

1use crate::Transaction;
2
3#[derive(
4    Debug,
5    Clone,
6    PartialEq,
7    Eq,
8    Hash,
9    serde::Serialize,
10    serde::Deserialize,
11    fuel_types::canonical::Serialize,
12    fuel_types::canonical::Deserialize,
13)]
14#[repr(u64)]
15pub enum TransactionRepr {
16    Script = 0x00,
17    Create = 0x01,
18    Mint = 0x02,
19    Upgrade = 0x03,
20    Upload = 0x04,
21    Blob = 0x05,
22}
23
24impl From<&Transaction> for TransactionRepr {
25    fn from(tx: &Transaction) -> Self {
26        match tx {
27            Transaction::Script { .. } => Self::Script,
28            Transaction::Create { .. } => Self::Create,
29            Transaction::Mint { .. } => Self::Mint,
30            Transaction::Upgrade { .. } => Self::Upgrade,
31            Transaction::Upload { .. } => Self::Upload,
32            Transaction::Blob { .. } => Self::Blob,
33        }
34    }
35}