UNPKG

@fairmint/canton-node-sdk

Version:
70 lines 3.32 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GenerateExternalPartyTopology = exports.GenerateExternalPartyTopologyParamsSchema = void 0; const zod_1 = require("zod"); const core_1 = require("../../../../../../core"); // Schema for signing public key const SigningPublicKeySchema = zod_1.z.object({ format: zod_1.z.string(), keyData: zod_1.z.string(), keySpec: zod_1.z.string(), }); // Schema for the parameters exports.GenerateExternalPartyTopologyParamsSchema = zod_1.z.object({ /** Synchronizer ID on which to onboard the party */ synchronizer: zod_1.z.string(), /** Party ID hint - actual party ID will be constructed from this hint and a fingerprint of the public key */ partyHint: zod_1.z.string(), /** Public key in base64 format */ publicKey: SigningPublicKeySchema, /** If true, then the local participant will only be observing, not confirming. Default false. */ localParticipantObservationOnly: zod_1.z.boolean().default(false).optional(), /** Other participant ids which should be confirming for this party */ otherConfirmingParticipantUids: zod_1.z.array(zod_1.z.string()).optional(), /** Confirmation threshold >= 1 for the party. Defaults to all available confirmers (or if set to 0). */ confirmationThreshold: zod_1.z.number().int().default(0).optional(), /** Other observing participant ids for this party */ observingParticipantUids: zod_1.z.array(zod_1.z.string()).optional(), }); /** * Generate a topology for an external party * * This endpoint generates the topology transactions and multi-hash needed to onboard an external party. The multi-hash * should be signed using the external party's private key and then submitted to the allocate endpoint along with the * generated topology transactions. * * @example * ```typescript * const result = await client.generateExternalPartyTopology({ * synchronizer: 'global-synchronizer', * partyHint: 'alice', * publicKey: { * format: 'CRYPTO_KEY_FORMAT_DER_X509_SUBJECT_PUBLIC_KEY_INFO', * keyData: 'base64-encoded-public-key', * keySpec: 'SIGNING_KEY_SPEC_EC_CURVE25519' * } * }); * // result.multiHash - sign this with the external party's private key * // result.topologyTransactions - pass these to allocate endpoint * // result.partyId - the generated party ID * ```; */ exports.GenerateExternalPartyTopology = (0, core_1.createApiOperation)({ paramsSchema: exports.GenerateExternalPartyTopologyParamsSchema, method: 'POST', buildUrl: (_params, apiUrl) => `${apiUrl}/v2/parties/external/generate-topology`, buildRequestData: (params, _client) => ({ synchronizer: params.synchronizer, partyHint: params.partyHint, publicKey: params.publicKey, localParticipantObservationOnly: params.localParticipantObservationOnly ?? false, confirmationThreshold: params.confirmationThreshold ?? 0, ...(params.otherConfirmingParticipantUids && { otherConfirmingParticipantUids: params.otherConfirmingParticipantUids, }), ...(params.observingParticipantUids && { observingParticipantUids: params.observingParticipantUids, }), }), }); //# sourceMappingURL=generate-topology.js.map