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), thenmake start. - From the SDK repo:
npm install.
Scripts (short)
| Script | Command | What it shows |
|---|---|---|
| Unified client | npx tsx examples/canton-quickstart.ts | Canton → ledger / validator / scan |
| OAuth2 local | npx tsx examples/localnet-with-oauth2.ts | Token flow against LocalNet |
| Create party | npx tsx examples/create-party.ts [name] [amount] | Party + funding |
| Transfer | npx tsx examples/transfer-amulets.ts <receiver> [amount] | Amulet transfer offer |
| External signing | npx tsx examples/external-signing.ts | Prepare / sign / execute |
| Scan + traffic | npx tsx examples/scan-traffic-status.ts | Scan 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
- Quickstart — install & config
- Reference — every client / util name
- External signing — user-held keys
- Integration tests — heavier scenarios