Skip to content

Canton Node SDK

Examples

Curated runnable examples for @fairmint/canton-node-sdk — full list lives in GitHub and the wiki.

Runnable scripts live in examples/ in the canton-node-sdk repo. The wiki keeps the same inventory: Examples (wiki).

Prerequisites

  • cn-quickstart with OAuth2 — clone cn-quickstart, run make setup (choose OAuth2), then make start.
  • From the SDK repo: npm install.

Scripts (short)

ScriptCommandWhat it shows
Unified clientnpx tsx examples/canton-quickstart.tsCanton → ledger / validator / scan
OAuth2 localnpx tsx examples/localnet-with-oauth2.tsToken flow against LocalNet
Create partynpx tsx examples/create-party.ts [name] [amount]Party + funding
Transfernpx tsx examples/transfer-amulets.ts <receiver> [amount]Amulet transfer offer
External signingnpx tsx examples/external-signing.tsPrepare / sign / execute
Scan + trafficnpx tsx examples/scan-traffic-status.tsScan reads + traffic

One-liner pattern

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

const canton = new Canton({ network: 'localnet' });
await canton.ledger.getVersion();
await canton.validator.getWalletBalance();
await canton.scan.getHealthStatus();

More detail