Skip to content

Commit c29d552

Browse files
fix(@desktop/wallet): Fix for freeze in Approval stage in SwapModal
noticed only on linux fixes #18627
1 parent 565e140 commit c29d552

File tree

5 files changed

+15
-1
lines changed

5 files changed

+15
-1
lines changed

src/app/modules/main/wallet_section/send/io_interface.nim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,6 @@ method getNetworkChainId*(self: AccessInterface, shortName: string): int {.base.
8787

8888
method reevaluateSwap*(self: AccessInterface, uuid: string, chainId: int, isApprovalTx: bool) {.base.} =
8989
raise newException(ValueError, "No implementation available")
90+
91+
method stopSuggestedRoutesAsyncCalculation*(self: AccessInterface) {.base.} =
92+
raise newException(ValueError, "No implementation available")

src/app/modules/main/wallet_section/send/module.nim

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,9 @@ method resetData*(self: Module) =
362362
self.controller.stopSuggestedRoutesAsyncCalculation()
363363
self.clearTmpData(keepPinPass = self.tmpClearLocalDataLater)
364364

365+
method stopSuggestedRoutesAsyncCalculation*(self: Module) =
366+
self.controller.stopSuggestedRoutesAsyncCalculation()
367+
365368
method filterChanged*(self: Module, addresses: seq[string], chainIds: seq[int], isDirty: bool) =
366369
if not isDirty or addresses.len == 0:
367370
return
@@ -420,4 +423,4 @@ method reevaluateSwap*(self: Module, uuid: string, chainId: int, isApprovalTx: b
420423
const pathName = "Paraswap"
421424
let err = self.controller.reevaluateRouterPath(uuid, pathName, chainId, isApprovalTx)
422425
if err.len > 0:
423-
error "reevaluateRouterPath failed: ", err=err
426+
error "reevaluateRouterPath failed: ", err=err

src/app/modules/main/wallet_section/send/view.nim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,9 @@ QtObject:
238238
self.selectedAssetKey = ""
239239
self.showUnPreferredChains = false
240240

241+
proc stopSuggestedRoutesAsyncCalculation*(self: View) {.slot.} =
242+
self.delegate.stopSuggestedRoutesAsyncCalculation()
243+
241244
proc splitAndFormatAddressPrefix(self: View, text : string, updateInStore: bool): string {.slot.} =
242245
return self.delegate.splitAndFormatAddressPrefix(text, updateInStore)
243246

ui/app/AppLayouts/Wallet/popups/swap/SwapModalAdaptor.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ QObject {
172172
if (uuid !== d.uuid || !!error) {
173173
root.approvalPending = false
174174
root.approvalSuccessful = false
175+
root.swapStore.stopSuggestedRoutesAsyncCalculation()
175176
return
176177
}
177178
root.approvalPending = true

ui/app/AppLayouts/Wallet/stores/SwapStore.qml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ QtObject {
4343
root.walletSectionSendInst.resetData()
4444
}
4545

46+
function stopSuggestedRoutesAsyncCalculation() {
47+
root.walletSectionSendInst.stopSuggestedRoutesAsyncCalculation()
48+
}
49+
4650
function authenticateAndTransfer(uuid) {
4751
root.walletSectionSendInst.authenticateAndTransfer(uuid)
4852
}

0 commit comments

Comments
 (0)