Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
W3stside committed Dec 9, 2021
1 parent d0df6b5 commit d6f834e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/custom/hooks/usePriceImpact/useFallbackPriceImpact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,15 @@ export default function useFallbackPriceImpact({ abTrade, fiatPriceImpact, isWra
const [error, setError] = useState<QuoteError | undefined>()

// primitive values to use as dependencies
const fiatImpact = fiatPriceImpact?.quotient.toString()
const abIn = abTrade?.inputAmountWithoutFee.quotient.toString()
const abOut = abTrade?.outputAmountWithoutFee?.quotient.toString()
const baOut = baTrade?.outputAmountWithoutFee?.quotient.toString()
const quoteError = quote?.error

useEffect(() => {
// we have no fiat price impact and there's a trade, we need to use ABA impact
if (!fiatPriceImpact && quoteError) {
if (!fiatImpact && quoteError) {
setImpact(undefined)
setError(quoteError)
} else if (!loading && abIn && abOut && baOut) {
Expand All @@ -100,7 +101,7 @@ export default function useFallbackPriceImpact({ abTrade, fiatPriceImpact, isWra
setImpact(undefined)
setError(undefined)
}
}, [abIn, abOut, baOut, quoteError, loading, typedValue])
}, [abIn, abOut, baOut, quoteError, fiatImpact, loading, typedValue])

return { impact, error, loading }
}

0 comments on commit d6f834e

Please sign in to comment.