1.0.19 • Published 1 year ago

token-gate-web3 v1.0.19

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

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

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago