truncate exchange amount

This commit is contained in:
Serhii 2023-03-31 12:45:54 +03:00
parent 8b7bfd74e3
commit 3e43e899a5

View file

@ -287,6 +287,7 @@ abstract class ExchangeViewModelBase with Store {
await _calculateBestRate(); await _calculateBestRate();
} }
_cryptoNumberFormat.maximumFractionDigits = depositMaxDigits;
depositAmount = _cryptoNumberFormat depositAmount = _cryptoNumberFormat
.format(_enteredAmount / _bestRate) .format(_enteredAmount / _bestRate)
@ -312,6 +313,7 @@ abstract class ExchangeViewModelBase with Store {
await _calculateBestRate(); await _calculateBestRate();
} }
_cryptoNumberFormat.maximumFractionDigits = receiveMaxDigits;
receiveAmount = _cryptoNumberFormat receiveAmount = _cryptoNumberFormat
.format(_bestRate * _enteredAmount) .format(_bestRate * _enteredAmount)
@ -709,4 +711,8 @@ abstract class ExchangeViewModelBase with Store {
providerList = _allProviders; providerList = _allProviders;
} }
} }
int get depositMaxDigits => depositCurrency == CryptoCurrency.btc ? 8 : 12;
int get receiveMaxDigits => receiveCurrency == CryptoCurrency.btc ? 8 : 12;
} }