Skip to content

Getting started

HardlyDifficult edited this page Jul 17, 2026 · 3 revisions

Getting started

The unified Canton client shares one runtime and configuration across Ledger JSON, Validator, and Scan APIs.

import { Canton } from '@fairmint/canton-node-sdk';

const canton = new Canton({ network: 'localnet' });
const version = await canton.ledger.getVersion();
const health = await canton.checkHealth();

Use canton.ledger for Ledger JSON operations, canton.validator for authenticated Validator operations, and canton.scan for public Scan reads. Applications that discover or switch their acting party at runtime can use getPartyId() and setPartyId().

Hosted networks use explicit configuration or the conventional CANTON_* variables. Exact requirements depend on the network and provider; inspect src/core/config and the CantonConfig type before provisioning credentials. Never commit secrets.

When only one API is needed, construct CantonRuntime and that client directly. The maintained localnet-with-oauth2 example shows the pattern.

The package currently publishes CommonJS output from build/src/index.js; use the package root and do not deep-import generated files.

Clone this wiki locally