Merge pull request #109 from cake-tech/CAKE-43-xmr_to-amount-entering

Cake 43 xmr to amount entering
This commit is contained in:
M
2020-10-01 18:38:34 +03:00
7 changed files with 49 additions and 17 deletions
@@ -48,6 +48,7 @@ abstract class ExchangeViewModelBase with Store {
tradeState = ExchangeTradeStateInitial();
_cryptoNumberFormat = NumberFormat()..maximumFractionDigits = 12;
provider = providersForCurrentPair().first;
isReceiveAmountEntered = false;
loadLimits();
}
@@ -92,6 +93,8 @@ abstract class ExchangeViewModelBase with Store {
@observable
bool isReceiveAddressEnabled;
bool isReceiveAmountEntered;
Limits limits;
NumberFormat _cryptoNumberFormat;
@@ -138,7 +141,8 @@ abstract class ExchangeViewModelBase with Store {
provider
.calculateAmount(
from: depositCurrency, to: receiveCurrency, amount: _amount)
from: depositCurrency, to: receiveCurrency, amount: _amount,
isReceiveAmount: true)
.then((amount) => _cryptoNumberFormat
.format(amount)
.toString()
@@ -159,7 +163,8 @@ abstract class ExchangeViewModelBase with Store {
final _amount = double.parse(amount);
provider
.calculateAmount(
from: depositCurrency, to: receiveCurrency, amount: _amount)
from: depositCurrency, to: receiveCurrency, amount: _amount,
isReceiveAmount: false)
.then((amount) => _cryptoNumberFormat
.format(amount)
.toString()
@@ -191,8 +196,10 @@ abstract class ExchangeViewModelBase with Store {
from: depositCurrency,
to: receiveCurrency,
amount: depositAmount,
receiveAmount: receiveAmount,
address: receiveAddress,
refundAddress: depositAddress);
refundAddress: depositAddress,
isBTCRequest: isReceiveAmountEntered);
amount = depositAmount;
currency = depositCurrency;
}