Skip to content

Instantly share code, notes, and snippets.

@irffanasiff
Last active January 16, 2023 13:14
Show Gist options
  • Save irffanasiff/d32532f28a80bb5cf9facf0878309dc5 to your computer and use it in GitHub Desktop.
Save irffanasiff/d32532f28a80bb5cf9facf0878309dc5 to your computer and use it in GitHub Desktop.
Civic Next JS
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>
</>
)}
@irffanasiff
Copy link
Author

_app.js is wrapped in <WalletConnectionProvider>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment