For the complete documentation index, see /llms.txt. A single-fetch full bundle is at /llms-full.txt. Every docs page is also available as Markdown by appending .md to its URL, or by requesting it with Accept: text/markdown.

ERC8004Provider

Root context provider that holds infrastructure config — your Graph API key and optional subgraph URL overrides. Wrap your app once at the top level. Automatically creates an internal QueryClient if TanStack Query is not already set up in your app.

Usage

import { ERC8004Provider } from "@p4n/erc8004-ui"
import { ERC8004Provider } from "@p4n/erc8004-ui"

// Minimal setup — no TanStack Query knowledge required:
function App() {
  return (
    <ERC8004Provider apiKey="your-graph-api-key">
      {/* your app */}
    </ERC8004Provider>
  )
}

// If you already use TanStack Query, ERC8004Provider detects it
// and shares the existing cache — no duplicate clients:
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"

const queryClient = new QueryClient()

function App() {
  return (
    <QueryClientProvider client={queryClient}>
      <ERC8004Provider apiKey="your-graph-api-key">
        {/* your app */}
      </ERC8004Provider>
    </QueryClientProvider>
  )
}

API Reference

apiKeyrequired
type: string

Your Graph API key. Used to authenticate Subgraph requests. Safe to use in frontend code — read-only.

subgraphOverridesoptional
type: Record<number, string>

Optional map of chainId → custom Subgraph URL. Overrides the default endpoint for that chain.

classNameoptional
type: string

Optional CSS classes merged onto the .erc8004 wrapper. Use for scoping dark mode (.dark) or custom layout.

childrenrequired
type: ReactNode

Your application tree.