This is a minimal example of how to token-gate a Next.js page using Lit Protocol using getServerSideProps.
This token gates a /protected page checking to see if the user has a Devs for Revolution ERC721 token.
To run this example:
- Clone the repo and install dependencies
git clone git@github.com:dabit3/nextjs-lit-token-gating.git
cd nextjs-lit-token-gating
npm install- Update the
accessControlConditionswith the contract address of the NFT you'd like to use:
const accessControlConditions = [
{
contractAddress: '0x25ed58c027921E14D86380eA2646E3a1B5C55A8b',
standardContractType: 'ERC721',
chain: 'ethereum',
method: 'balanceOf',
parameters: [
':userAddress'
],
returnValueTest: {
comparator: '>',
value: '0'
}
}
]- Start the app
npm run dev