diff --git a/src/app/modules/main/wallet_section/send/controller.nim b/src/app/modules/main/wallet_section/send/controller.nim index 64103a75d9..4f57455968 100644 --- a/src/app/modules/main/wallet_section/send/controller.nim +++ b/src/app/modules/main/wallet_section/send/controller.nim @@ -125,6 +125,9 @@ proc suggestedRoutes*(self: Controller, self.transactionService.suggestedRoutes(uuid, sendType, accountFrom, accountTo, token, amountIn, toToken, amountOut, disabledFromChainIDs, disabledToChainIDs, lockedInAmounts, extraParamsTable) +proc stopSuggestedRoutesAsyncCalculation*(self: Controller) = + self.transactionService.stopSuggestedRoutesAsyncCalculation() + proc transfer*(self: Controller, from_addr: string, to_addr: string, assetKey: string, toAssetKey: string, uuid: string, selectedRoutes: seq[TransactionPathDto], password: string, sendType: SendType, usePassword: bool, doHashing: bool, tokenName: string, isOwnerToken: bool, diff --git a/src/app/modules/main/wallet_section/send/io_interface.nim b/src/app/modules/main/wallet_section/send/io_interface.nim index f6e57b0bc4..38b492a72f 100644 --- a/src/app/modules/main/wallet_section/send/io_interface.nim +++ b/src/app/modules/main/wallet_section/send/io_interface.nim @@ -37,6 +37,9 @@ method suggestedRoutes*(self: AccessInterface, extraParamsTable: Table[string, string] = initTable[string, string]()) {.base.} = raise newException(ValueError, "No implementation available") +method stopUpdatesForSuggestedRoute*(self: AccessInterface) {.base.} = + raise newException(ValueError, "No implementation available") + method suggestedRoutesReady*(self: AccessInterface, uuid: string, suggestedRoutes: SuggestedRoutesDto, errCode: string, errDescription: string) {.base.} = raise newException(ValueError, "No implementation available") diff --git a/src/app/modules/main/wallet_section/send/module.nim b/src/app/modules/main/wallet_section/send/module.nim index 0effcabbc0..815c4ca39e 100644 --- a/src/app/modules/main/wallet_section/send/module.nim +++ b/src/app/modules/main/wallet_section/send/module.nim @@ -109,7 +109,7 @@ proc convertSendToNetworkToNetworkItem(self: Module, network: SendToNetwork): Ne proc convertNetworkDtoToNetworkRouteItem(self: Module, network: network_service_item.NetworkItem): NetworkRouteItem = result = initNetworkRouteItem( - network.chainId, + network.chainId, network.layer, true, false, @@ -220,7 +220,7 @@ method authenticateAndTransferWithPaths*(self: Module, fromAddr: string, toAddr: # Temporary until transaction service rework is completed let pathsV2 = rawPaths.toTransactionPathsDtoV2() let pathsV1 = pathsV2.convertToOldRoute().addFirstSimpleBridgeTxFlag() - + self.tmpSendTransactionDetails.paths = pathsV1 self.tmpSendTransactionDetails.slippagePercentage = slippagePercentage self.authenticateAndTransfer(fromAddr, toAddr, assetKey, toAssetKey, uuid, sendType, selectedTokenName, selectedTokenIsOwnerToken) @@ -325,6 +325,9 @@ method suggestedRoutes*(self: Module, extraParamsTable ) +method stopUpdatesForSuggestedRoute*(self: Module) = + self.controller.stopSuggestedRoutesAsyncCalculation() + method filterChanged*(self: Module, addresses: seq[string], chainIds: seq[int]) = if addresses.len == 0: return diff --git a/src/app/modules/main/wallet_section/send/view.nim b/src/app/modules/main/wallet_section/send/view.nim index 5790a86c4c..188464e89c 100644 --- a/src/app/modules/main/wallet_section/send/view.nim +++ b/src/app/modules/main/wallet_section/send/view.nim @@ -236,6 +236,9 @@ QtObject: extraParamsTable ) + proc stopUpdatesForSuggestedRoute*(self: View) {.slot.} = + self.delegate.stopUpdatesForSuggestedRoute() + proc updateRoutePreferredChains*(self: View, chainIds: string) {.slot.} = self.toNetworksRouteModel.updateRoutePreferredChains(chainIds) @@ -325,7 +328,7 @@ QtObject: proc transactionSendingComplete*(self: View, txHash: string, success: bool) {.signal.} proc sendtransactionSendingCompleteSignal*(self: View, txHash: string, success: bool) = self.transactionSendingComplete(txHash, success) - + proc setSenderAccount*(self: View, address: string) {.slot.} = self.setSelectedSenderAccountAddress(address) self.delegate.notifySelectedSenderAccountChanged() diff --git a/src/app_service/service/transaction/service.nim b/src/app_service/service/transaction/service.nim index d8e0fb35f9..74f92b7f6a 100644 --- a/src/app_service/service/transaction/service.nim +++ b/src/app_service/service/transaction/service.nim @@ -702,6 +702,12 @@ QtObject: except CatchableError as e: error "suggestedRoutes", exception=e.msg + proc stopSuggestedRoutesAsyncCalculation*(self: Service) = + try: + discard eth.stopSuggestedRoutesAsyncCalculation() + except CatchableError as e: + error "stopSuggestedRoutesAsyncCalculation", exception=e.msg + proc getEstimatedTime*(self: Service, chainId: int, maxFeePerGas: string): EstimatedTime = try: let response = backend.getTransactionEstimatedTime(chainId, maxFeePerGas).result.getInt diff --git a/ui/app/AppLayouts/Wallet/popups/swap/SwapModal.qml b/ui/app/AppLayouts/Wallet/popups/swap/SwapModal.qml index 87a56cd5b8..1b563f66bc 100644 --- a/ui/app/AppLayouts/Wallet/popups/swap/SwapModal.qml +++ b/ui/app/AppLayouts/Wallet/popups/swap/SwapModal.qml @@ -112,7 +112,10 @@ StatusDialog { } onOpened: payPanel.forceActiveFocus() - onClosed: root.swapAdaptor.reset() + onClosed: { + root.swapAdaptor.stopUpdatesForSuggestedRoute() + root.swapAdaptor.reset() + } header: Item { implicitHeight: selector.implicitHeight diff --git a/ui/app/AppLayouts/Wallet/popups/swap/SwapModalAdaptor.qml b/ui/app/AppLayouts/Wallet/popups/swap/SwapModalAdaptor.qml index 326c47dd97..13a59cf320 100644 --- a/ui/app/AppLayouts/Wallet/popups/swap/SwapModalAdaptor.qml +++ b/ui/app/AppLayouts/Wallet/popups/swap/SwapModalAdaptor.qml @@ -334,6 +334,10 @@ QObject { } } + function stopUpdatesForSuggestedRoute() { + root.swapStore.stopUpdatesForSuggestedRoute() + } + function sendApproveTx() { root.approvalPending = true const accountAddress = root.swapFormData.selectedAccountAddress diff --git a/ui/app/AppLayouts/Wallet/stores/SwapStore.qml b/ui/app/AppLayouts/Wallet/stores/SwapStore.qml index 35addca1e4..2106628dd9 100644 --- a/ui/app/AppLayouts/Wallet/stores/SwapStore.qml +++ b/ui/app/AppLayouts/Wallet/stores/SwapStore.qml @@ -41,6 +41,10 @@ QtObject { tokenFrom, tokenTo, disabledFromChainIDs, disabledToChainIDs, sendType, lockedInAmounts) } + function stopUpdatesForSuggestedRoute() { + root.walletSectionSendInst.stopUpdatesForSuggestedRoute() + } + function authenticateAndTransfer(uuid, accountFrom, accountTo, tokenFrom, tokenTo, sendType, tokenName, tokenIsOwnerToken, paths, slippagePercentage) { root.walletSectionSendInst.authenticateAndTransferWithParameters(uuid, accountFrom, accountTo, diff --git a/ui/imports/shared/popups/send/SendModal.qml b/ui/imports/shared/popups/send/SendModal.qml index efd9744fd9..7863b3532a 100644 --- a/ui/imports/shared/popups/send/SendModal.qml +++ b/ui/imports/shared/popups/send/SendModal.qml @@ -278,7 +278,10 @@ StatusDialog { } } - onClosed: popup.store.resetStoredProperties() + onClosed: { + popup.store.stopUpdatesForSuggestedRoute() + popup.store.resetStoredProperties() + } header: Item { implicitHeight: accountSelector.implicitHeight diff --git a/ui/imports/shared/stores/send/TransactionStore.qml b/ui/imports/shared/stores/send/TransactionStore.qml index 226c2ec445..93d254fac0 100644 --- a/ui/imports/shared/stores/send/TransactionStore.qml +++ b/ui/imports/shared/stores/send/TransactionStore.qml @@ -70,6 +70,10 @@ QtObject { walletSectionSendInst.suggestedRoutes(valueIn.toFixed(), valueOut.toFixed(), extraParamsJson) } + function stopUpdatesForSuggestedRoute() { + walletSectionSendInst.stopUpdatesForSuggestedRoute() + } + function resolveENS(value) { mainModuleInst.resolveENS(value, "") }