Skip to main content

NFT Gating

Gate content behind NFT ownership verification using the nft-ownership verifier.

Basic Setup

import { VerifyGate } from '@neus/sdk/widgets';

export function NFTGatedContent() {
  return (
    <VerifyGate
      requiredVerifiers={['nft-ownership']}
      verifierData={{
        'nft-ownership': {
          contractAddress: '0x...',
          tokenId: '1',
          chainId: 8453,
        },
      }}
      appId="my-nft-gate"
    >
      <div>Exclusive content for NFT holders</div>
    </VerifyGate>
  );
}

Server-side Check

const result = await client.gateCheck({
  address: '0x...',
  verifierIds: ['nft-ownership'],
  contractAddress: '0x...',
  tokenId: '1',
  chainId: 8453,
});

if (result.data?.eligible) {
  // Grant access
}

Freshness Requirements

NFT ownership is a point-in-time check. Always enforce recency for high-stakes actions.
const result = await client.gateCheck({
  address: '0x...',
  verifierIds: ['nft-ownership'],
  contractAddress: '0x...',
  tokenId: '1',
  chainId: 8453,
  since: Date.now() - 60 * 60 * 1000, // Last hour
});

Multiple NFTs

<VerifyGate
  requiredVerifiers={['nft-ownership']}
  verifierData={{
    'nft-ownership': [
      { contractAddress: '0x...', tokenId: '1', chainId: 8453 },
      { contractAddress: '0x...', tokenId: '2', chainId: 8453 },
    ],
  }}
>
  <div>Content for holders of any listed NFT</div>
</VerifyGate>