@fairmint/canton-node-sdk
Version:
Canton Node SDK
40 lines • 1.5 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.GetEventsByContractId = exports.EventsByContractIdParamsSchema = void 0;
const zod_1 = require("zod");
const core_1 = require("../../../../../core");
const endpoint = '/v2/events/events-by-contract-id';
exports.EventsByContractIdParamsSchema = zod_1.z.object({
contractId: zod_1.z.string(),
readAs: zod_1.z.array(zod_1.z.string()).optional(),
});
/**
* Retrieves events for a specific contract ID with filtering options
*
* @example
* ```typescript
* const events = await client.getEventsByContractId({
* contractId: 'contract-123',
* readAs: ['party1', 'party2']
* });
* ```;
*/
exports.GetEventsByContractId = (0, core_1.createApiOperation)({
paramsSchema: exports.EventsByContractIdParamsSchema,
method: 'POST',
buildUrl: (_params, apiUrl) => `${apiUrl}${endpoint}`,
buildRequestData: (params, client) => {
const readParties = [...new Set([client.getPartyId(), ...(params.readAs ?? [])])];
return {
contractId: params.contractId,
eventFormat: {
verbose: true,
filtersByParty: Object.fromEntries(readParties.map((party) => [
party,
{ cumulative: [{ identifierFilter: { WildcardFilter: { value: { includeCreatedEventBlob: true } } } }] },
])),
},
};
},
});
//# sourceMappingURL=get-events-by-contract-id.js.map