fix: min/max price inverted in positions page (#2002)

* fix param ordering in inverter hook

* use object param
This commit is contained in:
Justin Domingue 2021-07-08 14:06:24 -07:00 committed by GitHub
parent 440c50dd3a
commit 318252b6a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -285,13 +285,19 @@ function NFT({ image, height: targetHeight }: { image: string; height: number })
)
}
const useInverter = (
priceLower?: Price<Token, Token>,
priceUpper?: Price<Token, Token>,
quote?: Token,
base?: Token,
const useInverter = ({
priceLower,
priceUpper,
quote,
base,
invert,
}: {
priceLower?: Price<Token, Token>
priceUpper?: Price<Token, Token>
quote?: Token
base?: Token
invert?: boolean
): {
}): {
priceLower?: Price<Token, Token>
priceUpper?: Price<Token, Token>
quote?: Token
@ -354,13 +360,13 @@ export function PositionPage({
const [manuallyInverted, setManuallyInverted] = useState(false)
// handle manual inversion
const { priceLower, priceUpper, base } = useInverter(
pricesFromPosition.priceUpper,
pricesFromPosition.priceLower,
pricesFromPosition.quote,
pricesFromPosition.base,
manuallyInverted
)
const { priceLower, priceUpper, base } = useInverter({
priceLower: pricesFromPosition.priceLower,
priceUpper: pricesFromPosition.priceUpper,
quote: pricesFromPosition.quote,
base: pricesFromPosition.base,
invert: manuallyInverted,
})
const inverted = token1 ? base?.equals(token1) : undefined
const currencyQuote = inverted ? currency0 : currency1