diff --git a/src/__swaps__/screens/Swap/hooks/useSwapInputsController.ts b/src/__swaps__/screens/Swap/hooks/useSwapInputsController.ts index 997ba1dcb83..2628d0ed1d1 100644 --- a/src/__swaps__/screens/Swap/hooks/useSwapInputsController.ts +++ b/src/__swaps__/screens/Swap/hooks/useSwapInputsController.ts @@ -460,7 +460,7 @@ export function useSwapInputsController({ ); const outputNativeValue = !data.buyAmountMinusFees || !assetToBuyPrice.value - ? 0 + ? '0' : convertRawAmountToNativeDisplay( data.buyAmountMinusFees.toString(), assetToBuy.value.decimals || 18, @@ -478,7 +478,7 @@ export function useSwapInputsController({ ); const inputNativeValue = !data.sellAmount || !assetToSellPrice.value - ? 0 + ? '0' : convertRawAmountToNativeDisplay( data.sellAmount.toString(), assetToSell.value.decimals || 18, diff --git a/src/__swaps__/screens/Swap/hooks/useSwapWarning.ts b/src/__swaps__/screens/Swap/hooks/useSwapWarning.ts index a4b4dedb421..3ec3d8a4ef6 100644 --- a/src/__swaps__/screens/Swap/hooks/useSwapWarning.ts +++ b/src/__swaps__/screens/Swap/hooks/useSwapWarning.ts @@ -118,22 +118,22 @@ export const useSwapWarning = ({ SwapInputController, isFetching, sliderXPositio break; } } - } else if (!isFetching && !(quote as QuoteError)?.error && (!inputNativeValue || !outputNativeValue)) { + } else if (!isFetching && !!quote && !(quote as QuoteError)?.error && (!inputNativeValue || !outputNativeValue)) { runOnUI(updateWarning)({ type: SwapWarningType.unknown, display: i18n.t(i18n.l.exchange.price_impact.unknown_price.title), }); - } else if (!isFetching && greaterThanOrEqualTo(impact, severePriceImpactThreshold)) { + } else if (!isFetching && !!quote && greaterThanOrEqualTo(impact, severePriceImpactThreshold)) { runOnUI(updateWarning)({ type: SwapWarningType.severe, display, }); - } else if (!isFetching && greaterThanOrEqualTo(impact, highPriceImpactThreshold)) { + } else if (!isFetching && !!quote && greaterThanOrEqualTo(impact, highPriceImpactThreshold)) { runOnUI(updateWarning)({ type: SwapWarningType.high, display, }); - } else if (!(quote as QuoteError)?.error) { + } else if (!!quote && !(quote as QuoteError)?.error) { const serviceTime = getQuoteServiceTime({ quote: quote as CrosschainQuote, }); @@ -194,7 +194,7 @@ export const useSwapWarning = ({ SwapInputController, isFetching, sliderXPositio } if ( - previous?.quote !== current.quote || + (current.quote && previous?.quote !== current.quote) || previous?.inputNativeValue !== current.inputNativeValue || previous?.outputNativeValue !== current.outputNativeValue ) {