nimiq_primitives/
account.rs1use std::fmt::Display;
2
3use hex::FromHex;
4
5use beserial::{Deserialize, Serialize};
6
7
8#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Serialize, Deserialize, Display)]
9#[repr(u8)]
10pub enum AccountType {
11 Basic = 0,
12 Vesting = 1,
13 HTLC = 2,
14}
15
16impl AccountType {
17 pub fn from_int(x: u8) -> Option<AccountType> {
18 match x {
19 0 => Some(AccountType::Basic),
20 1 => Some(AccountType::Vesting),
21 2 => Some(AccountType::HTLC),
22 _ => None
23 }
24 }
25}
26
27#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Serialize, Deserialize)]
28#[repr(u8)]
29pub enum HashAlgorithm {
30 Blake2b = 1,
31 Sha256 = 3
32}
33
34#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Serialize, Deserialize)]
35#[repr(u8)]
36pub enum ProofType {
37 RegularTransfer = 1,
38 EarlyResolve = 2,
39 TimeoutResolve = 3
40}
41
42create_typed_array!(AnyHash, u8, 32);
43add_hex_io_fns_typed_arr!(AnyHash, AnyHash::SIZE);