@@ -25,9 +25,11 @@ import '../services/event_bus/events/global/tor_connection_status_changed_event.
2525import '../services/event_bus/events/global/tor_status_changed_event.dart' ;
2626import '../services/event_bus/global_event_bus.dart' ;
2727import '../services/tor_service.dart' ;
28+ import '../utilities/amount/amount.dart' ;
2829import '../utilities/logger.dart' ;
2930import '../utilities/prefs.dart' ;
3031import '../wallets/crypto_currency/crypto_currency.dart' ;
32+ import '../wallets/crypto_currency/interfaces/electrumx_currency_interface.dart' ;
3133import 'client_manager.dart' ;
3234
3335class WifiOnlyException implements Exception {}
@@ -1113,17 +1115,25 @@ class ElectrumXClient {
11131115 ],
11141116 );
11151117 try {
1116- // If the response is -1 or null, return a temporary hardcoded value for
1117- // Dogecoin. This is a temporary fix until the fee estimation is fixed.
1118- if (cryptoCurrency is Dogecoin &&
1119- (response == null ||
1120- response == - 1 ||
1121- Decimal .parse (response.toString ()) == Decimal .parse ("-1" ))) {
1122- // Return 0.05 for slow, 0.2 for average, and 1 for fast txs.
1123- // These numbers produce tx fees in line with txs in the wild on
1124- // https://dogechain.info/
1125- return Decimal .parse ((1 / blocks).toString ());
1126- // TODO [prio=med]: Fix fee estimation.
1118+ if (response == null ||
1119+ response == - 1 ||
1120+ Decimal .parse (response.toString ()) == Decimal .parse ("-1" )) {
1121+ if (cryptoCurrency is BitcoinFrost ) {
1122+ final rate = Amount (
1123+ rawValue: (cryptoCurrency as BitcoinFrost ).defaultFeeRate,
1124+ fractionDigits: cryptoCurrency.fractionDigits,
1125+ );
1126+ return rate.decimal;
1127+ } else if (cryptoCurrency is ElectrumXCurrencyInterface ) {
1128+ final rate = Amount (
1129+ rawValue:
1130+ (cryptoCurrency as ElectrumXCurrencyInterface ).defaultFeeRate,
1131+ fractionDigits: cryptoCurrency.fractionDigits,
1132+ );
1133+ return rate.decimal;
1134+ } else {
1135+ throw Exception ("Unexpected cryptoCurrency found!" );
1136+ }
11271137 }
11281138 return Decimal .parse (response.toString ());
11291139 } catch (e, s) {
0 commit comments