submitAndWait posts POST /v2/commands/submit-and-wait. When the promise resolves, the participant has processed your atomic batch. Reach for it when you only need acknowledgement and identifiers (updateId, completionOffset), not the full transaction body in the same round-trip.
Receiver: await canton.ledger.submitAndWait
Setup
import { Canton } from '@fairmint/canton-node-sdk';
const canton = new Canton({
network: 'devnet',
provider: '5n',
partyId: 'OWN_PARTY_ID',
});
Minimal example
const result = await canton.ledger.submitAndWait({
commands: [
{
ExerciseCommand: {
templateId: '#pkg:Mod:T',
contractId: 'CID',
choice: 'Archive',
choiceArgument: {},
},
},
],
});
console.log(result.updateId, result.completionOffset);
If commandId or actAs are omitted, the SDK fills them in (submit-and-wait-<timestamp>-…, [canton.getPartyId()]).
Parameters — SubmitAndWaitParams
commands(required,CompositeCommand[]) — Tagged union commands executed atomically.commandId(optional, string) — Idempotent retries should pin a stable value.actAs(optional, string[]) — Defaults to [client party].userId(optional, string) — Ledger user submitting when auth allows multiple users.readAs(optional, string[]) — Additional visibility for contract resolution.workflowId(optional, string) — Correlates downstream ledger outputs.deduplicationPeriod(optional) — BoundscommandIddeduplication.minLedgerTimeAbs/minLedgerTimeRel(optional) — Minimum ledger time constraints.submissionId(optional, string) — Echoed on completions for correlation with streams.disclosedContracts(optional) — Contracts disclosed when templates resolve outsideactAs/readAsvisibility.synchronizerId(optional, string) — Target synchronizer override.packageIdSelectionPreference(optional, string[]) — Preferred package version ordering.prefetchContractKeys(optional) — Resolver hints for keyed contracts.
Returns — SubmitAndWaitResponse
OpenAPI-generated. Typical fields:
updateId(string) — Canonical transaction id; correlate withgetTransactionById,getUpdateById, etc.completionOffset(string) — Cursor compatible withsubscribeToUpdates.
Additional keys may exist depending on Canton version.
Errors and pitfalls
- Failed interpretation or authorization rejects the batch (
ApiError). - Duplicate
commandIdinside dedup window yields prior outcome semantics per participant policy. - Forgetting
disclosedContractsfor invisible-but-required contracts surfaces resolution failures.
Auth and party
OAuth token bound to Canton. Token user must have act-as for actAs parties and appropriate read-as visibility.