@fairmint/canton-node-sdk
Version:
Canton Node SDK
35 lines • 1.46 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.GetUpdateById = void 0;
const core_1 = require("../../../../../core");
const zod_1 = require("zod");
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 || 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,
},
transactionShape: 'TRANSACTION_SHAPE_UNSPECIFIED',
},
},
// Include requestingParties if readAs is provided
...(params.readAs && params.readAs.length > 0 && { requestingParties: params.readAs }),
};
},
});
//# sourceMappingURL=get-update-by-id.js.map