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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
pub use fuel_types::{
    Address, AssetId, BlockHeight, Bytes32, Bytes4, Bytes64, Bytes8, ContractId,
    MessageId, Nonce, Salt, Word,
};
use fuels::types::SizedAsciiString;
use serde::{Deserialize, Serialize};

/// Scalar for 256-bit value.
pub type B256 = [u8; 32];

/// Scalar for 32-byte unique ID payloads.
pub type UID = SizedAsciiString<64>;

/// Scalar for object IDs.
pub type ID = UID;

/// Scalar for 4-byte signed integers.
pub type I32 = i32;

/// Scalar for 8-byte signed integers.
pub type I64 = i64;

/// Scalar for 16-byte signed integers.
pub type I128 = i128;

/// Scalar for 4-byte unsigned integers.
pub type U32 = u32;

/// Scalar for 8-byte unsigned integers.
pub type U64 = u64;

/// Scalar for 16-byte unsigned integers.
pub type U128 = u128;

/// Scalar for boolean.
pub type Boolean = bool;

/// Scalar for 1-byte signed integers.
pub type I8 = i8;

/// Scalar for 1-byte unsigned integers.
pub type U8 = u8;

/// Scalar for arbitrarily-sized byte payloads.
pub type Bytes = Vec<u8>;

/// JSON type used to store arbitrary object payloads.
#[derive(Deserialize, Serialize, Clone, Eq, PartialEq, Debug, Hash)]
pub struct Json(pub String);

impl Default for Json {
    fn default() -> Self {
        Json("{}".to_string())
    }
}

impl AsRef<[u8]> for Json {
    fn as_ref(&self) -> &[u8] {
        self.0.as_bytes()
    }
}