Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/dabit3/nextjs-lit-token-gating
- Owner: dabit3
- Created: 2022-05-01T23:03:39.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-05-02T20:20:54.000Z (over 2 years ago)
- Last Synced: 2024-08-04T14:12:25.192Z (4 months ago)
- Language: JavaScript
- Size: 81.1 KB
- Stars: 38
- Watchers: 4
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- Awesome-NextJs - nextjs-lit-token-gating
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.gitcd 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
```