estimateFeeRate method

  1. @override
Future<int> estimateFeeRate({
  1. int targetBlocks = 6,
})
override

Fee rate in sat/vbyte for confirmation within targetBlocks.

Implementation

@override
Future<int> estimateFeeRate({int targetBlocks = 6}) async {
  final url = _url('/v1/fees/recommended');
  final data = await _getJson(url) as Map<String, dynamic>;
  final key = targetBlocks <= 1
      ? 'fastestFee'
      : targetBlocks <= 3
          ? 'halfHourFee'
          : targetBlocks <= 6
              ? 'hourFee'
              : 'economyFee';
  final rate = data[key];
  if (rate == null) {
    return data.values.first as int;
  }
  return rate as int;
}