Commit 432d17bd authored by Noah Zinsmeister's avatar Noah Zinsmeister

only show buttons if nft is owned

parent 9743b211
...@@ -31,6 +31,7 @@ import ReactGA from 'react-ga' ...@@ -31,6 +31,7 @@ import ReactGA from 'react-ga'
import { TransactionResponse } from '@ethersproject/providers' import { TransactionResponse } from '@ethersproject/providers'
import { Dots } from 'components/swap/styleds' import { Dots } from 'components/swap/styleds'
import { getPriceOrderingFromPositionForUI } from '../../components/PositionListItem' import { getPriceOrderingFromPositionForUI } from '../../components/PositionListItem'
import { useSingleCallResult } from 'state/multicall/hooks'
const PageWrapper = styled.div` const PageWrapper = styled.div`
min-width: 800px; min-width: 800px;
...@@ -233,6 +234,9 @@ export function PositionPage({ ...@@ -233,6 +234,9 @@ export function PositionPage({
}) })
}, [chainId, feeValue0, feeValue1, positionManager, account, tokenId, addTransaction, library]) }, [chainId, feeValue0, feeValue1, positionManager, account, tokenId, addTransaction, library])
const owner = useSingleCallResult(!!tokenId ? positionManager : null, 'ownerOf', [tokenId]).result?.[0]
const ownsNFT = owner === account || positionDetails?.operator === account
return loading || poolState === PoolState.LOADING || !feeAmount ? ( return loading || poolState === PoolState.LOADING || !feeAmount ? (
<LoadingRows> <LoadingRows>
<div /> <div />
...@@ -262,6 +266,8 @@ export function PositionPage({ ...@@ -262,6 +266,8 @@ export function PositionPage({
<BadgeText>{basisPointsToPercent(feeAmount / 100).toSignificant()}%</BadgeText> <BadgeText>{basisPointsToPercent(feeAmount / 100).toSignificant()}%</BadgeText>
</Badge> </Badge>
</RowFixed> </RowFixed>
{ownsNFT && (
<RowFixed> <RowFixed>
{feeValue0?.greaterThan(0) || feeValue1?.greaterThan(0) || !!collectMigrationHash ? ( {feeValue0?.greaterThan(0) || feeValue1?.greaterThan(0) || !!collectMigrationHash ? (
<ButtonConfirmed <ButtonConfirmed
...@@ -297,6 +303,7 @@ export function PositionPage({ ...@@ -297,6 +303,7 @@ export function PositionPage({
</Link> </Link>
)} )}
</RowFixed> </RowFixed>
)}
</RowBetween> </RowBetween>
<RowBetween> <RowBetween>
<BadgeWrapper> <BadgeWrapper>
......
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