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:
InsufficientLiquidCycleBalance: Errors when the liquid cycle balance is insufficient to perform the call.CallPerformFailed: Errors when theic0.call_performoperation fails.CallRejected: Errors when an inter-canister call is rejected.CandidDecodeFailed: Errors when the response cannot be decoded as Candid.
- 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 aonewaycall.
§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.
- Call
Future - Represents a future that resolves to the result of an inter-canister call.
- Call
Perform Failed - Represents an error that occurs when the
ic0.call_performoperation fails. - Call
Rejected - Represents an error that occurs when an inter-canister call is rejected.
- Candid
Decode Failed - Represents an error that occurs when the response from an inter-canister call cannot be decoded as Candid.
- Insufficient
Liquid Cycle Balance - Represents an error that occurs when the liquid cycle balance is insufficient to perform the call.
- Response
- Response of a successful call.
- Unrecognized
Reject Code - The error type for when an unrecognized reject code is encountered.
Enums§
- Call
Failed - The error type when awaiting a
CallFuture. - Error
- Represents errors that can occur during inter-canister calls.
- Oneway
Error - The error type of
Call::oneway. - Reject
Code - 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§
- Call
Error Ext - Extension trait for error types to provide additional methods.
Type Aliases§
- Call
Result - Result of a inter-canister call.