Skip to main content

canister_rpc

Function canister_rpc 

Source
pub async fn canister_rpc<In, Out>(
    client: &Client,
    endpoint: &str,
    canister: &Principal,
    method: &str,
    args: In,
) -> Result<Out, HttpRPCError>
where In: ArgumentEncoder, Out: CandidType + for<'a> Deserialize<'a>,
Expand description

Calls a canister method through a remote endpoint using Candid-encoded arguments.

§Arguments

  • client - HTTP client to use for the request.
  • endpoint - URL endpoint to send the request to.
  • canister - Target canister’s principal ID.
  • method - Method name to call on the canister.
  • args - Arguments to encode using Candid.

§Returns

Result with either the deserialized response or an HttpRPCError.