mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-12-02 12:14:09 +01:00
6.1.0 fixes (#3190)
* - Fix swap state not maintained (fixed rate can be on or off at the same time) - Fix Pay Anything putting contract address - Pick the token of the URI * fix incorrect function calls [skip ci]
This commit is contained in:
@@ -82,6 +82,16 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
|
||||
// depositCurrency = wallet.currency;
|
||||
}
|
||||
|
||||
final List<ReactionDisposer> _disposers = [];
|
||||
|
||||
void dispose() {
|
||||
bestRateSync.cancel();
|
||||
for (final disposer in _disposers) {
|
||||
disposer();
|
||||
}
|
||||
_disposers.clear();
|
||||
}
|
||||
|
||||
ExchangeViewModelBase(
|
||||
this._appStore,
|
||||
this.trades,
|
||||
@@ -166,11 +176,11 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
|
||||
depositAddress =
|
||||
useSameWalletAddress(depositCurrency) ? wallet.walletAddresses.addressForExchange : '';
|
||||
|
||||
reaction((_) => receiveAddress, (_) {
|
||||
_disposers.add(reaction((_) => receiveAddress, (_) {
|
||||
if(!(tradeState is TradeIsCreatedSuccessfully)) {
|
||||
receiveAddressDisplayName = null;
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
provider = providerList.firstOrNull;
|
||||
final initialProvider = provider;
|
||||
@@ -184,9 +194,9 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
|
||||
|
||||
// providerDisplay is read by ui to display auto-selected provider.
|
||||
// it's on a delay so it doesn't flicker.
|
||||
reaction((_)=>bestRateProvider,(val) {
|
||||
_disposers.add(reaction((_) => bestRateProvider, (val) {
|
||||
providerDisplay = val;
|
||||
},delay: 300);
|
||||
}, delay: 300));
|
||||
|
||||
receiveCurrencies = CryptoCurrency.all
|
||||
.where((cryptoCurrency) => !excludeReceiveCurrencies.contains(cryptoCurrency))
|
||||
@@ -202,19 +212,19 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
|
||||
_injectUserTronTokensIntoCurrencyLists();
|
||||
_defineIsReceiveAmountEditable();
|
||||
loadLimits();
|
||||
reaction((_) => isFixedRateMode, (Object _) {
|
||||
_disposers.add(reaction((_) => isFixedRateMode, (Object _) {
|
||||
bestRateProvider = null;
|
||||
bestRate = 0.0;
|
||||
loadLimits();
|
||||
});
|
||||
}));
|
||||
|
||||
reaction((_) => forceDecentralizedExchanges, (val) {
|
||||
_disposers.add(reaction((_) => forceDecentralizedExchanges, (val) {
|
||||
if (val && (bestRateProvider?.description.isCentralized ?? false)) {
|
||||
bestRateProvider = null;
|
||||
bestRate = 0.0;
|
||||
loadLimits();
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
if (isElectrumWallet) {
|
||||
bitcoin!.updateFeeRates(wallet);
|
||||
@@ -1071,6 +1081,11 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
|
||||
|
||||
printV('createTrade: trying provider=${provider.title}');
|
||||
|
||||
// should not happen but just as an extra check
|
||||
if (isFixedRateMode && provider.supportsFixedRate == false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip Swaps.xyz when sending from external
|
||||
if (isSendFromExternal &&
|
||||
provider.description == ExchangeProviderDescription.swapsXyz) {
|
||||
|
||||
Reference in New Issue
Block a user