getActivityCounts method

Future<HeliumResponse<Map<HeliumTransactionType, int>>> getActivityCounts(
  1. String address, {
  2. Set<HeliumTransactionType> filterTypes = const {},
})

Counts transactions that indicate activity for a hotspot.

The results are a map keyed by the transation types given in filterTypes with the value for each key being the count of transactions of that type. If filterTypes is omitted, all types are reported, including ones with a count of zero.

address is the B58 address of the hotspot.

Implementation

Future<HeliumResponse<Map<HeliumTransactionType, int>>> getActivityCounts(
    String address,
    {Set<HeliumTransactionType> filterTypes = const {}}) async {
  return _client._doPagedRequest(
    HeliumPagedRequest(
        path: '/v1/hotspots/$address/activity/count',
        parameters: {
          'filter_types': filterTypes.map((e) => e.value),
        },
        extractResponse: (json) {
          final data = json['data'] as Map<String, dynamic>;
          return data.map((key, value) =>
              MapEntry(HeliumTransactionType.get(key), value as int));
        }),
  );
}