getWitnessesForClaim function

Future<List<String>> getWitnessesForClaim(
  1. int epoch,
  2. String identifier,
  3. int timestampS
)

Implementation

Future<List<String>> getWitnessesForClaim(
  int epoch,
  String identifier,
  int timestampS,
) async {
  try {
    final beacon = await makeBeacon();
    if (beacon == null) {
      logger.info('No beacon available for getting witnesses');
      throw Exception('No beacon available');
    }
    final state = await beacon.getState(epoch: epoch);
    final witnessList = fetchWitnessListForClaim(state, identifier, timestampS);
    final witnesses = witnessList.map((w) => w.id.toLowerCase()).toList();
    return witnesses;
  } catch (err) {
    logger.info('Error getting witnesses for claim: $err');
    throw Exception('Error getting witnesses for claim: $err');
  }
}