Commit 9353c783 authored by Justin Domingue's avatar Justin Domingue Committed by GitHub

fix: catch errors from Pair.getLiquidityMinted (#1668)

parent 816249b4
import { useCallback, useMemo } from 'react' import { useCallback, useMemo, useRef } from 'react'
import { useDispatch, useSelector } from 'react-redux' import { useDispatch, useSelector } from 'react-redux'
import { AppDispatch, AppState } from '../index' import { AppDispatch, AppState } from '../index'
import { Field, typeInput } from './actions' import { Field, typeInput } from './actions'
...@@ -158,7 +158,12 @@ export function useDerivedMintInfo( ...@@ -158,7 +158,12 @@ export function useDerivedMintInfo(
const { [Field.CURRENCY_A]: currencyAAmount, [Field.CURRENCY_B]: currencyBAmount } = parsedAmounts const { [Field.CURRENCY_A]: currencyAAmount, [Field.CURRENCY_B]: currencyBAmount } = parsedAmounts
const [tokenAmountA, tokenAmountB] = [currencyAAmount?.wrapped, currencyBAmount?.wrapped] const [tokenAmountA, tokenAmountB] = [currencyAAmount?.wrapped, currencyBAmount?.wrapped]
if (pair && totalSupply && tokenAmountA && tokenAmountB) { if (pair && totalSupply && tokenAmountA && tokenAmountB) {
return pair.getLiquidityMinted(totalSupply, tokenAmountA, tokenAmountB) try {
return pair.getLiquidityMinted(totalSupply, tokenAmountA, tokenAmountB)
} catch (error) {
console.error(error)
return undefined
}
} else { } else {
return undefined return undefined
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment