Installation & Setup
@ethpass/sdk
Features
- Pass Generator - Generate mobile passes for IRL events. Gated by NFTs or Policies.
- Gated Component - Gate any content in few lines of code
- Hook - React hook for gating content
Getting Started
Installation
Inside your React project directory, run the following:
yarn add @ethpass/sdk
Or with npm:
npm install @ethpass/sdk
Setup
SDKProvider
is a crucial component that enables the initialization and configuration of the SDK within your application. By wrapping your application's root component with SDKProvider
, you ensure that SDK functionalities are available throughout your component tree.
Props
SDKProvider
accepts the following props:
Name | Type | Description |
---|---|---|
apiKey | string | Required. Your SDK API key. |
loadingIndicator | { size?: number; color?: string; component?: React.ReactElement | null; } | Optional. Configuration for a custom loading indicator to be displayed during various loading states |
Usage
- Wrap your application with
SDKProvider
:
To use the SDK in your React application, wrap your root component with SDKProvider
, providing the required public api key and any optional props you wish to configure.
import React from 'react';
import ReactDOM from 'react-dom';
import { SDKProvider } from '@ethpass/sdk';
import App from './App';
const rootElement = document.getElementById('root');
ReactDOM.render(
<SDKProvider apiKey="pk_123">
<App />
</SDKProvider>,
rootElement
);
Updated 6 months ago