diff --git a/src/app_service/service/transaction/service.nim b/src/app_service/service/transaction/service.nim index 5cb540b42c..c53484dfc0 100644 --- a/src/app_service/service/transaction/service.nim +++ b/src/app_service/service/transaction/service.nim @@ -152,6 +152,7 @@ QtObject: networkService: network_service.Service settingsService: settings_service.Service tokenService: token_service.Service + uuidOfTheLastRequestForSuggestedRoutes: string ## Forward declarations proc suggestedRoutesV2Ready(self: Service, uuid: string, route: seq[TransactionPathDtoV2], routeRaw: string, errCode: string, errDescription: string) @@ -508,7 +509,7 @@ QtObject: if not asset.isNil: var foundAddress = false for addressPerChain in asset.addressPerChainId: - if addressPerChain.chainId == route.toNetwork.chainId: + if addressPerChain.chainId == route.fromNetwork.chainId: toContractAddress = parseAddress(addressPerChain.address) foundAddress = true break @@ -648,8 +649,10 @@ QtObject: error "Error getting suggested fees", msg = e.msg proc suggestedRoutesV2Ready(self: Service, uuid: string, route: seq[TransactionPathDtoV2], routeRaw: string, errCode: string, errDescription: string) = - # TODO: refactor sending modal part of the app, but for now since we're integrating the router v2 just map params to the old dto + if self.uuidOfTheLastRequestForSuggestedRoutes != uuid: + return + # TODO: refactor sending modal part of the app, but for now since we're integrating the router v2 just map params to the old dto var oldRoute = convertToOldRoute(route) let suggestedDto = SuggestedRoutesDto( @@ -680,6 +683,8 @@ QtObject: lockedInAmounts: Table[string, string] = initTable[string, string](), extraParamsTable: Table[string, string] = initTable[string, string]()) = + self.uuidOfTheLastRequestForSuggestedRoutes = uuid + let bigAmountIn = common_utils.stringToUint256(amountIn) bigAmountOut = common_utils.stringToUint256(amountOut) diff --git a/ui/app/AppLayouts/Wallet/WalletUtils.qml b/ui/app/AppLayouts/Wallet/WalletUtils.qml index 311bd38a78..64ac86ac65 100644 --- a/ui/app/AppLayouts/Wallet/WalletUtils.qml +++ b/ui/app/AppLayouts/Wallet/WalletUtils.qml @@ -134,6 +134,10 @@ QtObject { function getRouterErrorBasedOnCode(code) { + if (code === "") { + return "" + } + switch(code) { case Constants.routerErrorCodes.processor.errFailedToParseBaseFee: case Constants.routerErrorCodes.processor.errFailedToParsePercentageFee: @@ -203,12 +207,18 @@ QtObject { return qsTr("not enough token balance") case Constants.routerErrorCodes.router.errNotEnoughNativeBalance: return qsTr("not enough ETH") + case Constants.routerErrorCodes.router.errLowAmountInForHopBridge: + return qsTr("amount in too low") default: return qsTr("unknown processor error") } } function getRouterErrorDetailsOnCode(code, details) { + if (code === "") { + return "" + } + switch(code) { case Constants.routerErrorCodes.processor.errFailedToParseBaseFee: return qsTr("failed to parse base fee") @@ -346,7 +356,8 @@ QtObject { catch (e) { return "" } - + case Constants.routerErrorCodes.router.errLowAmountInForHopBridge: + return qsTr("bonder fee greater than estimated received, a higher amount is needed to cover fees") default: return "" } diff --git a/ui/imports/shared/popups/send/SendModal.qml b/ui/imports/shared/popups/send/SendModal.qml index 3ab0fa6c6c..c9ecd00d1b 100644 --- a/ui/imports/shared/popups/send/SendModal.qml +++ b/ui/imports/shared/popups/send/SendModal.qml @@ -680,10 +680,8 @@ StatusDialog { function onSuggestedRoutesReady(txRoutes, errCode, errDescription) { popup.bestRoutes = txRoutes.suggestedRoutes - if (errCode !== "") { - d.routerError = WalletUtils.getRouterErrorBasedOnCode(errCode) - d.routerErrorDetails = "%1 - %2".arg(errCode).arg(WalletUtils.getRouterErrorDetailsOnCode(errCode, errDescription)) - } + d.routerError = WalletUtils.getRouterErrorBasedOnCode(errCode) + d.routerErrorDetails = "%1 - %2".arg(errCode).arg(WalletUtils.getRouterErrorDetailsOnCode(errCode, errDescription)) let gasTimeEstimate = txRoutes.gasTimeEstimate d.totalTimeEstimate = WalletUtils.getLabelForEstimatedTxTime(gasTimeEstimate.totalTime) diff --git a/ui/imports/utils/Constants.qml b/ui/imports/utils/Constants.qml index ac40a22527..8af3ddd9de 100644 --- a/ui/imports/utils/Constants.qml +++ b/ui/imports/utils/Constants.qml @@ -1125,6 +1125,7 @@ QtObject { readonly property string errNoBestRouteFound : "WR-023" readonly property string errCannotCheckReceiverBalance : "WR-024" readonly property string errCannotCheckLockedAmounts : "WR-025" + readonly property string errLowAmountInForHopBridge : "WR-026" } } diff --git a/vendor/status-go b/vendor/status-go index 791ff9a0ed..8787da1b89 160000 --- a/vendor/status-go +++ b/vendor/status-go @@ -1 +1 @@ -Subproject commit 791ff9a0edef77a1cac7e35580a2464bba7f3d51 +Subproject commit 8787da1b899d25a65332b0aee2440b8453062343