Skip to main content

canic_core/dto/
state.rs

1use crate::dto::prelude::*;
2
3//
4// AppCommand
5//
6
7#[derive(CandidType, Clone, Copy, Debug, Deserialize, Eq, PartialEq)]
8pub enum AppCommand {
9    SetStatus(AppStatus),
10    SetCyclesFundingEnabled(bool),
11}
12
13//
14// AppStatus
15//
16
17#[derive(CandidType, Clone, Copy, Debug, Deserialize, Eq, PartialEq)]
18pub enum AppStatus {
19    Active,
20    Readonly,
21    Stopped,
22}
23
24//
25// AppMode
26//
27
28#[derive(CandidType, Clone, Copy, Debug, Deserialize, Eq, PartialEq)]
29pub enum AppMode {
30    Enabled,
31    Readonly,
32    Disabled,
33}
34
35//
36// AppStateInput
37//
38
39#[derive(CandidType, Clone, Copy, Debug, Deserialize, Eq, PartialEq)]
40pub struct AppStateInput {
41    pub mode: AppMode,
42    pub cycles_funding_enabled: bool,
43}
44
45//
46// AppStateResponse
47//
48
49#[derive(CandidType, Deserialize)]
50pub struct AppStateResponse {
51    pub mode: AppMode,
52    pub cycles_funding_enabled: bool,
53}
54
55//
56// SubnetRootPublicKeyInput
57//
58
59#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq)]
60pub struct SubnetRootPublicKeyInput {
61    pub public_key_sec1: Vec<u8>,
62    pub key_name: String,
63    pub key_hash: [u8; 32],
64}
65
66//
67// SubnetAuthStateInput
68//
69
70#[derive(CandidType, Clone, Debug, Default, Deserialize, Eq, PartialEq)]
71pub struct SubnetAuthStateInput {
72    pub delegated_root_public_key: Option<SubnetRootPublicKeyInput>,
73}
74
75//
76// SubnetStateInput
77//
78
79#[derive(CandidType, Clone, Debug, Default, Deserialize, Eq, PartialEq)]
80pub struct SubnetStateInput {
81    pub auth: SubnetAuthStateInput,
82}
83
84//
85// SubnetStateResponse
86//
87
88#[derive(CandidType, Clone, Debug, Default, Deserialize, Eq, PartialEq)]
89pub struct SubnetStateResponse {
90    pub auth: SubnetAuthStateInput,
91}
92
93//
94// BootstrapStatusResponse
95//
96
97#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq)]
98pub struct BootstrapStatusResponse {
99    pub ready: bool,
100    pub phase: String,
101    pub last_error: Option<String>,
102}