waitForCompletionWithMetadata mirrors waitForCompletion: it opens subscribeToCompletions, waits for the submissionId, and resolves with structured metadata instead of a bare string.
When Canton includes paidTrafficCost on the completion value, it is surfaced as bigint on the result (parsed from JSON number or decimal string per the SDK).
Setup
import { Canton, waitForCompletionWithMetadata } from '@fairmint/canton-node-sdk';
const canton = new Canton({
network: 'devnet',
provider: '5n',
partyId: 'OWN_PARTY_ID',
});
Signature: waitForCompletionWithMetadata(ledgerClient: LedgerJsonApiClient, params: WaitForCompletionParams): Promise<WaitForCompletionResult>
Minimal example
const result = await waitForCompletionWithMetadata(canton.ledger, {
submissionId,
partyId: canton.getPartyId(),
userId: canton.getUserId()!,
beginExclusive: checkpointOffset,
});
console.log(result.updateId);
if (result.paidTrafficCost !== undefined) {
console.log('paidTrafficCost', result.paidTrafficCost.toString());
}
Parameters — WaitForCompletionParams
Same as waitForCompletion: submissionId, partyId, userId, beginExclusive, optional timeoutMs.
Returns — WaitForCompletionResult
updateId(string) — Canonical transaction identifier for the submission.paidTrafficCost(optional, bigint) — Present when the Ledger API includespaidTrafficCoston the completion (Canton versions that expose traffic billing metadata).
Errors
Same rejection cases as waitForCompletion: failed completion status, missing updateId, stream error or early close, timeout.
Auth and party
Identical to waitForCompletion.