query method

  1. @override
Future<QueryResponse> query(
  1. Principal canisterId,
  2. QueryFields fields,
  3. Identity? identity
)
override

Send a query call to a canister. See {@link https://sdk.dfinity.org/docs/interface-spec/#http-query | the interface spec}. @param canisterId The Principal of the Canister to send the query to. Sending a query to the management canister is not supported (as it has no meaning from an agent). @param options Options to use to create and send the query. @returns The response from the replica. The Promise will only reject when the communication failed. If the query itself failed but no protocol errors happened, the response will be of type QueryResponseRejected.

Implementation

@override
Future<QueryResponse> query(
    Principal canisterId, QueryFields fields, Identity? identity) {
  return _sendAndWait(ProxyMessageQueryResponse.fromJson({
    "id": _nextId++,
    "type": ProxyMessageKind.Query,
    "args": [canisterId.toString(), fields],
  }));
}