API Operations

Utility Functions

The Canton Node SDK provides a comprehensive set of utility functions to simplify common blockchain operations.

Categories

Overview

This documentation covers all utility functions available in the SDK, organized by category:

Quick Examples

Creating a Party

import { CantonRuntime, LedgerJsonApiClient, ValidatorApiClient, createParty } from '@fairmint/canton-node-sdk';

// Initialize one shared runtime, then derive clients from it
const runtime = new CantonRuntime({ network: 'localnet' });
const ledgerClient = new LedgerJsonApiClient(runtime);
const validatorClient = new ValidatorApiClient(runtime);

const result = await createParty({
  ledgerClient,
  validatorClient,
  partyName: 'Alice',
  amount: '100.0',
});

console.log(`Party created with ID: ${result.partyId}`);

Creating Transfer Offers

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

const offerId = await createTransferOffer({
  ledgerClient,
  receiverPartyId: 'Bob::1221',
  amount: '50.0',
  description: 'Payment for services',
});

Parsing Fees

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

const feeAnalysis = parseFeesFromEventTree(eventTree);
console.log(`Total fees: ${feeAnalysis.totalFees}`);

Generated from https://github.com/Fairmint/canton-node-sdk v0.0.1