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
68
69
70
#![feature(step_trait)]
use candid::{CandidType, Nat, Principal};
use ic_stable_structures::{storable::Bound, Storable};
use number::Ex3Uint;
use principal::{is_canister, is_user_principal};
use serde::{Deserialize, Serialize};
use serde_bytes::ByteBuf;
use std::fmt::{Display, Formatter};

pub use version::Version;

pub mod asset;
pub mod balance_changed;
pub mod block;
pub mod chain;
pub mod market;
pub mod number;
pub mod package;
pub mod principal;
pub mod range;
pub mod secret;
pub mod settings;
pub mod sign_schema;
pub mod transaction;
mod util;
pub mod vault;
mod version;
pub mod wallet_identifier;

pub type PublicKey = ByteBuf;
pub type WalletRegisterId = Ex3Uint;
pub type SpotMarketId = Ex3Uint;
pub type OrderId = Ex3Uint;
pub type AssetId = Ex3Uint;
pub type PackageId = Ex3Uint;
pub type AssetAmount = Ex3Uint;
pub type Nonce = Ex3Uint;
pub type BlockHeight = Ex3Uint;
pub type MerkleRoot = [u8; 32];
pub type MerkleNode = [u8; 32];
pub type BlockHash = [u8; 32];
pub type TransactionHash = [u8; 32];
pub type VaultSeqId = u64;
pub type WalletRegistrySeqId = VaultSeqId;
pub type BalanceVaultSeqId = VaultSeqId;
pub type SecretVaultSeqId = VaultSeqId;
pub type DepositId = Ex3Uint;
pub type CandidWalletRegisterId = Nat;
pub type CandidSpotMarketId = Nat;
pub type CandidOrderId = Nat;
pub type CandidPackageId = Nat;
pub type CandidAssetId = Nat;
pub type CandidAssetAmount = Nat;
pub type CandidNonce = Nat;
pub type CandidBlockHeight = Nat;
pub type CandidDepositId = Nat;
new_type_principal!(NodeProvider, false);
new_type_principal!(CanisterId, true);

#[cfg(test)]
mod tests {
    use candid::Principal;

    #[test]
    fn test_ic_management_id_for_canister_id() {
        let id = Principal::management_canister();

        let _canister_id = super::CanisterId::from(id);
    }
}