Core
Configuration
DeIdProvider

DeIdProvider

The <DeIdProvider /> core provider takes in parameters that allows you to manage role domains, NFT projects, profile modal options that will be used within de[id].

DeIdProvider is actually made out of two seperate React context providers, DeIdContextProvider and DeIdModalProvider.

DeIdContextProvider is the main provider that handles all the logic and state reagarding profiles and authentication. DeIdModalProvider is a context that is used to access the state and helper functions to manipulate the profile modal.

Props

projects

Provide an array of projects. These projects will be used during sign in to filter out the holdings that the user has in the specified projects. These will be stored in the context and can be accessed.

import { DeIdProvider } from "@dustlabs/profiles/core";
import { DeIdEvm } from "@dustlabs/profiles/evm";
import { ProjectMetadata } from "@dustlabs/profiles/types";
 
const DEGODS_CONTRACT = "0x8821BeE2ba0dF28761AffF119D66390D594CD280";
const Y00TS_CONTRACT = "0x670fd103b1a08628e9557cD66B87DeD841115190";
const BTC_DEGODS_CONTRACT = "BTC DeGods";
 
const PROJECTS: ProjectMetadata[] = [
  {
    id: "degods",
    label: "DeGods",
    contracts: [DEGODS_CONTRACT],
  },
  {
    id: "y00ts",
    label: "y00ts",
    contracts: [Y00TS_CONTRACT],
  },
  {
    id: "btc-degods",
    label: "BTC DeGods",
    contracts: [BTC_DEGODS_CONTRACT],
  }
];
 
function App() {
  return (
    <DeIdEvm api="https://your.de.id.backend.endpoint">
      {(providerProps) => (
        <DeIdProvider {...providerProps} projects={PROJECTS}>
          {/** ... */} 
        </DeIdProvider>
      )}
    </DeIdEvm>
  )
}

domains (optional)

Provide an array of domains (get this value from the backend) that will be used during sign in to determine if the user has any roles in the specified domain. These roles are reflected in the returned JWT token upon sign in.

import { DeIdProvider } from "@dustlabs/profiles/core";
import { DeIdEvm } from "@dustlabs/profiles/evm";
 
const domains = ["content"]
 
function App() {
  return (
    <DeIdEvm api="https://your.de.id.backend.endpoint">
      {(providerProps) => (
        <DeIdProvider {...providerProps} domains={domains}>
            {/** ... */} 
        </DeIdProvider>
      )}
    </DeIdEvm>
  )
}