isp_sdk/isp_certified_log/
bucket_certified_log_did.rs1use candid::Principal;
2use ic_cdk::api::call::CallResult;
3use ic_cdk::export::candid::{self, CandidType, Deserialize};
4
5#[derive(CandidType, Deserialize, Debug)]
6pub struct CertifiedLog {
7 context: String,
8 cert: Vec<u8>,
9 time: u64,
10 witness: Vec<u8>,
11 index: u64,
12}
13
14#[derive(CandidType, Deserialize)]
15pub struct Log {
16 context: String,
17}
18
19struct SERVICE(Principal);
20impl SERVICE {
21 pub async fn add_admin(&self, new_admin: Principal) -> CallResult<(bool,)> {
22 ic_cdk::call(self.0, "addAdmin", (new_admin,)).await
23 }
24 pub async fn change_admin(&self, new_admin: Vec<Principal>) -> CallResult<(bool,)> {
25 ic_cdk::call(self.0, "changeAdmin", (new_admin,)).await
26 }
27 pub async fn get_logs(&self, start: u64, end: u64) -> CallResult<(Option<Vec<CertifiedLog>>,)> {
28 ic_cdk::call(self.0, "getLogs", (start, end)).await
29 }
30 pub async fn put(&self, log: Log) -> CallResult<()> {
31 ic_cdk::call(self.0, "put", (log,)).await
32 }
33}