Skip to content

Commit

Permalink
feat: add smart fee estimation method to ElectrumXClient
Browse files Browse the repository at this point in the history
  • Loading branch information
dev2-nomo committed Dec 19, 2024
1 parent 1623b4c commit dfcac37
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/src/crypto/utxo/repositories/electrum_json_rpc_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,18 @@ class ElectrumXClient {
return fee;
}

Future<double> estimateSmartFee({required int blocks}) async {
final response = await _client.sendRequest(
{
"method": "blockchain.estimatesmartfee",
"params": [blocks]
},
);
final fee = response as double?;
if (fee == null || fee == 0) throw Exception("Fee estimation failed");
return fee;
}

Future<bool> disconnect() async {
await _client.disconnect();
return true;
Expand Down

0 comments on commit dfcac37

Please sign in to comment.