Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dabit3/nextjs-lit-token-gating

Minimal example of token gating with Next.js and Lit Protocol
https://github.com/dabit3/nextjs-lit-token-gating

Last synced: about 1 month ago
JSON representation

Minimal example of token gating with Next.js and Lit Protocol

Awesome Lists containing this project

README

        

This is a minimal example of how to token-gate a Next.js page using [Lit Protocol](https://developer.litprotocol.com/) using `getServerSideProps`.

This token gates a `/protected` page checking to see if the user has a [Devs for Revolution](https://etherscan.io/address/0x25ed58c027921e14d86380ea2646e3a1b5c55a8b) ERC721 token.

To run this example:

1. Clone the repo and install dependencies

```sh
git clone [email protected]:dabit3/nextjs-lit-token-gating.git

cd nextjs-lit-token-gating

npm install
```

2. Update the `accessControlConditions` with the contract address of the NFT you'd like to use:

```javascript
const accessControlConditions = [
{
contractAddress: '0x25ed58c027921E14D86380eA2646E3a1B5C55A8b',
standardContractType: 'ERC721',
chain: 'ethereum',
method: 'balanceOf',
parameters: [
':userAddress'
],
returnValueTest: {
comparator: '>',
value: '0'
}
}
]
```

3. Start the app

```sh
npm run dev
```