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'
import { TransactionResponse } from '@ethersproject/providers'
import { Dots } from 'components/swap/styleds'
import { getPriceOrderingFromPositionForUI } from '../../components/PositionListItem'
import { useSingleCallResult } from 'state/multicall/hooks'
const PageWrapper = styled.div`
min-width: 800px;
......@@ -233,6 +234,9 @@ export function PositionPage({
})
}, [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 ? (
<LoadingRows>
<div />
......@@ -262,6 +266,8 @@ export function PositionPage({
<BadgeText>{basisPointsToPercent(feeAmount / 100).toSignificant()}%</BadgeText>
</Badge>
</RowFixed>
{ownsNFT && (
<RowFixed>
{feeValue0?.greaterThan(0) || feeValue1?.greaterThan(0) || !!collectMigrationHash ? (
<ButtonConfirmed
......@@ -297,6 +303,7 @@ export function PositionPage({
</Link>
)}
</RowFixed>
)}
</RowBetween>
<RowBetween>
<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