Skip to content

ZenVoich/ic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IC management canister interface

mops documentation

Based on https://github.com/dfinity/interface-spec/blob/master/spec/_attachments/ic.did

Examples

Import

import IC "mo:ic";
let ic = actor("aaaaa-aa") : IC.Service;

or

import {ic} "mo:ic";

Fetch canister status

import {ic} "mo:ic";

let canisterId = Principal.fromText("e3mmv-5qaaa-aaaah-aadma-cai");
let canisterStatus = await ic.canister_status({canister_id = canisterId});

Debug.print("status = " # debug_show canisterStatus.status);
Debug.print("memory_size = " # debug_show canisterStatus.memory_size);
Debug.print("module_hash = " # debug_show canisterStatus.module_hash);
Debug.print("settings = " # debug_show canisterStatus.settings);

Update canister settings

Here we set the canister controllers to a single blackhole canister.

import {ic; CanisterSettings} "mo:ic";

let canisterId = Principal.fromText("e3mmv-5qaaa-aaaah-aadma-cai");
let settings : CanisterSettings = {
	freezing_threshold = null;
	controllers = ?[Principal.fromText("e3mmv-5qaaa-aaaah-aadma-cai")];
	memory_allocation = null;
	compute_allocation = null;
};
await ic.update_settings({
	canister_id = canisterId;
	settings = settings;
});

About

IC Management Canister interface for Motoko

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages