UNPKG

@fairmint/canton-node-sdk

Version:
49 lines 2.05 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GetUpdateById = void 0; const zod_1 = require("zod"); const core_1 = require("../../../../../core"); const endpoint = '/v2/updates/update-by-id'; exports.GetUpdateById = (0, core_1.createApiOperation)({ paramsSchema: zod_1.z.object({ updateId: zod_1.z.string().min(1, 'updateId must be a non-empty string'), readAs: zod_1.z.array(zod_1.z.string()), }), method: 'POST', buildUrl: (_params, apiUrl) => `${apiUrl}${endpoint}`, buildRequestData: (params) => { // Validate updateId parameter if (params.updateId === 'undefined' || params.updateId.trim() === '') { throw new Error(`Invalid updateId: "${params.updateId}". updateId must be a non-empty string.`); } // Build the request body according to the API specification return { updateId: params.updateId, updateFormat: { includeTransactions: { eventFormat: { verbose: true, filtersByParty: Object.fromEntries(params.readAs.map((party) => [ party, { cumulative: [ { identifierFilter: { WildcardFilter: { value: { includeCreatedEventBlob: true, }, }, }, }, ], }, ])), }, transactionShape: 'TRANSACTION_SHAPE_LEDGER_EFFECTS', }, }, }; }, }); //# sourceMappingURL=get-update-by-id.js.map