fix(wallet)_: Disable send button on router errors & visually indicate gas issues

* Disable the send button when the router returns errors.
 * Display a red arrow on networks lacking sufficient gas for the transaction.

Closes #15700 #15701
This commit is contained in:
belalshehab 2024-07-27 19:21:14 +03:00 committed by Belal Shehab
parent 446eb6e7ae
commit 955c8f6580
2 changed files with 3 additions and 2 deletions

View File

@ -656,7 +656,7 @@ StatusDialog {
maxFiatFees: popup.isLoading ? "..." : d.currencyStore.formatCurrencyAmount(d.totalFeesInFiat, d.currencyStore.currentCurrency)
totalTimeEstimate: popup.isLoading? "..." : d.totalTimeEstimate
pending: d.isPendingTx || popup.isLoading
visible: recipientInputLoader.ready && (amountToSend.ready || d.isCollectiblesTransfer) && !d.errorMode
visible: recipientInputLoader.ready && (amountToSend.ready || d.isCollectiblesTransfer) && !d.errorMode && !d.routerError
onNextButtonClicked: popup.sendTransaction()
}

View File

@ -95,6 +95,7 @@ Item {
onTokenBalanceChanged: maxAdvancedValue = model.tokenBalance.amount
property var toNetworks: model.toNetworks
property int routeOnNetwork: 0
readonly property bool hasGas: model.hasGas
onToNetworksChanged: d.draw()
primaryText: model.chainName
@ -236,7 +237,7 @@ Item {
fromN.routeOnNetwork += 1
toN.routeOnNetwork += 1
toN.bentLine = toN.objectName !== fromN.objectName
let routeColor = root.errorMode ? Theme.palette.dangerColor1 : toN.preferred ? '#627EEA' : Theme.palette.pinColor1
let routeColor = root.errorMode || !fromN.hasGas ? Theme.palette.dangerColor1 : toN.preferred ? '#627EEA' : Theme.palette.pinColor1
StatusQUtils.Utils.drawArrow(ctx, fromN.x + fromN.width,
fromN.y + fromN.cardIconPosition + yOffsetFrom,
toNetworksLayout.x + toN.x,