Module ic_kit::ic

source · []
Expand description

System APIs for the Internet Computer.

Structs

A call builder that let’s you create an inter-canister call which can be then sent to the destination.

Enums

Constants

The result of candid::encode_args(()) which is used as the default argument.

Functions

The balance of the canister.

The caller who has invoked this method on the canister.

Returns the data certificate authenticating certified_data set by this canister.

ID of the current canister.

Like with, but does not initialize the data with the default value and simply returns None, if there is no value associated with the type.

Like with_mut, but does not initialize the data with the default value and simply returns None, if there is no value associated with the type.

Accept the given amount of cycles, returns the actual amount of accepted cycles.

Return the number of available cycles that is sent by the caller.

Return the cycles that were sent back by the canister that was just called. This method should only be called right after an inter-canister call.

Print a debug message from the canister that can be viewed during local development.

Set the certified data of the canister, this method traps if data.len > 32.

Execute a future without blocking the current call. The given future is polled once initially to kickstart the async calls.

Attempts to grow the stable memory by new_pages (added pages).

Reads data from the stable memory location specified by an offset.

Returns the current size of the stable memory in WebAssembly pages. Note: One WebAssembly page is 64KiB

Writes data to the stable memory location specified by an offset.

Swaps the value associated with type T with the given value, returns the old one.

Remove the current value associated with the type and return it.

The time in nanoseconds.

Trap the canister with the provided message. This will rollback the canister state at the beginning of the current entry point, consider rejecting the message gracefully.

Pass an immutable reference to the value associated with the given type to the closure.

Like crate::ic::with but passes the immutable reference of multiple variables to the closure as a tuple.

Like crate::ic::with_mut but passes the mutable reference of multiple variables to the closure as a tuple.

Pass a mutable reference to the value associated with the given type to the closure.

Type Definitions

The type used to represent the cycles amount, which is u128 when the experimental-cycles128 feature is on and a u64 otherwise.

A type which represents either a page count or an offset in the stable storage, it’s a u64 when the experimental-stable64 feature is enabled, otherwise a u32.