CWA-199 | moved limitsFormat() to xmrto_exchange_provider
Oleksandr Sobol committed
Apr 13, 2020 at 20:31 UTC
877522d12e3a0027d40f4066e1e6a83494b17b44
2 files changed
+4
-10
lib/src/domain/exchange/limits_format.dart
deleted
-7
@@ -1,7 +0,0 @@
1
-import 'package:intl/intl.dart';
2
-
3
-final amountFormat = NumberFormat()
4
- ..maximumFractionDigits = 3
5
- ..minimumFractionDigits = 1;
6
-
7
-double limitsFormat(double limit) => double.parse(amountFormat.format(limit));
\ No newline at end of file
lib/src/domain/exchange/xmrto/xmrto_exchange_provider.dart
+4
-3
@@ -12,7 +12,6 @@ import 'package:cake_wallet/src/domain/exchange/xmrto/xmrto_trade_request.dart';
12
import 'package:cake_wallet/src/domain/exchange/trade_not_created_exeption.dart';
13
import 'package:cake_wallet/src/domain/exchange/exchange_provider_description.dart';
14
import 'package:cake_wallet/src/domain/exchange/trade_not_found_exeption.dart';
15
-import 'package:cake_wallet/src/domain/exchange/limits_format.dart';
15
16
class XMRTOExchangeProvider extends ExchangeProvider {
17
XMRTOExchangeProvider()
@@ -69,9 +68,9 @@ class XMRTOExchangeProvider extends ExchangeProvider {
68
if (price > 0) {
69
try {
70
min = min/price + correction;
72
- min = limitsFormat(min);
71
+ min = _limitsFormat(min);
72
max = max/price - correction;
74
- max = limitsFormat(max);
73
+ max = _limitsFormat(max);
74
} catch (e) {
75
min = 0;
76
max = 0;
@@ -194,4 +193,6 @@ class XMRTOExchangeProvider extends ExchangeProvider {
193
return 0.0;
194
}
195
}
196
+
197
+ double _limitsFormat(double limit) => double.parse(limit.toStringAsFixed(3));
198
}