Skip to content

Commit

Permalink
fix: proper error copy for not enough native asset trades (#8367)
Browse files Browse the repository at this point in the history
Co-authored-by: woody <[email protected]>
  • Loading branch information
NeOMakinG and woodenfurniture authored Dec 16, 2024
1 parent c4d2cae commit 6da93df
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/assets/translations/en/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"noResultsFound": "No results found.",
"noResultsBody": "There were no results for %{searchQuery}. Try a new search.",
"insufficientFunds": "Insufficient Funds",
"insufficientFundsForTrade": "Insufficient funds for trade",
"insufficientAllowance": "Insufficient Allowance",
"estimatedGas": "Estimated Gas Fee",
"relayerGasFee": "Relayer Gas Fee",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const getQuoteErrorTranslation = (
case SwapperTradeQuoteError.SellAmountBelowTradeFee:
return 'trade.errors.sellAmountDoesNotCoverFee'
case TradeQuoteValidationError.InsufficientFirstHopAssetBalance:
return 'common.insufficientFundsForTrade'
case TradeQuoteValidationError.InsufficientFirstHopFeeAssetBalance:
return 'common.insufficientAmountForGas'
case TradeQuoteValidationError.InsufficientSecondHopFeeAssetBalance:
Expand Down
5 changes: 4 additions & 1 deletion src/state/apis/swapper/helpers/validateTradeQuote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,10 @@ export const validateTradeQuote = (
},
walletId &&
!firstHopHasSufficientBalanceForGas && {
error: TradeQuoteValidationError.InsufficientFirstHopFeeAssetBalance,
error:
firstHopSellFeeAsset?.assetId === firstHop.sellAsset.assetId
? TradeQuoteValidationError.InsufficientFirstHopAssetBalance
: TradeQuoteValidationError.InsufficientFirstHopFeeAssetBalance,
meta: {
assetSymbol: firstHopSellFeeAsset?.symbol,
chainSymbol: firstHopSellFeeAsset
Expand Down

0 comments on commit 6da93df

Please sign in to comment.