fix(@desktop/wallet): Swap:: calculate propsal even if amount entered is more than balance

fixes #15509
This commit is contained in:
Khushboo Mehta 2024-07-10 21:30:42 +02:00 committed by dlipicar
parent 4a097cfef7
commit 6ae7e5fea2
1 changed files with 5 additions and 5 deletions

View File

@ -46,7 +46,7 @@ StatusDialog {
} }
function fetchSuggestedRoutes() { function fetchSuggestedRoutes() {
if (payPanel.valueValid && root.swapInputParamsForm.isFormFilledCorrectly()) { if (root.swapInputParamsForm.isFormFilledCorrectly()) {
root.swapAdaptor.validSwapProposalReceived = false root.swapAdaptor.validSwapProposalReceived = false
root.swapAdaptor.swapProposalLoading = true root.swapAdaptor.swapProposalLoading = true
root.swapAdaptor.approvalPending = false root.swapAdaptor.approvalPending = false
@ -220,7 +220,6 @@ StatusDialog {
root.swapInputParamsForm.fromTokenAmount = amount root.swapInputParamsForm.fromTokenAmount = amount
} }
} }
onValueValidChanged: d.fetchSuggestedRoutes()
} }
SwapInputPanel { SwapInputPanel {
@ -295,13 +294,14 @@ StatusDialog {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.topMargin: Style.current.smallPadding Layout.topMargin: Style.current.smallPadding
text: { 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("Insufficient funds for swap")
} }
return qsTr("An error has occured, please try again")
} }
buttonText: qsTr("Buy crypto") buttonText: qsTr("Buy crypto")
buttonVisible: payPanel.amountEnteredGreaterThanBalance buttonVisible: !root.swapAdaptor.swapOutputData.hasError && payPanel.amountEnteredGreaterThanBalance
onButtonClicked: Global.openBuyCryptoModalRequested() onButtonClicked: Global.openBuyCryptoModalRequested()
} }
} }