@polygonlabs/staking-api-schemas
v1.0.0
Published
Zod request/response schemas, OpenAPI registry, and committed spec for the Polygon Staking API
Keywords
Readme
@polygonlabs/staking-api-schemas
Zod request/response schemas, the OpenAPI registry, and the committed
openapi.json spec for the Polygon Staking API — the single source of truth
for the API surface, published so consumers can validate responses against
the exact constraints the server enforces.
Why this package exists
The Staking API serves Polygon PoS staking data (validators, delegators,
rewards, checkpoints) under /api/v2 and /api/v3. Its server routes and
validates every request against an OpenAPI registry composed from these Zod
schemas, openapi.json is generated from that same registry, and
@polygonlabs/staking-api-client
is generated from that spec — so server, spec, and client cannot silently
drift apart.
Publishing the schemas extends that guarantee to consumers: anything you
validate with these exports is checked by the actual runtime schemas the
backend executes — codecs, refinements, and constraints included — not types
re-derived from a lossy OpenAPI round-trip. If you just want a typed client,
use @polygonlabs/staking-api-client, which wires this up for you.
Install
pnpm add @polygonlabs/staking-api-schemasEntry points
@polygonlabs/staking-api-schemas— every registered schema, exported under its OpenAPI registered name (e.g.ValidatorResponse,DelegatorsListResponseV3).@polygonlabs/staking-api-schemas/registry—buildRegistry(), the typed OpenAPI registry composing every route registration.@polygonlabs/staking-api-schemas/openapi.json— the committed OpenAPI 3.0 document (also served live at/openapi.jsonby the API).
