status method

  1. @override
Future<Map> status()
override

Query the status endpoint of the replica. This normally has a few fields that corresponds to the version of the replica, its root public key, and any other information made public. @returns A JsonObject that is essentially a record of fields from the status endpoint.

Implementation

@override
Future<Map> status() async {
  final response = await withRetry(
    () => _fetch!(
      endpoint: '/api/v2/status',
      headers: {},
      method: FetchMethod.get,
    ),
  );
  if (!(response['ok'] as bool)) {
    throw AgentFetchError(
      statusCode: response['statusCode'],
      statusText: response['statusText'],
      body: response['body'],
    );
  }
  final buffer = response['arrayBuffer'] as Uint8List;
  return cbor.cborDecode<Map>(buffer);
}