@sigilry/canton-json-api
@sigilry/canton-json-api provides TypeScript types and Zod schemas generated from the pinned Canton JSON Ledger API v2 OpenAPI spec. Use it to type and validate the bodies that flow through the CIP-103 ledgerApi method.
Install
Section titled “Install”yarn add @sigilry/canton-json-api@^1This package has its own 1.x version line. Wallet connectivity uses @sigilry/dapp@^3 and, for React, @sigilry/react@^3.
Parse a ledger response
Section titled “Parse a ledger response”Schemas are named z<OperationOrType>. int64 fields, such as ledger offsets, are modeled as bigint after parsing.
import { zGetLedgerEndResponse } from "@sigilry/canton-json-api";
const parsed = zGetLedgerEndResponse.parse({ offset: "42" });const offset: bigint = parsed.offset;console.log(offset);With React, pass a schema’s parse to useLedgerApi to get typed results. For a full holdings query through the wallet, see Read Holdings.
Source of truth
Section titled “Source of truth”The package is generated from a checked-in OpenAPI snapshot (packages/canton-json-api/api-specs/openapi.yaml) pinned to a specific Canton release. CI runs codegen:check and fails when the generated files drift from that snapshot.