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
| Method | Behavior |
|---|---|
addCommand / addCommands | Append ledger Command payloads. |
addDisclosedContracts | Append disclosures (deduped at submit time). |
addBuiltCommand | Combine command plus optional disclosures atomically. |
clear | Reset queues. |
submitAndWaitForTransactionTree | Returns { updateId } derived from transactionTree.updateId. |
submitAndWait | Blocking completion variant returning response.updateId. |
asyncSubmit | Fire-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.