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:
Omar Hatem
2026-04-18 00:05:14 +02:00
committed by GitHub
parent 2544e0cd58
commit 314eb36dd5
8 changed files with 49 additions and 14 deletions
@@ -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) {