Commit 8996ba6e authored by Jeffrey Lin's avatar Jeffrey Lin Committed by GitHub

fix: toggle liquidity position when toggling rates (#2117)

If field A and field B are already populated, chances are the user wants
them to remain the same and only wants to invert the price range
selector.

The conversion isn't exact, but should be preferable to the previous
behavior.
parent c8570e54
...@@ -606,6 +606,7 @@ export default function AddLiquidity({ ...@@ -606,6 +606,7 @@ export default function AddLiquidity({
handleRateToggle={() => { handleRateToggle={() => {
onLeftRangeInput((invertPrice ? priceLower : priceUpper?.invert())?.toSignificant(6) ?? '') onLeftRangeInput((invertPrice ? priceLower : priceUpper?.invert())?.toSignificant(6) ?? '')
onRightRangeInput((invertPrice ? priceUpper : priceLower?.invert())?.toSignificant(6) ?? '') onRightRangeInput((invertPrice ? priceUpper : priceLower?.invert())?.toSignificant(6) ?? '')
onFieldAInput(formattedAmounts[Field.CURRENCY_B] ?? '')
history.push( history.push(
`/add/${currencyIdB as string}/${currencyIdA as string}${feeAmount ? '/' + feeAmount : ''}` `/add/${currencyIdB as string}/${currencyIdA as string}${feeAmount ? '/' + feeAmount : ''}`
) )
......
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