@fairmint/canton-node-sdk
Version:
Canton Node SDK
50 lines • 2.63 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SubmitAndWaitForTransactionTree = exports.SubmitAndWaitForTransactionTreeParamsSchema = void 0;
const zod_1 = require("zod");
const core_1 = require("../../../../../core");
const commands_1 = require("../../../schemas/api/commands");
const endpoint = '/v2/commands/submit-and-wait-for-transaction-tree';
// Zod schema for the input parameters
exports.SubmitAndWaitForTransactionTreeParamsSchema = zod_1.z.object({
/** Commands to submit and wait for transaction tree. */
commands: zod_1.z.array(commands_1.CommandSchema),
/** Unique identifier for the command (optional, will be auto-generated if not provided). */
commandId: zod_1.z.string().optional(),
/** Parties on whose behalf the command should be executed (optional, will use client's party ID if not provided). */
actAs: zod_1.z.array(zod_1.z.string()).optional(),
/** User ID submitting the command (optional if using authentication). */
userId: zod_1.z.string().optional(),
/** Parties to read as (optional). */
readAs: zod_1.z.array(zod_1.z.string()).optional(),
/** Workflow ID (optional). */
workflowId: zod_1.z.string().optional(),
/** Deduplication period (optional). */
deduplicationPeriod: zod_1.z.any().optional(),
/** Minimum ledger time absolute (optional). */
minLedgerTimeAbs: zod_1.z.string().optional(),
/** Minimum ledger time relative (optional). */
minLedgerTimeRel: zod_1.z.any().optional(),
/** Submission ID (optional). */
submissionId: zod_1.z.string().optional(),
/** Disclosed contracts (optional). */
disclosedContracts: zod_1.z.array(zod_1.z.any()).optional(),
/** Synchronizer ID (optional). */
synchronizerId: zod_1.z.string().optional(),
/** Package ID selection preference (optional). */
packageIdSelectionPreference: zod_1.z.array(zod_1.z.string()).optional(),
/** Prefetch contract keys (optional). */
prefetchContractKeys: zod_1.z.array(zod_1.z.any()).optional(),
});
exports.SubmitAndWaitForTransactionTree = (0, core_1.createApiOperation)({
paramsSchema: exports.SubmitAndWaitForTransactionTreeParamsSchema,
method: 'POST',
buildUrl: (_params, apiUrl) => `${apiUrl}${endpoint}`,
buildRequestData: (params, client) => ({
...params,
commandId: params.commandId ??
`submit-and-wait-for-transaction-tree-${Date.now()}-${Math.random().toString(36).substring(2, 8)}`,
actAs: params.actAs ?? [client.getPartyId()],
}),
});
//# sourceMappingURL=submit-and-wait-for-transaction-tree.js.map