Skip to content

Reference

TransactionBatch

Fluent helper coalescing commands, disclosed contracts, and submission variants on LedgerJsonApiClient.

Maintains commands / disclosedContracts queues, dedupes disclosures by contractId before submission, exposes submitAndWaitForTransactionTree, submitAndWait, asyncSubmit.

Constructor captures client, actAs, optional readAs forwarded verbatim.

Setup

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

const canton = new Canton({
  network: 'NETWORK_NAME',
  partyId: 'PARTY_ID',
});

Minimal example

const batch = new TransactionBatch(canton.ledger, ['PARTY_ID']);

const result = await batch.addCommand(EXERCISE_COMMAND_PLACEHOLDER).submitAndWaitForTransactionTree();

console.log(result.updateId);

Methods

MethodBehavior
addCommand / addCommandsAppend ledger Command payloads.
addDisclosedContractsAppend disclosures (deduped at submit time).
addBuiltCommandCombine command plus optional disclosures atomically.
clearReset queues.
submitAndWaitForTransactionTreeReturns { updateId } derived from transactionTree.updateId.
submitAndWaitBlocking completion variant returning response.updateId.
asyncSubmitFire-and-forget asyncSubmit.

Errors

Propagates ledger submission failures unchanged.

Auth and party

Uses actAs parties configured during construction — align with Canton partyId + multi-party workflows manually.

Source

src/utils/transactions/TransactionBatch.ts