Expand description
System API bindings.
This module provides Rust ergonomic bindings to the system APIs.
Some APIs require more advanced handling and are organized into separate modules:
- For the inter-canister calls API, see the
callmodule. - For the stable memory management API, see the .
- The basic bindings are provided in this module including
stable_size,stable_grow,stable_readandstable_write. - The
stablemodule provides more advanced functionalities, e.g. support forstd::iotraits.
- The basic bindings are provided in this module including
APIs that are only available for wasm32 are not included.
As a result, system APIs with a numeric postfix (indicating the data bit width) are bound to names without the postfix.
For example, ic0::msg_cycles_available128 is bound to msg_cycles_available, while ic0::msg_cycles_available has no binding.
Functions that provide bindings for a single system API method share the same name as the system API.
For example, ic0::msg_reject_code is bound to msg_reject_code.
Functions that wrap multiple system API methods are named using the common prefix of the wrapped methods.
For example, msg_arg_data wraps both ic0::msg_arg_data_size and ic0::msg_arg_data_copy.
Modules§
- call
Deprecated - APIs to make and manage calls in the canister.
- management_
canister Deprecated - Functions and types for calling the IC management canister.
- stable
Deprecated - APIs to manage stable memory.
Enums§
- Canister
Status Code - The status of a canister.
- Performance
Counter Type - The type of performance counter.
- Sign
Cost Error - The error type for
cost_sign_with_ecdsaandcost_sign_with_schnorr.
Functions§
- accept_
message - Accepts the message in
canister_inspect_message. - call_
context_ instruction_ counter - Returns the number of WebAssembly instructions the canister has executed within the call context of the current Message execution since Call context creation.
- caller
Deprecated - Returns the caller of the current call.
- canister_
balance Deprecated - Gets the amount of funds available in the canister.
- canister_
balance128 Deprecated - Gets the amount of funds available in the canister.
- canister_
cycle_ balance - Gets the current cycle balance of the canister.
- canister_
liquid_ cycle_ balance - Gets the current amount of cycles that is available for spending in calls and execution.
- canister_
self - Gets canister’s own identity.
- canister_
status - Gets the status of the canister.
- canister_
version - Gets the canister version.
- certified_
data_ set - Sets the certified data of this canister.
- cost_
call - Gets the amount of cycles that a canister needs to be above the freezing threshold in order to successfully make an inter-canister call.
- cost_
create_ canister - Gets the cycle cost of the Management canister method
creating_canister. - cost_
http_ request - Gets the cycle cost of the Management canister method
http_request. - cost_
sign_ with_ ecdsa - Gets the cycle cost of the Management canister method
sign_with_ecdsa. - cost_
sign_ with_ schnorr - Gets the cycle cost of the Management canister method
sign_with_schnorr. - cost_
vetkd_ derive_ key - Gets the cycle cost of the Management canister method
vetkd_derive_key. - cycles_
burn - Burns cycles from the canister.
- data_
certificate - When called from a query call, returns the data certificate authenticating certified_data set by this canister.
- debug_
print - Emits textual trace messages.
- global_
timer_ set - Sets global timer.
- id
Deprecated - Returns the canister id as a blob.
- in_
replicated_ execution - Checks if in replicated execution.
- instruction_
counter - Returns the number of instructions that the canister executed since the last entry point.
- is_
controller - Determines if a Principal is a controller of the canister.
- msg_
arg_ data - Gets the message argument data.
- msg_
caller - Gets the identity of the caller, which may be a canister id or a user id.
- msg_
cycles_ accept - Moves cycles from the call to the canister balance.
- msg_
cycles_ available - Gets the number of cycles transferred by the caller of the current call, still available in this message.
- msg_
cycles_ refunded - Gets the amount of cycles that came back with the response as a refund
- msg_
deadline - Gets the deadline, in nanoseconds since 1970-01-01, after which the caller might stop waiting for a response.
- msg_
method_ name - Gets the name of the method to be inspected.
- msg_
reject - Rejects the call with a diagnostic message.
- msg_
reject_ code - Returns the reject code, if the current function is invoked as a reject callback.
- msg_
reject_ msg - Gets the reject message.
- msg_
reply - Replies to the sender with the data.
- performance_
counter - Gets the value of specified performance counter.
- print
Deprecated - Prints the given message.
- root_
key - Gets the public key (a DER-encoded BLS key) of the root key of this instance of the Internet Computer Protocol.
- set_
certified_ data Deprecated - Sets the certified data of this canister.
- set_
global_ timer Deprecated - Sets global timer.
- stable_
grow - Attempts to grow the stable memory by
new_pagesmany pages containing zeroes. - stable_
read - Reads data from the stable memory location specified by an offset.
- stable_
size - Gets the current size of the stable memory (in WebAssembly pages).
- stable_
write - Writes data to the stable memory location specified by an offset.
- subnet_
self - Gets the ID of the subnet on which the canister is running.
- time
- Gets current timestamp, in nanoseconds since the epoch (1970-01-01)
- trap
- Traps with the given message.