Module call

Module call 

Source
Expand description

Inter-canister Call API

This module provides the necessary APIs to make and manage inter-canister calls within a canister. It offers a builder pattern to configure and execute calls, allowing for flexible and customizable interactions between canisters.

§Overview

The primary type in this module is Call, which represents an inter-canister call. For detailed usage and examples, refer to the Call type documentation.

let result: u32 = Call::bounded_wait(canister_id, method).await.unwrap().candid().unwrap();

§Error Handling

The module defines various error types to handle different failure scenarios during inter-canister calls:

  • The base error cases:
  • The composite error types:
    • Error: The top-level error type encapsulating all possible errors.
    • CallFailed: Errors related to the execution of the call itself, i.e. all the errors except for the Candid decoding failure.
    • OnewayError: The error type for when sending a oneway call.

§Internal Details

The module also includes internal types and functions to manage the state and execution of inter-canister calls, such as CallFuture and its associated state management.

Structs§

Call
Inter-canister Call.
CallFuture
Represents a future that resolves to the result of an inter-canister call.
CallPerformFailed
Represents an error that occurs when the ic0.call_perform operation fails.
CallRejected
Represents an error that occurs when an inter-canister call is rejected.
CandidDecodeFailed
Represents an error that occurs when the response from an inter-canister call cannot be decoded as Candid.
InsufficientLiquidCycleBalance
Represents an error that occurs when the liquid cycle balance is insufficient to perform the call.
Response
Response of a successful call.
UnrecognizedRejectCode
The error type for when an unrecognized reject code is encountered.

Enums§

CallFailed
The error type when awaiting a CallFuture.
Error
Represents errors that can occur during inter-canister calls.
OnewayError
The error type of Call::oneway.
RejectCode
Reject codes are integers that canisters should pass to msg.reject system API calls. These errors are designed for programmatic error handling, not for end-users. They are also used for classification of user-facing errors.

Traits§

CallErrorExt
Extension trait for error types to provide additional methods.

Type Aliases§

CallResult
Result of a inter-canister call.