Socket
Book a DemoInstallSign in
Socket

@zkp2p/indexer-schema

Package Overview
Dependencies
Maintainers
3
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zkp2p/indexer-schema

ZKP2P Indexer GraphQL schema

latest
npmnpm
Version
0.1.4
Version published
Maintainers
3
Created
Source

@zkp2p/indexer-schema

Exports the GraphQL schema used by the ZKP2P indexer.

Install

pnpm add @zkp2p/indexer-schema

Usage

// Load the SDL string (GraphQL schema) in Node
import { schemaSDL } from '@zkp2p/indexer-schema';
// or CommonJS: const { schemaSDL } = require('@zkp2p/indexer-schema');

// Path reference for codegen configs
schema: node_modules/@zkp2p/indexer-schema/dist/schema.graphql

Notes

  • Includes: Deposit, Intent, DepositPaymentMethod, MethodCurrency.
  • The file is generated at publish time from the indexer repo.

Backend Codegen Example (using domain.graphql)

This is a minimal example to generate TypeScript types from the exported domain schema.

1) Install codegen tooling

pnpm add -D @graphql-codegen/cli @graphql-codegen/typescript @graphql-codegen/typescript-operations

2) Add a codegen config (codegen.yml)

schema: node_modules/@zkp2p/indexer-schema/dist/schema.graphql
# Alternatively, if using a workspace dependency:
# schema: ../zkp2p-indexer/dist/schema.graphql

generates:
  src/__generated__/types.ts:
    plugins:
      - typescript
      - typescript-operations
    config:
      avoidOptionals: true

3) Add an npm script

"scripts": {
  "codegen": "graphql-codegen --config codegen.yml"
}

4) Use the generated types

  • Import Deposit, Intent, etc. operation and type definitions from src/__generated__/types.ts.
  • If you serve GraphQL in the backend, you can build an executable schema from domain.graphql and provide resolvers that read from the indexer’s DB.
  • If you serve REST, use the generated types to type DTOs and service responses.

Notes

  • We export the schema needed by backend consumers (no raw event entities). It matches the data model our handlers populate.
  • When the schema changes in a breaking way (e.g., a field becomes non‑null), bump the schema package version and update your backend accordingly.

FAQs

Package last updated on 24 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts