This repository was archived by the owner on Oct 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 67
/
Copy pathscalar.rs
67 lines (49 loc) · 1.44 KB
/
scalar.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
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
62
63
64
65
66
67
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 512-bit unique ID payloads.
pub type UID = SizedAsciiString<64>;
/// Scalar for object IDs.
pub type ID = UID;
/// Scalar for 32-bit signed integers.
pub type I32 = i32;
/// Scalar for 64-bit signed integers.
pub type I64 = i64;
/// Scalar for 128-bit signed integers.
pub type I128 = i128;
/// Scalar for 32-bit unsigned integers.
pub type U32 = u32;
/// Scalar for 64-bit unsigned integers.
pub type U64 = u64;
/// Scalar for 128-bit unsigned integers.
pub type U128 = u128;
/// Scalar for boolean.
pub type Boolean = bool;
/// Scalar for 8-bit signed integers.
pub type I8 = i8;
/// Scalar for 8-bit unsigned integers.
pub type U8 = u8;
/// Scalar for 16-bit signed integers.
pub type U16 = u16;
/// Scalar for 16-bit unsigned integers.
pub type I16 = i16;
/// 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()
}
}