mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-18 05:51:34 +02:00
Enable exchange for haven wallets. (#495)
This commit is contained in:
@@ -337,7 +337,7 @@ abstract class DashboardViewModelBase with Store {
|
||||
}
|
||||
|
||||
void updateActions() {
|
||||
isEnabledExchangeAction = wallet.type != WalletType.haven;
|
||||
isEnabledExchangeAction = true;
|
||||
hasExchangeAction = !isHaven;
|
||||
isEnabledBuyAction = wallet.type != WalletType.haven
|
||||
&& wallet.type != WalletType.monero;
|
||||
|
||||
@@ -40,10 +40,10 @@ class ExchangeViewModel = ExchangeViewModelBase with _$ExchangeViewModel;
|
||||
abstract class ExchangeViewModelBase with Store {
|
||||
ExchangeViewModelBase(this.wallet, this.trades, this._exchangeTemplateStore,
|
||||
this.tradesStore, this._settingsStore, this.sharedPreferences) {
|
||||
const excludeDepositCurrencies = [CryptoCurrency.xhv];
|
||||
const excludeReceiveCurrencies = [CryptoCurrency.xlm, CryptoCurrency.xrp, CryptoCurrency.bnb, CryptoCurrency.xhv];
|
||||
const excludeDepositCurrencies = <CryptoCurrency>[];
|
||||
const excludeReceiveCurrencies = [CryptoCurrency.xlm, CryptoCurrency.xrp, CryptoCurrency.bnb];
|
||||
providerList = [ChangeNowExchangeProvider(), SideShiftExchangeProvider(), SimpleSwapExchangeProvider()];
|
||||
|
||||
_initialPairBasedOnWallet();
|
||||
currentTradeAvailableProviders = SplayTreeMap<double, ExchangeProvider>();
|
||||
|
||||
final Map<String, dynamic> exchangeProvidersSelection = json
|
||||
@@ -51,13 +51,12 @@ abstract class ExchangeViewModelBase with Store {
|
||||
|
||||
/// if the provider is not in the user settings (user's first time or newly added provider)
|
||||
/// then use its default value decided by us
|
||||
selectedProviders = ObservableList.of(providerList.where(
|
||||
selectedProviders = ObservableList.of(providersForCurrentPair().where(
|
||||
(element) => exchangeProvidersSelection[element.title] == null
|
||||
? element.isEnabled
|
||||
: (exchangeProvidersSelection[element.title] as bool))
|
||||
.toList());
|
||||
|
||||
_initialPairBasedOnWallet();
|
||||
isDepositAddressEnabled = !(depositCurrency == wallet.currency);
|
||||
isReceiveAddressEnabled = !(receiveCurrency == wallet.currency);
|
||||
depositAmount = '';
|
||||
@@ -532,6 +531,10 @@ abstract class ExchangeViewModelBase with Store {
|
||||
depositCurrency = CryptoCurrency.ltc;
|
||||
receiveCurrency = CryptoCurrency.xmr;
|
||||
break;
|
||||
case WalletType.haven:
|
||||
depositCurrency = CryptoCurrency.xhv;
|
||||
receiveCurrency = CryptoCurrency.btc;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user