Last active
January 16, 2023 13:14
-
-
Save irffanasiff/d32532f28a80bb5cf9facf0878309dc5 to your computer and use it in GitHub Desktop.
Civic Next JS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
GatewayProvider, | |
GatewayStatus, | |
useGateway, | |
} from '@civic/solana-gateway-react'; | |
import { WalletAdapterNetwork } from '@solana/wallet-adapter-base'; | |
import { useWallet } from '@solana/wallet-adapter-react'; | |
import * as web3 from '@solana/web3.js'; | |
const VerifyCivicAccount = () => { | |
const { requestGatewayToken, gatewayStatus, gatewayToken, civicPassSrcUrl } = | |
useGateway(); | |
const connection = new web3.Connection( | |
web3.clusterApiUrl(WalletAdapterNetwork.Devnet) | |
); | |
const wallet = useWallet(); | |
const gatekeeperNetworkKey = new web3.PublicKey( | |
process.env.NEXT_PUBLIC_GATEKEEPER_NETWORK_KEY as string | |
); | |
return ( | |
<> | |
<Text color="#C5C5C5" fontSize={{ base: 'xs', md: 'sm' }}> | |
Gateway Status - {GatewayStatus[gatewayStatus]} | |
</Text> | |
<Text color="#C5C5C5" fontSize={{ base: 'xs', md: 'sm' }}> | |
Pass - {gatekeeperNetworkKey.toBase58()} | |
</Text> | |
<GatewayProvider | |
// connection={connection} v0.11.1 | |
clusterUrl={'https://api.testnet.solana.com'} // v0.10.0 | |
wallet={wallet} | |
cluster={WalletAdapterNetwork.Devnet} | |
gatekeeperNetwork={gatekeeperNetworkKey} | |
> | |
<button type="submit" onClick={requestGatewayToken}> | |
Request Pass | |
</button> | |
</GatewayProvider> | |
</> | |
)} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
_app.js
is wrapped in<WalletConnectionProvider>