getSuggestedFee method

Future<void> getSuggestedFee()

Implementation

Future<void> getSuggestedFee() async {
  if (networkIdentifier != null) {
    final req = rosetta.ConstructionMetadataRequest.fromJson(
      {'network_identifier': networkIdentifier!.toJson()},
    );
    final meta = await metadata(req);
    final fee = meta.suggestedFee?.singleWhere(
      (e) => e.currency.symbol == 'ICP',
      orElse: () => throw StateError('No fee found.'),
    );
    if (fee != null) {
      suggestedFee = fee.valueInBigInt;
      currency = fee.currency;
    }
  }
}