junobuild_shared/mgmt/
types.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
68
69
70
71
pub mod cmc {
    use candid::{CandidType, Principal};
    use ic_cdk::api::management_canister::main::{CanisterId, CanisterSettings};
    use ic_ledger_types::BlockIndex;
    use serde::Deserialize;

    pub type Cycles = u128;

    #[derive(CandidType, Deserialize)]
    pub enum NotifyError {
        Refunded {
            reason: String,
            block_index: Option<BlockIndex>,
        },
        InvalidTransaction(String),
        TransactionTooOld(BlockIndex),
        Processing,
        Other {
            error_code: u64,
            error_message: String,
        },
    }

    #[derive(CandidType, Deserialize)]
    pub struct TopUpCanisterArgs {
        pub block_index: BlockIndex,
        pub canister_id: Principal,
    }

    #[derive(CandidType, Deserialize)]
    pub enum CreateCanisterError {
        Refunded {
            refund_amount: u128,
            create_error: String,
        },
    }

    pub type CreateCanisterResult = Result<CanisterId, CreateCanisterError>;

    #[derive(CandidType, Deserialize)]
    pub struct SubnetFilter {
        pub subnet_type: Option<String>,
    }

    pub type SubnetId = Principal;

    #[derive(CandidType, Deserialize)]
    pub enum SubnetSelection {
        /// Choose a random subnet that satisfies the specified properties
        Filter(SubnetFilter),
        /// Choose a specific subnet
        Subnet { subnet: SubnetId },
    }

    #[derive(CandidType, Deserialize)]
    pub struct CreateCanister {
        #[deprecated(note = "use subnet_selection instead")]
        pub subnet_type: Option<String>,
        pub subnet_selection: Option<SubnetSelection>,
        pub settings: Option<CanisterSettings>,
    }
}

pub mod ic {
    use crate::types::core::Blob;

    pub struct WasmArg {
        pub wasm: Blob,
        pub install_arg: Vec<u8>,
    }
}