1.0.19 • Published 3 years ago
token-gate-web3 v1.0.19
React hooks for token gating content via a NFT collection or Farcaster. Requires a Alchemy API key for NFT gating, and a Application bearer token for authenticating a farcaster user. In addition, an existing SIWE implementation is needed.
I recommend using Wagmi or Privy to get an address.
Installation
npm:
npm install token-gate-web3
yarn:
yarn add token-gate-web3
Example
import logo from './logo.svg';
import './App.css';
import{useNFTAuth,useFarcasterAuth } from 'token-gate-web3/lib/esm'
function App() {
const [holder,error] = useNFTAuth({alchemyApiKey:'your-key',wallet: 'user-wallet', contractAddress: 'contract-address'})
const [FCToken,FCError] = useFarcasterAuth({wallet: 'wallet-address', bearerToken:"bearer-token"})
return (
<div className="App">
{holder ? <p>You are a holder</p> :<p>you are not a holder</p>}
{FCToken ? <p>You are a Farcaster user</p> :<p>you are not a farcaster User</p>}
{FCError && <p>Farcaster Error:{FCError.message}</p>}
{error && <p>NFT Error:{error.message}</p>}
</div>
);
}
export default App;
Contributing
For fixes or contributions, please open a issue.
License
This project is licensed under the terms of the MIT license.
1.0.19
3 years ago
1.0.18
3 years ago
1.0.17
3 years ago
1.0.16
3 years ago
1.0.15
3 years ago
1.0.14
3 years ago
1.0.13
3 years ago
1.0.12
3 years ago
1.0.11
3 years ago
1.0.10
3 years ago
1.0.9
3 years ago
1.0.8
3 years ago
1.0.7
3 years ago
1.0.5
3 years ago
1.0.4
3 years ago
1.0.3
3 years ago
1.0.2
3 years ago
1.0.1
3 years ago
1.0.0
3 years ago