@fairmint/canton-node-sdk
Version:
Canton Node SDK
54 lines • 1.84 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AllocateParty = exports.AllocatePartyParamsSchema = void 0;
const zod_1 = require("zod");
const core_1 = require("../../../../../core");
// Schema for the parameters
exports.AllocatePartyParamsSchema = zod_1.z.object({
/** Party ID hint (required) */
partyIdHint: zod_1.z.string(),
/** Identity provider ID (required) */
identityProviderId: zod_1.z.string(),
/** Synchronizer ID (required) */
synchronizerId: zod_1.z.string(),
/** User ID (required) */
userId: zod_1.z.string(),
/** Local metadata (optional) */
localMetadata: zod_1.z
.object({
resourceVersion: zod_1.z.string().optional(),
annotations: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
})
.optional(),
});
/**
* Allocate a new party to the participant node
*
* @example
* ```typescript
* const result = await client.allocateParty({
* partyIdHint: 'alice',
* identityProviderId: 'default',
* synchronizerId: 'global-synchronizer',
* userId: 'user-123'
* });
* ```;
*/
exports.AllocateParty = (0, core_1.createApiOperation)({
paramsSchema: exports.AllocatePartyParamsSchema,
method: 'POST',
buildUrl: (_params, apiUrl) => `${apiUrl}/v2/parties`,
buildRequestData: (params, _client) => ({
partyIdHint: params.partyIdHint,
identityProviderId: params.identityProviderId,
synchronizerId: params.synchronizerId,
userId: params.userId,
...(params.localMetadata && {
localMetadata: {
resourceVersion: params.localMetadata.resourceVersion ?? '',
annotations: params.localMetadata.annotations ?? {},
},
}),
}),
});
//# sourceMappingURL=post.js.map