Commit ecdbb4a4 authored by Justin Domingue's avatar Justin Domingue Committed by GitHub

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

This reverts commit 307a995a.
parent 536a5d99
...@@ -158,16 +158,10 @@ export function useDerivedMintInfo( ...@@ -158,16 +158,10 @@ 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) {
try { return pair.getLiquidityMinted(totalSupply, tokenAmountA, tokenAmountB)
return pair.getLiquidityMinted(totalSupply, tokenAmountA, tokenAmountB) } else {
} catch (error) { return undefined
if (error.isInsufficientInputAmountError) {
return CurrencyAmount.fromRawAmount(pair.liquidityToken, ZERO)
}
return undefined
}
} }
return undefined
}, [parsedAmounts, pair, totalSupply]) }, [parsedAmounts, pair, totalSupply])
const poolTokenPercentage = useMemo(() => { const poolTokenPercentage = useMemo(() => {
...@@ -201,10 +195,6 @@ export function useDerivedMintInfo( ...@@ -201,10 +195,6 @@ export function useDerivedMintInfo(
error = 'Insufficient ' + currencies[Field.CURRENCY_B]?.symbol + ' balance' error = 'Insufficient ' + currencies[Field.CURRENCY_B]?.symbol + ' balance'
} }
if (!liquidityMinted?.greaterThan(ZERO)) {
error = `Insufficient input amount`
}
return { return {
dependentField, dependentField,
currencies, currencies,
......
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