Skip to content

Reference

ledger.getEventsByContractId

Fetch ledger events for one contract id with wildcard filters merged from client parties.

getEventsByContractId posts POST /v2/events/events-by-contract-id. The SDK merges readAs with client.getPartyId() and builds eventFormat with WildcardFilter + includeCreatedEventBlob: true for those parties.

Receiver: await canton.ledger.getEventsByContractId

Setup

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

const canton = new Canton({
  network: 'devnet',
  provider: '5n',
  partyId: 'OWN_PARTY_ID',
});

Minimal example

const events = await canton.ledger.getEventsByContractId({
  contractId: 'CID',
  readAs: ['OTHER_PARTY'],
});

Parameters — EventsByContractIdParams

  • contractId (required, string) — Contract whose timeline you want.
  • readAs (optional, string[]) — Extra parties merged into filtersByParty alongside the client party.

The outbound EventsByContractIdRequest always enables verbose: true inside eventFormat.

Returns — EventsByContractIdResponse

OpenAPI payload describing matching ledger events for that contract under merged visibility.

Errors and pitfalls

Visibility failures occur when neither readAs nor client party can see archived/historical nodes—extend readAs accordingly.

Auth and party

OAuth-backed reads require read-as rights for merged parties.

See also

Source

operations/v2/events/get-events-by-contract-id.ts