1use std::path::PathBuf;
2
3use serde::{Deserialize, Serialize};
4
5pub(super) const LOCAL_NETWORK: &str = "local";
6pub const REQUIRED_ICP_CLI_VERSION: &str = "1.0.0";
7pub const ICP_CLI_SUPPORTED_VERSION_RANGE: &str = ">=1.0.0, <2.0.0";
8pub const CANIC_ICP_LOCAL_NETWORK_URL_ENV: &str = "CANIC_ICP_LOCAL_NETWORK_URL";
9pub const CANIC_ICP_LOCAL_ROOT_KEY_ENV: &str = "CANIC_ICP_LOCAL_ROOT_KEY";
10
11#[derive(Clone, Debug, Eq, PartialEq)]
16pub struct IcpRawOutput {
17 pub success: bool,
18 pub status: String,
19 pub stdout: Vec<u8>,
20 pub stderr: Vec<u8>,
21}
22
23#[derive(Clone, Debug, Eq, PartialEq)]
28pub struct IcpCli {
29 pub(super) executable: String,
30 pub(super) environment: Option<String>,
31 pub(super) network: Option<String>,
32 pub(super) cwd: Option<PathBuf>,
33}
34
35#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
39pub struct IcpCliVersion {
40 pub major: u64,
41 pub minor: u64,
42 pub patch: u64,
43}
44
45#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
50pub struct IcpSnapshotCreateReceipt {
51 pub snapshot_id: String,
52 pub taken_at_timestamp: Option<u64>,
53 pub total_size_bytes: Option<u64>,
54}
55
56#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
61pub struct IcpSnapshotUploadReceipt {
62 pub snapshot_id: String,
63}
64
65#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
70pub struct IcpCanisterStatusReport {
71 pub id: String,
72 pub name: Option<String>,
73 pub status: String,
74 pub settings: Option<IcpCanisterStatusSettings>,
75 pub module_hash: Option<String>,
76 pub memory_size: Option<String>,
77 pub cycles: Option<String>,
78 pub reserved_cycles: Option<String>,
79 pub idle_cycles_burned_per_day: Option<String>,
80}
81
82#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
87pub struct IcpCanisterStatusSettings {
88 #[serde(default)]
89 pub controllers: Vec<String>,
90 pub compute_allocation: Option<String>,
91 pub memory_allocation: Option<String>,
92 pub freezing_threshold: Option<String>,
93 pub reserved_cycles_limit: Option<String>,
94 pub wasm_memory_limit: Option<String>,
95 pub wasm_memory_threshold: Option<String>,
96 pub log_memory_limit: Option<String>,
97}