From 6ae7e5fea279ec8b745fe78f6056f43253f3cd35 Mon Sep 17 00:00:00 2001 From: Khushboo Mehta Date: Wed, 10 Jul 2024 21:30:42 +0200 Subject: [PATCH] fix(@desktop/wallet): Swap:: calculate propsal even if amount entered is more than balance fixes #15509 --- ui/app/AppLayouts/Wallet/popups/swap/SwapModal.qml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ui/app/AppLayouts/Wallet/popups/swap/SwapModal.qml b/ui/app/AppLayouts/Wallet/popups/swap/SwapModal.qml index d891e11862..5f6d89651d 100644 --- a/ui/app/AppLayouts/Wallet/popups/swap/SwapModal.qml +++ b/ui/app/AppLayouts/Wallet/popups/swap/SwapModal.qml @@ -46,7 +46,7 @@ StatusDialog { } function fetchSuggestedRoutes() { - if (payPanel.valueValid && root.swapInputParamsForm.isFormFilledCorrectly()) { + if (root.swapInputParamsForm.isFormFilledCorrectly()) { root.swapAdaptor.validSwapProposalReceived = false root.swapAdaptor.swapProposalLoading = true root.swapAdaptor.approvalPending = false @@ -220,7 +220,6 @@ StatusDialog { root.swapInputParamsForm.fromTokenAmount = amount } } - onValueValidChanged: d.fetchSuggestedRoutes() } SwapInputPanel { @@ -295,13 +294,14 @@ StatusDialog { Layout.alignment: Qt.AlignHCenter Layout.topMargin: Style.current.smallPadding text: { - if (payPanel.amountEnteredGreaterThanBalance) { + if (root.swapAdaptor.swapOutputData.hasError) { + return qsTr("An error has occured, please try again") + } else if (payPanel.amountEnteredGreaterThanBalance) { return qsTr("Insufficient funds for swap") } - return qsTr("An error has occured, please try again") } buttonText: qsTr("Buy crypto") - buttonVisible: payPanel.amountEnteredGreaterThanBalance + buttonVisible: !root.swapAdaptor.swapOutputData.hasError && payPanel.amountEnteredGreaterThanBalance onButtonClicked: Global.openBuyCryptoModalRequested() } }