Skip to content

Commit

Permalink
Fix bug where price errors are shown alongside valid quote
Browse files Browse the repository at this point in the history
  • Loading branch information
pedromcunha committed Oct 24, 2024
1 parent ab1f996 commit 4d8c184
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/ui/src/components/widgets/SwapWidgetRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ const SwapWidgetRenderer: FC<SwapWidgetRendererProps> = ({
)

//Here we fetch the price data and quote data in parallel and then merge into one data model
const error = quoteError ?? priceError
const error = _quoteData ? null : quoteError ?? priceError
const price = _quoteData ?? _priceData

useDisconnected(address, () => {
Expand Down Expand Up @@ -506,9 +506,10 @@ const SwapWidgetRenderer: FC<SwapWidgetRendererProps> = ({
const isInsufficientLiquidityError = fetchQuoteErrorMessage?.includes(
'No quotes available'
)
const isCapacityExceededError = fetchQuoteDataErrorMessage?.includes(
'Amount is higher than the available liquidity'
)
const isCapacityExceededError =
fetchQuoteDataErrorMessage?.includes(
'Amount is higher than the available liquidity'
) || fetchQuoteDataErrorMessage?.includes('Insufficient relayer liquidity')
const isCouldNotExecuteError =
fetchQuoteDataErrorMessage?.includes('Could not execute')
const highRelayerServiceFee = isHighRelayerServiceFeeUsd(price)
Expand Down

0 comments on commit 4d8c184

Please sign in to comment.