estimateFeeForPriority function
Implementation
Future<Amount> estimateFeeForPriority({
required int blocks,
required UTXONetworkType network,
required ElectrumXClient? initalClient,
}) async {
final (fee, _, _) = await fetchFromRandomElectrumXNode(
(client) => client.estimateFee(blocks: blocks),
client: initalClient,
endpoints: network.endpoints,
token: network.coin,
);
if (fee == null) throw Exception("Fee estimation failed");
final feePerKb = Amount.convert(value: fee, decimals: 8);
final feePerB = feePerKb / Amount.from(value: 1000, decimals: 0);
return feePerB;
}