revert: "fix: handle insufficient input amount error in v2 add liquidity (#1652)" (#1665)

This reverts commit 307a995a50c0ec39c9d4f43937081c67e5e33505.
This commit is contained in:
Justin Domingue 2021-05-20 11:08:07 -07:00 committed by GitHub
parent 536a5d99de
commit ecdbb4a49f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -158,16 +158,10 @@ export function useDerivedMintInfo(
const { [Field.CURRENCY_A]: currencyAAmount, [Field.CURRENCY_B]: currencyBAmount } = parsedAmounts
const [tokenAmountA, tokenAmountB] = [currencyAAmount?.wrapped, currencyBAmount?.wrapped]
if (pair && totalSupply && tokenAmountA && tokenAmountB) {
try {
return pair.getLiquidityMinted(totalSupply, tokenAmountA, tokenAmountB)
} catch (error) {
if (error.isInsufficientInputAmountError) {
return CurrencyAmount.fromRawAmount(pair.liquidityToken, ZERO)
}
return undefined
}
return pair.getLiquidityMinted(totalSupply, tokenAmountA, tokenAmountB)
} else {
return undefined
}
return undefined
}, [parsedAmounts, pair, totalSupply])
const poolTokenPercentage = useMemo(() => {
@ -201,10 +195,6 @@ export function useDerivedMintInfo(
error = 'Insufficient ' + currencies[Field.CURRENCY_B]?.symbol + ' balance'
}
if (!liquidityMinted?.greaterThan(ZERO)) {
error = `Insufficient input amount`
}
return {
dependentField,
currencies,