UNPKG

@fairmint/canton-node-sdk

Version:
238 lines 9.72 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EventsByContractIdResponseSchema = exports.ArchivedEventSchema = exports.CreatedEventSchema = exports.EventsByContractIdRequestSchema = exports.EventFormatSchema = exports.TreeEventSchema = exports.ArchivedTreeEventSchema = exports.ExercisedTreeEventSchema = exports.CreatedTreeEventSchema = void 0; const zod_1 = require("zod"); const base_1 = require("../base"); exports.CreatedTreeEventSchema = zod_1.z .object({ /** * The created event details for a contract node in the transaction tree. */ CreatedTreeEvent: zod_1.z .object({ value: zod_1.z .object({ /** Offset of the event in the ledger stream. */ offset: zod_1.z.number(), /** Node ID of the event in the transaction tree. */ nodeId: zod_1.z.number(), /** Contract ID of the created contract. */ contractId: zod_1.z.string(), /** Template ID of the created contract. */ templateId: zod_1.z.string(), /** Contract key, if present. */ contractKey: zod_1.z.string().nullable(), /** Arguments used to create the contract. */ createArgument: base_1.RecordSchema, /** Serialized event blob for the created contract. */ createdEventBlob: zod_1.z.string(), /** List of interface view names implemented by the contract. */ interfaceViews: zod_1.z.array(zod_1.z.string()), /** Parties that witnessed the creation. */ witnessParties: zod_1.z.array(zod_1.z.string()), /** Parties that must sign the contract. */ signatories: zod_1.z.array(zod_1.z.string()), /** Parties that observe the contract. */ observers: zod_1.z.array(zod_1.z.string()), /** ISO 8601 timestamp when the contract was created. */ createdAt: zod_1.z.string(), /** Name of the Daml package containing the template. */ packageName: zod_1.z.string(), /** List of interface IDs implemented by the contract. */ implementedInterfaces: zod_1.z.array(zod_1.z.string()).optional(), }) .strict(), }) .strict(), }) .strict(); exports.ExercisedTreeEventSchema = zod_1.z .object({ /** * The exercised event details for a contract node in the transaction tree. */ ExercisedTreeEvent: zod_1.z .object({ value: zod_1.z .object({ /** Offset of the event in the ledger stream. */ offset: zod_1.z.number(), /** Node ID of the event in the transaction tree. */ nodeId: zod_1.z.number(), /** Contract ID of the exercised contract. */ contractId: zod_1.z.string(), /** Template ID of the exercised contract. */ templateId: zod_1.z.string(), /** Interface ID if the choice was exercised via an interface. */ interfaceId: zod_1.z.string().nullable(), /** Name of the exercised choice. */ choice: zod_1.z.string(), /** Arguments passed to the exercised choice. */ choiceArgument: base_1.RecordSchema, /** Parties acting in the exercise. */ actingParties: zod_1.z.array(zod_1.z.string()), /** Parties that witnessed the exercise. */ witnessParties: zod_1.z.array(zod_1.z.string()), /** Result returned by the exercised choice. */ exerciseResult: base_1.RecordSchema, /** Name of the Daml package containing the template. */ packageName: zod_1.z.string(), /** Whether the exercise archived the contract. */ consuming: zod_1.z.boolean(), /** Node ID of the last descendant in the subtree, if present. */ lastDescendantNodeId: zod_1.z.number().optional(), /** List of interface IDs implemented by the contract. */ implementedInterfaces: zod_1.z.array(zod_1.z.string()).optional(), }) .strict(), }) .strict(), }) .strict(); exports.ArchivedTreeEventSchema = zod_1.z .object({ /** * The archived event details for a contract node in the transaction tree. */ ArchivedTreeEvent: zod_1.z .object({ value: zod_1.z .object({ /** Offset of the event in the ledger stream. */ offset: zod_1.z.number(), /** Node ID of the event in the transaction tree. */ nodeId: zod_1.z.number(), /** Contract ID of the archived contract. */ contractId: zod_1.z.string(), /** Template ID of the archived contract. */ templateId: zod_1.z.string(), /** Parties that witnessed the archival. */ witnessParties: zod_1.z.array(zod_1.z.string()), /** Name of the Daml package containing the template. */ packageName: zod_1.z.string(), /** List of interface IDs implemented by the contract. */ implementedInterfaces: zod_1.z.array(zod_1.z.string()).optional(), }) .strict(), }) .strict(), }) .strict(); exports.TreeEventSchema = zod_1.z.union([ exports.CreatedTreeEventSchema, exports.ExercisedTreeEventSchema, exports.ArchivedTreeEventSchema, ]); exports.EventFormatSchema = zod_1.z .object({ /** * If true, include all available fields in the event. If false, include only essential fields. */ verbose: zod_1.z.boolean(), /** * Map of party IDs to their event filters. Each key is a party, and the value specifies which events to include for that party. */ filtersByParty: zod_1.z.record(zod_1.z.string(), zod_1.z .object({ /** * List of template or interface filters for this party. */ cumulative: zod_1.z.array(zod_1.z.string()), }) .strict()), /** * If true, include the createdEventBlob field in created events. */ includeCreatedEventBlob: zod_1.z.boolean().optional(), /** * If true, include interface views in created events. */ includeInterfaceViews: zod_1.z.boolean().optional(), }) .strict(); exports.EventsByContractIdRequestSchema = zod_1.z .object({ /** The contract ID to query events for. */ contractId: zod_1.z.string(), /** Format options for the returned events. */ eventFormat: exports.EventFormatSchema, }) .strict(); exports.CreatedEventSchema = zod_1.z .object({ /** * The created event details for a contract. */ createdEvent: zod_1.z .object({ /** Offset of the event in the ledger stream. */ offset: zod_1.z.number(), /** Node ID of the event in the transaction tree. */ nodeId: zod_1.z.number(), /** Contract ID of the created contract. */ contractId: zod_1.z.string(), /** Template ID of the created contract. */ templateId: zod_1.z.string(), /** Contract key, if present. */ contractKey: zod_1.z.string().nullable(), /** Arguments used to create the contract. */ createArgument: base_1.RecordSchema, /** Serialized event blob for the created contract. */ createdEventBlob: zod_1.z.string(), /** List of interface view names implemented by the contract. */ interfaceViews: zod_1.z.array(zod_1.z.string()), /** Parties that witnessed the creation. */ witnessParties: zod_1.z.array(zod_1.z.string()), /** Parties that must sign the contract. */ signatories: zod_1.z.array(zod_1.z.string()), /** Parties that observe the contract. */ observers: zod_1.z.array(zod_1.z.string()), /** ISO 8601 timestamp when the contract was created. */ createdAt: zod_1.z.string(), /** Name of the Daml package containing the template. */ packageName: zod_1.z.string(), }) .strict(), /** Synchronizer ID for the event. */ synchronizerId: zod_1.z.string(), }) .strict(); exports.ArchivedEventSchema = zod_1.z .object({ /** * The archived event details for a contract. */ archivedEvent: zod_1.z .object({ /** Offset of the event in the ledger stream. */ offset: zod_1.z.number(), /** Node ID of the event in the transaction tree. */ nodeId: zod_1.z.number(), /** Contract ID of the archived contract. */ contractId: zod_1.z.string(), /** Template ID of the archived contract. */ templateId: zod_1.z.string(), /** Parties that witnessed the archival. */ witnessParties: zod_1.z.array(zod_1.z.string()), /** Name of the Daml package containing the template. */ packageName: zod_1.z.string(), /** List of interface IDs implemented by the contract. */ implementedInterfaces: zod_1.z.array(zod_1.z.string()), }) .strict(), /** Synchronizer ID for the event. */ synchronizerId: zod_1.z.string(), }) .strict(); exports.EventsByContractIdResponseSchema = zod_1.z .object({ /** Created event, if the contract is active. */ created: exports.CreatedEventSchema.optional(), /** Archived event, if the contract is archived. */ archived: exports.ArchivedEventSchema.optional(), }) .strict() .refine(data => data.created || data.archived, { message: 'EventsByContractIdResponse must have at least one of: created, archived', }); //# sourceMappingURL=events.js.map