mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-10 21:04:53 +00:00
CAKE-296 | added receiveCurrencies (list of crypto currencies without xlm and xrp) to exchange_view_model.dart; applied receiveCurrencies to receive card in the exchange_page.dart
This commit is contained in:
parent
d9752e5709
commit
68c12cbb79
3 changed files with 9 additions and 22 deletions
|
@ -17,23 +17,12 @@ import 'package:cake_wallet/exchange/trade_not_created_exeption.dart';
|
||||||
class ChangeNowExchangeProvider extends ExchangeProvider {
|
class ChangeNowExchangeProvider extends ExchangeProvider {
|
||||||
ChangeNowExchangeProvider()
|
ChangeNowExchangeProvider()
|
||||||
: super(
|
: super(
|
||||||
/*pairList: CryptoCurrency.all
|
pairList: CryptoCurrency.all
|
||||||
.map((i) => CryptoCurrency.all
|
.map((i) => CryptoCurrency.all
|
||||||
.map((k) => ExchangePair(from: i, to: k, reverse: true))
|
.map((k) => ExchangePair(from: i, to: k, reverse: true))
|
||||||
.where((c) => c != null))
|
.where((c) => c != null))
|
||||||
.expand((i) => i)
|
.expand((i) => i)
|
||||||
.toList());*/
|
.toList());
|
||||||
pairList: CryptoCurrency.all
|
|
||||||
.map((i) => CryptoCurrency.all
|
|
||||||
.map((k) {
|
|
||||||
if ((i != CryptoCurrency.xmr)||
|
|
||||||
((k != CryptoCurrency.xrp)&&(k != CryptoCurrency.xlm))) {
|
|
||||||
return ExchangePair(from: i, to: k, reverse: true);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.where((c) => c != null))
|
|
||||||
.expand((i) => i)
|
|
||||||
.toList());
|
|
||||||
|
|
||||||
static const apiUri = 'https://changenow.io/api/v1';
|
static const apiUri = 'https://changenow.io/api/v1';
|
||||||
static const apiKey = secrets.changeNowApiKey;
|
static const apiKey = secrets.changeNowApiKey;
|
||||||
|
|
|
@ -248,7 +248,8 @@ class ExchangePage extends BasePage {
|
||||||
exchangeViewModel
|
exchangeViewModel
|
||||||
.isReceiveAddressEnabled,
|
.isReceiveAddressEnabled,
|
||||||
isAmountEstimated: true,
|
isAmountEstimated: true,
|
||||||
currencies: CryptoCurrency.all,
|
currencies:
|
||||||
|
exchangeViewModel.receiveCurrencies,
|
||||||
onCurrencySelected: (currency) =>
|
onCurrencySelected: (currency) =>
|
||||||
exchangeViewModel
|
exchangeViewModel
|
||||||
.changeReceiveCurrency(
|
.changeReceiveCurrency(
|
||||||
|
@ -464,7 +465,6 @@ class ExchangePage extends BasePage {
|
||||||
},
|
},
|
||||||
color: Theme.of(context).accentTextTheme.body2.color,
|
color: Theme.of(context).accentTextTheme.body2.color,
|
||||||
textColor: Colors.white,
|
textColor: Colors.white,
|
||||||
isDisabled: exchangeViewModel.isDisabledExchangeButton,
|
|
||||||
isLoading:
|
isLoading:
|
||||||
exchangeViewModel.tradeState is TradeIsCreating)),
|
exchangeViewModel.tradeState is TradeIsCreating)),
|
||||||
]),
|
]),
|
||||||
|
|
|
@ -57,10 +57,12 @@ abstract class ExchangeViewModelBase with Store {
|
||||||
_onPairChange();
|
_onPairChange();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
receiveCurrencies = CryptoCurrency.all.where((cryptoCurrency) =>
|
||||||
|
(cryptoCurrency != CryptoCurrency.xlm)&&
|
||||||
|
(cryptoCurrency != CryptoCurrency.xrp)).toList();
|
||||||
_defineIsReceiveAmountEditable();
|
_defineIsReceiveAmountEditable();
|
||||||
isFixedRateMode = false;
|
isFixedRateMode = false;
|
||||||
isReceiveAmountEntered = false;
|
isReceiveAmountEntered = false;
|
||||||
isDisabledExchangeButton = false;
|
|
||||||
loadLimits();
|
loadLimits();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,9 +116,6 @@ abstract class ExchangeViewModelBase with Store {
|
||||||
@observable
|
@observable
|
||||||
bool isFixedRateMode;
|
bool isFixedRateMode;
|
||||||
|
|
||||||
@observable
|
|
||||||
bool isDisabledExchangeButton;
|
|
||||||
|
|
||||||
@computed
|
@computed
|
||||||
SyncStatus get status => wallet.syncStatus;
|
SyncStatus get status => wallet.syncStatus;
|
||||||
|
|
||||||
|
@ -127,6 +126,8 @@ abstract class ExchangeViewModelBase with Store {
|
||||||
bool get hasAllAmount =>
|
bool get hasAllAmount =>
|
||||||
wallet.type == WalletType.bitcoin && depositCurrency == wallet.currency;
|
wallet.type == WalletType.bitcoin && depositCurrency == wallet.currency;
|
||||||
|
|
||||||
|
List<CryptoCurrency> receiveCurrencies;
|
||||||
|
|
||||||
Limits limits;
|
Limits limits;
|
||||||
|
|
||||||
NumberFormat _cryptoNumberFormat;
|
NumberFormat _cryptoNumberFormat;
|
||||||
|
@ -378,14 +379,11 @@ abstract class ExchangeViewModelBase with Store {
|
||||||
_providerForPair(from: depositCurrency, to: receiveCurrency);
|
_providerForPair(from: depositCurrency, to: receiveCurrency);
|
||||||
|
|
||||||
if (provider != null) {
|
if (provider != null) {
|
||||||
isDisabledExchangeButton = false;
|
|
||||||
changeProvider(provider: provider);
|
changeProvider(provider: provider);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
isDisabledExchangeButton = true;
|
|
||||||
depositAmount = '';
|
depositAmount = '';
|
||||||
receiveAmount = '';
|
receiveAmount = '';
|
||||||
limitsState = LimitsLoadedFailure(error: 'Pair is not exists');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue