CWA-199 | moved limitsFormat() to xmrto_exchange_provider

This commit is contained in:
Oleksandr Sobol 2020-04-13 20:31:00 +03:00
parent 99c732aab0
commit 877522d12e
2 changed files with 4 additions and 10 deletions

View file

@ -1,7 +0,0 @@
import 'package:intl/intl.dart';
final amountFormat = NumberFormat()
..maximumFractionDigits = 3
..minimumFractionDigits = 1;
double limitsFormat(double limit) => double.parse(amountFormat.format(limit));

View file

@ -12,7 +12,6 @@ import 'package:cake_wallet/src/domain/exchange/xmrto/xmrto_trade_request.dart';
import 'package:cake_wallet/src/domain/exchange/trade_not_created_exeption.dart';
import 'package:cake_wallet/src/domain/exchange/exchange_provider_description.dart';
import 'package:cake_wallet/src/domain/exchange/trade_not_found_exeption.dart';
import 'package:cake_wallet/src/domain/exchange/limits_format.dart';
class XMRTOExchangeProvider extends ExchangeProvider {
XMRTOExchangeProvider()
@ -69,9 +68,9 @@ class XMRTOExchangeProvider extends ExchangeProvider {
if (price > 0) {
try {
min = min/price + correction;
min = limitsFormat(min);
min = _limitsFormat(min);
max = max/price - correction;
max = limitsFormat(max);
max = _limitsFormat(max);
} catch (e) {
min = 0;
max = 0;
@ -194,4 +193,6 @@ class XMRTOExchangeProvider extends ExchangeProvider {
return 0.0;
}
}
double _limitsFormat(double limit) => double.parse(limit.toStringAsFixed(3));
}