Skip to content

Commit a6cc271

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

File tree

3 files changed

+26
-8
lines changed

3 files changed

+26
-8
lines changed

src/app_service/service/transaction/async_tasks.nim

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,19 @@ proc fetchDecodedTxDataTask*(argEncoded: string) {.gcsafe, nimcall.} =
3636
except Exception as e:
3737
error "Error decoding tx input", message = e.msg
3838
arg.finish(data)
39+
40+
type
41+
ReevaluateRouterPathTaskArg* = ref object of QObjectTaskArg
42+
uuid: string
43+
pathName: string
44+
chainId: int
45+
isApprovalTx: bool
46+
47+
proc reevaluateRouterPathTask*(argEncoded: string) {.gcsafe, nimcall.} =
48+
let arg = decode[ReevaluateRouterPathTaskArg](argEncoded)
49+
try:
50+
let err = wallet.reevaluateRouterPath(arg.uuid, arg.pathName, arg.chainId, arg.isApprovalTx)
51+
if err.len > 0:
52+
raise newException(CatchableError, err)
53+
except CatchableError as e:
54+
error "reevaluateRouterPath", exception=e.msg

src/app_service/service/transaction/service.nim

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -543,10 +543,12 @@ proc sendRouterTransactionsWithSignatures*(self: Service, uuid: string, signatur
543543
return ""
544544

545545
proc reevaluateRouterPath*(self: Service, uuid: string, pathName: string, chainId: int, isApprovalTx: bool): string =
546-
try:
547-
let err = wallet.reevaluateRouterPath(uuid, pathName, chainId, isApprovalTx)
548-
if err.len > 0:
549-
raise newException(CatchableError, err)
550-
except CatchableError as e:
551-
error "reevaluateRouterPath", exception=e.msg
552-
return e.msg
546+
let arg = ReevaluateRouterPathTaskArg(
547+
tptr: reevaluateRouterPathTask,
548+
vptr: cast[uint](self.vptr),
549+
uuid: uuid,
550+
pathName: pathName,
551+
chainId: chainId,
552+
isApprovalTx: isApprovalTx,
553+
)
554+
self.threadpool.start(arg)

0 commit comments

Comments
 (0)