@layerzerolabs/common-canton 1.2.30 → 1.2.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{KYBLHMHO.js → AH32N3GF.js} +4 -5
- package/dist/AH32N3GF.js.map +1 -0
- package/dist/{I7FWUGTT.js → IA2UQ4WQ.js} +2 -22
- package/dist/IA2UQ4WQ.js.map +1 -0
- package/dist/auth/index.js +1 -1
- package/dist/browser.d.ts +10 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +5 -0
- package/dist/browser.js.map +1 -0
- package/dist/client/grpc.d.ts +0 -1
- package/dist/client/grpc.d.ts.map +1 -1
- package/dist/client/grpc.js +1 -2
- package/dist/client/index.js +1 -2
- package/dist/client/topology/types.d.ts +0 -2
- package/dist/client/topology/types.d.ts.map +1 -1
- package/dist/index.js +3 -4
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +2 -3
- package/package.json +19 -13
- package/src/browser.ts +9 -0
- package/src/client/grpc.ts +0 -16
- package/src/client/topology/types.ts +0 -2
- package/src/provider.ts +0 -1
- package/dist/I7FWUGTT.js.map +0 -1
- package/dist/KYBLHMHO.js.map +0 -1
- package/dist/MIPVIR2V.js +0 -68
- package/dist/MIPVIR2V.js.map +0 -1
- package/dist/client/user-management.d.ts +0 -21
- package/dist/client/user-management.d.ts.map +0 -1
- package/dist/client/user-management.js +0 -4
- package/dist/client/user-management.js.map +0 -1
- package/src/client/user-management.ts +0 -74
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CantonClient } from './WAKNWPCR.js';
|
|
2
2
|
import { Configuration } from './KBNUN3MF.js';
|
|
3
|
-
import { CantonGrpcClient } from './
|
|
3
|
+
import { CantonGrpcClient } from './IA2UQ4WQ.js';
|
|
4
4
|
import { ClientCredentialsTokenProvider } from './V2H2WXKE.js';
|
|
5
5
|
import { LocalTokenProvider } from './SCEF7TLZ.js';
|
|
6
6
|
import { __name } from './VUOMXK5T.js';
|
|
@@ -72,8 +72,7 @@ function createCantonChainProvider({ uri, isLocal }) {
|
|
|
72
72
|
});
|
|
73
73
|
const grpcClient = new CantonGrpcClient({
|
|
74
74
|
host: params.adminApiHost,
|
|
75
|
-
tokenProvider
|
|
76
|
-
userId: params.userId
|
|
75
|
+
tokenProvider
|
|
77
76
|
});
|
|
78
77
|
return {
|
|
79
78
|
client,
|
|
@@ -99,5 +98,5 @@ function createTokenProvider(params, isLocal) {
|
|
|
99
98
|
__name(createTokenProvider, "createTokenProvider");
|
|
100
99
|
|
|
101
100
|
export { createCantonChainProvider, parseCantonChainUri };
|
|
102
|
-
//# sourceMappingURL=
|
|
103
|
-
//# sourceMappingURL=
|
|
101
|
+
//# sourceMappingURL=AH32N3GF.js.map
|
|
102
|
+
//# sourceMappingURL=AH32N3GF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/provider.ts"],"names":["parseCantonChainUri","uri","url","URL","adminApiHost","searchParams","get","Error","userId","actAsParam","actAs","split","map","party","trim","filter","length","walletUrl","tokenUrl","undefined","clientId","clientSecret","process","env","CANTON_CLIENT_SECRET","scope","audience","key","delete","jsonApiUrl","toString","replace","oauth2","createCantonChainProvider","isLocal","params","tokenProvider","createTokenProvider","configuration","Configuration","basePath","accessToken","getToken","client","CantonClient","grpcClient","CantonGrpcClient","host","LocalTokenProvider","admin","ClientCredentialsTokenProvider"],"mappings":";;;;;;;;AA6DO,SAASA,oBAAoBC,GAAAA,EAAW;AAC3C,EAAA,MAAMC,GAAAA,GAAM,IAAIC,GAAAA,CAAIF,GAAAA,CAAAA;AAEpB,EAAA,MAAMG,YAAAA,GAAeF,GAAAA,CAAIG,YAAAA,CAAaC,GAAAA,CAAI,WAAA,CAAA;AAC1C,EAAA,IAAI,CAACF,YAAAA,EAAc;AACf,IAAA,MAAM,IAAIG,MAAM,kEAAA,CAAA;AACpB,EAAA;AAEA,EAAA,MAAMC,MAAAA,GAASN,GAAAA,CAAIG,YAAA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,SAAAA;AAClBmB,IAAAA;GACJ,CAAA;AAGA,EAAA,MAAMS,UAAAA,GAAa,IAAIC,gBAAAA,CAAiB;AACpCC,IAAAA,IAAAA,EAAMZ,MAAAA,CAAO/B,YAAAA;AACbgC,IAAAA;GACJ,CAAA;AAEA,EAAA,OAAO;AACHO,IAAAA,MAAAA;AACAE,IAAAA,UAAAA;AACAT,IAAAA,aAAAA;AACAnB,IAAAA,SAAAA,EAAWkB,MAAAA,CAAOlB;AACtB,GAAA;AACJ;AA9BgBgB,MAAAA,CAAAA,yBAAAA,EAAAA,2BAAAA,CAAAA;AAgChB,SAASI,mBAAAA,CAAoBF,QAA8BD,OAAAA,EAAgB;AACvE,EAAA,IAAIA,OAAAA,EAAS;AACT,IAAA,OAAO,IAAIc,kBAAAA,CAAmB;AAC1BxC,MAAAA,MAAAA,EAAQ2B,MAAAA,CAAO3B,MAAAA;AACfE,MAAAA,KAAAA,EAAOyB,MAAAA,CAAOzB,KAAAA;MACduC,KAAAA,EAAO;KACX,CAAA;AACJ,EAAA;AAGA,EAAA,IAAI,CAACd,OAAOH,MAAAA,EAAQ;AAChB,IAAA,MAAM,IAAIzB,MACN,kHAAA,CAAA;AAER,EAAA;AAEA,EAAA,OAAO,IAAI2C,8BAAAA,CAA+Bf,MAAAA,CAAOH,MAAM,CAAA;AAC3D;AAjBSK,MAAAA,CAAAA,mBAAAA,EAAAA,qBAAAA,CAAAA","file":"AH32N3GF.js","sourcesContent":["import {\n ClientCredentialsTokenProvider,\n type ClientCredentialsTokenProviderConfig,\n} from './auth/client-credentials-token-provider';\nimport { LocalTokenProvider } from './auth/local-token-provider';\nimport type { TokenProvider } from './auth/token-provider';\nimport { CantonClient } from './client/canton-client';\nimport { CantonGrpcClient } from './client/grpc';\nimport type { ICantonClient } from './client/interface';\nimport { Configuration } from './open-api/runtime';\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Provider Type\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * - {@link client} — JSON Ledger API (commands, queries, updates)\n * - {@link grpcClient} — gRPC Admin API (topology transactions, namespace queries)\n * - {@link tokenProvider} — Shared Bearer-token source used by both transports\n * - {@link walletUrl} — Canton Network validator wallet (scan-proxy CIP-56 endpoints)\n */\nexport type CantonChainProvider = {\n client: ICantonClient;\n grpcClient: CantonGrpcClient;\n tokenProvider: TokenProvider;\n /** Validator wallet URL for scan-proxy CIP-56 endpoints. Required. */\n walletUrl: string;\n};\n\n// ─────────────────────────────────────────────────────────────────────────────\n// URI Parsing\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport type CantonChainUriParams = {\n /** Base URL of the JSON Ledger API (e.g. \"http://localhost:5975\") */\n jsonApiUrl: string;\n /** Host:port of the gRPC Admin API (e.g. \"localhost:5076\") */\n adminApiHost: string;\n /** Ledger API user ID (default: \"participant_admin\") */\n userId: string;\n /** Parties granted `actAs` on localnet tokens (comma-separated in the URI). */\n actAs: string[];\n /** Validator wallet URL for scan-proxy CIP-56 endpoints (e.g. \"http://localhost:7201\"). Required. */\n walletUrl: string;\n /** OAuth2 client credentials config — present only for non-local environments */\n oauth2?: ClientCredentialsTokenProviderConfig;\n};\n\n/**\n * Parse a Canton chain provider URI into its constituent parts.\n *\n * URI format:\n * `<json-api-base>?admin-api=<host:port>&user-id=<id>&wallet-url=<url>[&token-url=...&client-id=...&client-secret=...&scope=...&audience=...]`\n *\n * The base URL (everything before the query string) is the JSON Ledger API endpoint.\n * Canton-specific params are extracted and removed; any remaining query params are\n * preserved on the JSON API URL.\n *\n * When `client-secret` is omitted from the URI, `CANTON_CLIENT_SECRET` is read from the\n * environment.\n */\nexport function parseCantonChainUri(uri: string): CantonChainUriParams {\n const url = new URL(uri);\n\n const adminApiHost = url.searchParams.get('admin-api');\n if (!adminApiHost) {\n throw new Error('Canton provider URI missing required \"admin-api\" query parameter');\n }\n\n const userId = url.searchParams.get('user-id') ?? 'participant_admin';\n const actAsParam = url.searchParams.get('act-as');\n const actAs =\n actAsParam\n ?.split(',')\n .map((party) => party.trim())\n .filter((party) => party.length > 0) ?? [];\n const walletUrl = url.searchParams.get('wallet-url');\n if (!walletUrl) {\n throw new Error('Canton provider URI missing required \"wallet-url\" query parameter');\n }\n const tokenUrl = url.searchParams.get('token-url') ?? undefined;\n const clientId = url.searchParams.get('client-id') ?? undefined;\n // Prefer URI param; fall back to env so secrets are not committed in provider configs.\n const clientSecret =\n url.searchParams.get('client-secret') ??\n // eslint-disable-next-line turbo/no-undeclared-env-vars -- runtime OAuth secret, not a turbo task input\n process.env.CANTON_CLIENT_SECRET ??\n undefined;\n const scope = url.searchParams.get('scope') ?? undefined;\n const audience = url.searchParams.get('audience') ?? undefined;\n\n for (const key of [\n 'admin-api',\n 'user-id',\n 'act-as',\n 'wallet-url',\n 'sequencer-url',\n 'sequencer-validators',\n 'sequencer-quorum',\n 'token-url',\n 'client-id',\n 'client-secret',\n 'scope',\n 'audience',\n ]) {\n url.searchParams.delete(key);\n }\n\n const jsonApiUrl = url.toString().replace(/\\/$/, '');\n\n const oauth2 =\n tokenUrl && clientId && clientSecret\n ? { tokenUrl, clientId, clientSecret, scope, audience }\n : undefined;\n\n return {\n jsonApiUrl,\n adminApiHost,\n userId,\n actAs,\n walletUrl,\n oauth2,\n };\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Provider Factory\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport type CreateCantonChainProviderOptions = {\n /** Raw provider URI (from provider config) */\n uri: string;\n /** When true, uses LocalTokenProvider (self-signed JWTs) instead of OAuth2 */\n isLocal: boolean;\n};\n\n/**\n * Create a {@link CantonChainProvider} from a provider URI.\n *\n * - **isLocal=true**: Uses {@link LocalTokenProvider} with admin-level access (self-signed JWTs).\n * - **isLocal=false**: Uses {@link ClientCredentialsTokenProvider} with OAuth2 client\n * credentials extracted from the URI query parameters.\n */\nexport function createCantonChainProvider({\n uri,\n isLocal,\n}: CreateCantonChainProviderOptions): CantonChainProvider {\n const params = parseCantonChainUri(uri);\n\n const tokenProvider = createTokenProvider(params, isLocal);\n\n // ── JSON Ledger API Client ──────────────────────────────────────────\n const configuration = new Configuration({\n basePath: params.jsonApiUrl,\n accessToken: () => tokenProvider.getToken(),\n });\n const client = new CantonClient(configuration, params.userId, {\n walletUrl: params.walletUrl,\n tokenProvider,\n });\n\n // ── gRPC Admin API Client ───────────────────────────────────────────\n const grpcClient = new CantonGrpcClient({\n host: params.adminApiHost,\n tokenProvider,\n });\n\n return {\n client,\n grpcClient,\n tokenProvider,\n walletUrl: params.walletUrl,\n };\n}\n\nfunction createTokenProvider(params: CantonChainUriParams, isLocal: boolean): TokenProvider {\n if (isLocal) {\n return new LocalTokenProvider({\n userId: params.userId,\n actAs: params.actAs,\n admin: true,\n });\n }\n\n // TODO(canton): add other prod auth methods (direct JWT passthrough, etc.).\n if (!params.oauth2) {\n throw new Error(\n 'Canton provider requires OAuth2 credentials (token-url, client-id, client-secret in URI or CANTON_CLIENT_SECRET)',\n );\n }\n\n return new ClientCredentialsTokenProvider(params.oauth2);\n}\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { buildNamespaceDelegationMapping, buildDecentralizedNamespaceDefinitionMapping, buildPartyToKeyMapping, buildPartyToParticipantMapping } from './RVQWP4JU.js';
|
|
2
2
|
import { SynchronizerConnectivityServiceClient } from './VJ4PVZYL.js';
|
|
3
3
|
import { buildChannelCredentials, synchronizerStore, headStateBaseQuery, computeDecentralizedNamespace } from './QAKOQQ7E.js';
|
|
4
|
-
import { UserManagementServiceClient } from './MIPVIR2V.js';
|
|
5
4
|
import { computePublicKeyFingerprint } from './WLV6EHDB.js';
|
|
6
5
|
import { CantonProtocolError, CantonError } from './3K5JL2TP.js';
|
|
7
6
|
import { __name } from './VUOMXK5T.js';
|
|
@@ -20,16 +19,13 @@ var CantonGrpcClient = class {
|
|
|
20
19
|
#topologyRead;
|
|
21
20
|
#topologyWrite;
|
|
22
21
|
#connectivity;
|
|
23
|
-
#userManagement;
|
|
24
22
|
#tokenProvider;
|
|
25
|
-
#userId;
|
|
26
23
|
#synchronizerId;
|
|
27
24
|
/**
|
|
28
25
|
* @param opts - Admin API host, auth, optional synchronizer id, and optional TLS.
|
|
29
26
|
*/
|
|
30
27
|
constructor(opts) {
|
|
31
28
|
this.#tokenProvider = opts.tokenProvider;
|
|
32
|
-
this.#userId = opts.userId;
|
|
33
29
|
this.#synchronizerId = opts.synchronizerId;
|
|
34
30
|
this.#transport = new GrpcTransport({
|
|
35
31
|
host: opts.host,
|
|
@@ -39,7 +35,6 @@ var CantonGrpcClient = class {
|
|
|
39
35
|
this.#topologyRead = new TopologyManagerReadServiceClient(this.#transport);
|
|
40
36
|
this.#topologyWrite = new TopologyManagerWriteServiceClient(this.#transport);
|
|
41
37
|
this.#connectivity = new SynchronizerConnectivityServiceClient(this.#transport);
|
|
42
|
-
this.#userManagement = new UserManagementServiceClient(this.#transport);
|
|
43
38
|
}
|
|
44
39
|
/** Returns per-RPC gRPC metadata with a fresh Bearer token. */
|
|
45
40
|
async #getMeta() {
|
|
@@ -329,21 +324,6 @@ var CantonGrpcClient = class {
|
|
|
329
324
|
meta: await this.#getMeta()
|
|
330
325
|
});
|
|
331
326
|
}
|
|
332
|
-
async grantCanActAs(partyId) {
|
|
333
|
-
await this.#userManagement.grantUserRights({
|
|
334
|
-
userId: this.#userId,
|
|
335
|
-
rights: [
|
|
336
|
-
{
|
|
337
|
-
canActAs: {
|
|
338
|
-
party: partyId
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
],
|
|
342
|
-
identityProviderId: ""
|
|
343
|
-
}, {
|
|
344
|
-
meta: await this.#getMeta()
|
|
345
|
-
});
|
|
346
|
-
}
|
|
347
327
|
/** Closes the underlying gRPC transport. */
|
|
348
328
|
close() {
|
|
349
329
|
this.#transport.close();
|
|
@@ -351,5 +331,5 @@ var CantonGrpcClient = class {
|
|
|
351
331
|
};
|
|
352
332
|
|
|
353
333
|
export { CantonGrpcClient };
|
|
354
|
-
//# sourceMappingURL=
|
|
355
|
-
//# sourceMappingURL=
|
|
334
|
+
//# sourceMappingURL=IA2UQ4WQ.js.map
|
|
335
|
+
//# sourceMappingURL=IA2UQ4WQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/client/grpc.ts"],"names":["DEFAULT_GRPC_CLIENT_OPTIONS","CantonGrpcClient","opts","tokenProvider","synchronizerId","GrpcTransport","host","channelCredentials","buildChannelCredentials","tls","clientOptions","grpcClientOptions","TopologyManagerReadServiceClient","TopologyManagerWriteServiceClient","SynchronizerConnectivityServiceClient","token","getToken","Authorization","response","listConnectedSynchronizers","meta","synchronizer","connectedSynchronizers","CantonProtocolError","mapping","serial","generateTransactions","GenerateTransactionsRequest","create","proposals","GenerateTransactionsRequest_Proposal","operation","Enums_TopologyChangeOp","ADD_REPLACE","store","synchronizerStore","generated","generatedTransactions","getNamespaceDelegation","namespaceFingerprint","listNamespaceDelegation","ListNamespaceDelegationRequest","baseQuery","headStateBaseQuery","filterNamespace","filterTargetKeyFingerprint","results","flatMap","result","item","publicKey","targetKey","namespace","targetKeyFingerprint","computePublicKeyFingerprint","isRootDelegation","context","getDecentralizedNamespaceDefinition","listDecentralizedNamespaceDefinition","ListDecentralizedNamespaceDefinitionRequest","decentralizedNamespace","threshold","owners","getPartyToKeyMapping","partyId","listPartyToKeyMapping","ListPartyToKeyMappingRequest","filterParty","party","signingKeyFingerprints","signingKeys","map","key","getPartyToParticipantMapping","listPartyToParticipant","ListPartyToParticipantRequest","filterParticipant","participants","participant","participantUid","permission","createNamespaceDelegationTx","params","buildNamespaceDelegationMapping","publicKeyDer","createDecentralizedNamespaceDefinitionTx","computeDecentralizedNamespace","buildDecentralizedNamespaceDefinitionMapping","updateDecentralizedNamespaceDefinitionTx","createPartyToKeyTx","buildPartyToKeyMapping","signingPublicKeyDers","createPartyToParticipantTx","buildPartyToParticipantMapping","participantIds","submitTopologyTransactions","transactions","length","CantonError","addTransactions","AddTransactionsRequest","close"],"mappings":";;;;;;;;;AA+C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CAAA,EACA;MAAEgB,IAAAA,EAAM,MAAM,KAAK,QAAA;KAAW,CAAA;AAEtC,EAAA;;EAGAiF,KAAAA,GAAc;AACV,IAAA,IAAA,CAAK,WAAWA,KAAAA,EAAK;AACzB,EAAA;AACJ","file":"IA2UQ4WQ.js","sourcesContent":["import {\n AddTransactionsRequest,\n Enums_TopologyChangeOp,\n GenerateTransactionsRequest,\n GenerateTransactionsRequest_Proposal,\n ListDecentralizedNamespaceDefinitionRequest,\n ListNamespaceDelegationRequest,\n ListPartyToKeyMappingRequest,\n ListPartyToParticipantRequest,\n type SignedTopologyTransaction,\n TopologyManagerReadServiceClient,\n TopologyManagerWriteServiceClient,\n type TopologyMapping,\n} from '@canton-network/core-ledger-proto';\nimport { GrpcTransport } from '@protobuf-ts/grpc-transport';\n\nimport type { TokenProvider } from '../auth/token-provider';\nimport { CantonError, CantonProtocolError } from '../errors';\nimport {\n buildDecentralizedNamespaceDefinitionMapping,\n buildNamespaceDelegationMapping,\n buildPartyToKeyMapping,\n buildPartyToParticipantMapping,\n} from './topology/mappings';\nimport { SynchronizerConnectivityServiceClient } from './topology/synchronizer-connectivity';\nimport type {\n CantonGrpcClientOptions,\n CreateDecentralizedNamespaceDefinitionTxParams,\n CreateNamespaceDelegationTxParams,\n CreatePartyToKeyMappingTxParams,\n CreatePartyToParticipantMappingTxParams,\n DecentralizedNamespaceDefinitionState,\n GeneratedTopologyTransaction,\n NamespaceDelegationState,\n PartyToKeyMappingState,\n PartyToParticipantMappingState,\n UpdateDecentralizedNamespaceDefinitionTxParams,\n} from './topology/types';\nimport {\n buildChannelCredentials,\n computeDecentralizedNamespace,\n headStateBaseQuery,\n synchronizerStore,\n} from './topology/utils';\nimport { computePublicKeyFingerprint } from './utils';\n\n/** Default gRPC client options: 128 MiB message-size limits for large admin responses. */\nconst DEFAULT_GRPC_CLIENT_OPTIONS = {\n 'grpc.max_receive_message_length': 128 * 1024 * 1024,\n 'grpc.max_send_message_length': 128 * 1024 * 1024,\n} as const;\n\n/**\n * gRPC client for the Canton participant admin Topology Manager API.\n *\n * Exposes read queries for topology mappings and write helpers that call\n * `GenerateTransactions` to produce unsigned topology transactions and\n * `AddTransactions` to submit signed ones.\n *\n * A fresh Bearer token is attached to each RPC via {@link TokenProvider}.\n */\nexport class CantonGrpcClient {\n readonly #transport: GrpcTransport;\n readonly #topologyRead: TopologyManagerReadServiceClient;\n readonly #topologyWrite: TopologyManagerWriteServiceClient;\n readonly #connectivity: SynchronizerConnectivityServiceClient;\n readonly #tokenProvider: TokenProvider;\n #synchronizerId?: string;\n\n /**\n * @param opts - Admin API host, auth, optional synchronizer id, and optional TLS.\n */\n constructor(opts: CantonGrpcClientOptions) {\n this.#tokenProvider = opts.tokenProvider;\n this.#synchronizerId = opts.synchronizerId;\n this.#transport = new GrpcTransport({\n host: opts.host,\n channelCredentials: buildChannelCredentials(opts.host, opts.tls),\n clientOptions: opts.grpcClientOptions ?? DEFAULT_GRPC_CLIENT_OPTIONS,\n });\n this.#topologyRead = new TopologyManagerReadServiceClient(this.#transport);\n this.#topologyWrite = new TopologyManagerWriteServiceClient(this.#transport);\n this.#connectivity = new SynchronizerConnectivityServiceClient(this.#transport);\n }\n\n /** Returns per-RPC gRPC metadata with a fresh Bearer token. */\n async #getMeta(): Promise<Record<string, string>> {\n const token = await this.#tokenProvider.getToken();\n return { Authorization: `Bearer ${token}` };\n }\n\n /**\n * Returns the client synchronizer id, discovering it on first use when omitted at construction.\n *\n * @throws {CantonProtocolError} If the participant exposes no synchronizer store.\n */\n async #getSynchronizerId(): Promise<string> {\n if (this.#synchronizerId) {\n return this.#synchronizerId;\n }\n this.#synchronizerId = await this.#discoverSynchronizerId();\n return this.#synchronizerId;\n }\n\n /**\n * Resolves the logical id of the first synchronizer the participant is connected to.\n *\n * @throws {CantonProtocolError} If the participant is not connected to any synchronizer.\n */\n async #discoverSynchronizerId(): Promise<string> {\n const { response } = await this.#connectivity.listConnectedSynchronizers(\n {},\n { meta: await this.#getMeta() },\n );\n for (const synchronizer of response.connectedSynchronizers) {\n if (synchronizer.synchronizerId) {\n return synchronizer.synchronizerId;\n }\n }\n throw new CantonProtocolError('Participant is not connected to any synchronizer');\n }\n\n /**\n * Calls `GenerateTransactions` for a single ADD_REPLACE mapping.\n *\n * @param synchronizerId - Synchronizer store to target.\n * @param mapping - Topology mapping to encode into the transaction.\n * @param serial - Topology serial (`0` lets Canton auto-determine).\n * @returns Unsigned topology transaction (`serializedTransaction`, `transactionHash`).\n * @throws {CantonProtocolError} If the RPC returns no generated transaction.\n */\n async #generateTopologyTransaction(\n synchronizerId: string,\n mapping: TopologyMapping,\n serial: number,\n ): Promise<GeneratedTopologyTransaction> {\n const { response } = await this.#topologyWrite.generateTransactions(\n GenerateTransactionsRequest.create({\n proposals: [\n GenerateTransactionsRequest_Proposal.create({\n operation: Enums_TopologyChangeOp.ADD_REPLACE,\n serial,\n mapping,\n store: synchronizerStore(synchronizerId),\n }),\n ],\n }),\n { meta: await this.#getMeta() },\n );\n\n const generated = response.generatedTransactions[0];\n if (!generated) {\n throw new CantonProtocolError('GenerateTransactions returned no topology transaction');\n }\n return generated;\n }\n\n /**\n * Lists Namespace Delegation (NSD) mappings for a namespace.\n *\n * Queries topology head state on the synchronizer. Returns every result from\n * the list RPC.\n *\n * @param namespaceFingerprint - Namespace to filter on (for root NSD, the owner key fingerprint).\n * @returns All matching NSD mappings, or an empty array if none exist.\n */\n async getNamespaceDelegation(\n namespaceFingerprint: string,\n ): Promise<NamespaceDelegationState[]> {\n const synchronizerId = await this.#getSynchronizerId();\n const { response } = await this.#topologyRead.listNamespaceDelegation(\n ListNamespaceDelegationRequest.create({\n baseQuery: headStateBaseQuery(synchronizerId),\n filterNamespace: namespaceFingerprint,\n // Empty string = no target-key filter; return all delegations for this namespace.\n filterTargetKeyFingerprint: '',\n }),\n { meta: await this.#getMeta() },\n );\n\n return response.results.flatMap((result) => {\n const item = result.item;\n const publicKey = item?.targetKey?.publicKey;\n if (!item || !publicKey) {\n return [];\n }\n return [\n {\n namespace: item.namespace,\n targetKeyFingerprint: computePublicKeyFingerprint(publicKey),\n isRootDelegation: item.isRootDelegation,\n serial: result.context?.serial ?? 0,\n },\n ];\n });\n }\n\n /**\n * Lists Decentralized Namespace Definition (DND) mappings for a namespace.\n *\n * Queries topology head state on the synchronizer. For a party id `hint::1220…`,\n * pass the `1220…` suffix as `namespaceFingerprint`.\n *\n * @param namespaceFingerprint - Decentralized namespace fingerprint to filter on.\n * @returns All matching DND mappings, or an empty array if none exist.\n */\n async getDecentralizedNamespaceDefinition(\n namespaceFingerprint: string,\n ): Promise<DecentralizedNamespaceDefinitionState[]> {\n const synchronizerId = await this.#getSynchronizerId();\n const { response } = await this.#topologyRead.listDecentralizedNamespaceDefinition(\n ListDecentralizedNamespaceDefinitionRequest.create({\n baseQuery: headStateBaseQuery(synchronizerId),\n filterNamespace: namespaceFingerprint,\n }),\n { meta: await this.#getMeta() },\n );\n\n return response.results.flatMap((result) => {\n const item = result.item;\n if (!item) {\n return [];\n }\n return [\n {\n namespace: item.decentralizedNamespace,\n threshold: item.threshold,\n owners: [...item.owners],\n serial: result.context?.serial ?? 0,\n },\n ];\n });\n }\n\n /**\n * Lists Party-to-Key (PTK) mappings for a party.\n *\n * Queries topology head state on the synchronizer.\n *\n * @param partyId - Full party identifier (e.g. `hint::1220…`).\n * @returns All matching PTK mappings, or an empty array if none exist.\n */\n async getPartyToKeyMapping(partyId: string): Promise<PartyToKeyMappingState[]> {\n const synchronizerId = await this.#getSynchronizerId();\n const { response } = await this.#topologyRead.listPartyToKeyMapping(\n ListPartyToKeyMappingRequest.create({\n baseQuery: headStateBaseQuery(synchronizerId),\n filterParty: partyId,\n }),\n { meta: await this.#getMeta() },\n );\n\n return response.results.flatMap((result) => {\n const item = result.item;\n if (!item) {\n return [];\n }\n return [\n {\n party: item.party,\n threshold: item.threshold,\n signingKeyFingerprints: item.signingKeys.map((key) =>\n computePublicKeyFingerprint(key.publicKey),\n ),\n serial: result.context?.serial ?? 0,\n },\n ];\n });\n }\n\n /**\n * Lists Party-to-Participant (PTP) mappings for a party.\n *\n * Queries topology head state on the synchronizer.\n *\n * @param partyId - Full party identifier (e.g. `hint::1220…`).\n * @param proposals - If `true`, query pending proposals instead of authorized mappings.\n * @returns All matching PTP mappings, or an empty array if none exist.\n */\n async getPartyToParticipantMapping(\n partyId: string,\n proposals = false,\n ): Promise<PartyToParticipantMappingState[]> {\n const synchronizerId = await this.#getSynchronizerId();\n const { response } = await this.#topologyRead.listPartyToParticipant(\n ListPartyToParticipantRequest.create({\n baseQuery: headStateBaseQuery(synchronizerId, proposals),\n filterParty: partyId,\n // Empty string = no participant filter; return all hosting mappings for this party.\n filterParticipant: '',\n }),\n { meta: await this.#getMeta() },\n );\n\n return response.results.flatMap((result) => {\n const item = result.item;\n if (!item) {\n return [];\n }\n return [\n {\n party: item.party,\n threshold: item.threshold,\n participants: item.participants.map((participant) => ({\n participantUid: participant.participantUid,\n permission: participant.permission,\n })),\n serial: result.context?.serial ?? 0,\n },\n ];\n });\n }\n\n /**\n * Builds an unsigned Namespace Delegation (NSD) topology transaction.\n *\n * Calls `GenerateTransactions` with an ADD_REPLACE mapping. The returned\n * `transactionHash` must be signed by the namespace key.\n *\n * @param params - Owner public key and optional serial.\n * @returns Unsigned topology transaction (`serializedTransaction`, `transactionHash`).\n */\n async createNamespaceDelegationTx(\n params: CreateNamespaceDelegationTxParams,\n ): Promise<GeneratedTopologyTransaction> {\n const synchronizerId = await this.#getSynchronizerId();\n const mapping = buildNamespaceDelegationMapping(params.publicKeyDer);\n return this.#generateTopologyTransaction(synchronizerId, mapping, params.serial ?? 0);\n }\n\n /**\n * Builds an unsigned Decentralized Namespace Definition (DND) topology transaction.\n *\n * The decentralized namespace id is derived from `params.owners`. All owners\n * must sign the transaction hash.\n *\n * @param params - Owner fingerprints, threshold, and optional serial.\n * @returns Unsigned topology transaction (`serializedTransaction`, `transactionHash`).\n */\n async createDecentralizedNamespaceDefinitionTx(\n params: CreateDecentralizedNamespaceDefinitionTxParams,\n ): Promise<GeneratedTopologyTransaction> {\n const synchronizerId = await this.#getSynchronizerId();\n const decentralizedNamespace = computeDecentralizedNamespace(params.owners);\n const mapping = buildDecentralizedNamespaceDefinitionMapping(\n decentralizedNamespace,\n params.threshold,\n params.owners,\n );\n return this.#generateTopologyTransaction(synchronizerId, mapping, params.serial ?? 0);\n }\n\n async updateDecentralizedNamespaceDefinitionTx(\n params: UpdateDecentralizedNamespaceDefinitionTxParams,\n ): Promise<GeneratedTopologyTransaction> {\n const synchronizerId = await this.#getSynchronizerId();\n const mapping = buildDecentralizedNamespaceDefinitionMapping(\n params.namespace,\n params.threshold,\n params.owners,\n );\n return this.#generateTopologyTransaction(synchronizerId, mapping, params.serial ?? 0);\n }\n\n /**\n * Builds an unsigned Party-to-Key (PTK) topology transaction.\n *\n * Decentralized namespace owners must sign the transaction hash.\n *\n * @param params - Party id, signing keys, threshold, and optional serial.\n * @returns Unsigned topology transaction (`serializedTransaction`, `transactionHash`).\n */\n async createPartyToKeyTx(\n params: CreatePartyToKeyMappingTxParams,\n ): Promise<GeneratedTopologyTransaction> {\n const synchronizerId = await this.#getSynchronizerId();\n const mapping = buildPartyToKeyMapping(\n params.partyId,\n params.signingPublicKeyDers,\n params.threshold,\n );\n return this.#generateTopologyTransaction(synchronizerId, mapping, params.serial ?? 0);\n }\n\n /**\n * Builds an unsigned Party-to-Participant (PTP) topology transaction.\n *\n * Party owners sign the transaction hash. On submit, set `proposal: true` on the\n * signed transaction so the hosting participant can authorize via `Authorize`.\n *\n * @param params - Party id, participant ids, threshold, and optional serial.\n * @returns Unsigned topology transaction (`serializedTransaction`, `transactionHash`).\n */\n async createPartyToParticipantTx(\n params: CreatePartyToParticipantMappingTxParams,\n ): Promise<GeneratedTopologyTransaction> {\n const synchronizerId = await this.#getSynchronizerId();\n const mapping = buildPartyToParticipantMapping(\n params.partyId,\n params.participantIds,\n params.threshold,\n );\n return this.#generateTopologyTransaction(synchronizerId, mapping, params.serial ?? 0);\n }\n\n /**\n * Submits signed topology transactions to the synchronizer store.\n *\n * Multiple transactions are submitted atomically in one `AddTransactions` call.\n * When batching, sign `computeMultiTransactionHash` over all transaction hashes\n * and attach the same `MultiTransactionSignatures` to each entry.\n *\n * Set `proposal: true` on a transaction when the hosting participant must\n * authorize that mapping afterward.\n *\n * @param transactions - One or more signed topology transactions.\n * @throws {CantonError} If `transactions` is empty.\n */\n async submitTopologyTransactions(\n transactions: readonly SignedTopologyTransaction[],\n ): Promise<void> {\n if (transactions.length === 0) {\n throw new CantonError('AddTransactions requires at least one transaction');\n }\n const synchronizerId = await this.#getSynchronizerId();\n await this.#topologyWrite.addTransactions(\n AddTransactionsRequest.create({\n transactions: [...transactions],\n store: synchronizerStore(synchronizerId),\n }),\n { meta: await this.#getMeta() },\n );\n }\n\n /** Closes the underlying gRPC transport. */\n close(): void {\n this.#transport.close();\n }\n}\n"]}
|
package/dist/auth/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '../35ELVFTS.js';
|
|
2
|
+
import '../RSV7WS7X.js';
|
|
2
3
|
export { ClientCredentialsTokenProvider } from '../V2H2WXKE.js';
|
|
3
4
|
export { LocalTokenProvider } from '../SCEF7TLZ.js';
|
|
4
|
-
import '../RSV7WS7X.js';
|
|
5
5
|
import '../VUOMXK5T.js';
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-safe Canton utilities.
|
|
3
|
+
*
|
|
4
|
+
* This entrypoint intentionally excludes the Canton ledger client and its Node-only
|
|
5
|
+
* transport dependencies. It may be used by frontend packages that need the
|
|
6
|
+
* deterministic encoding and signature helpers.
|
|
7
|
+
*/
|
|
8
|
+
export * from './crypto';
|
|
9
|
+
export * from './daml-serde';
|
|
10
|
+
//# sourceMappingURL=browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC"}
|
package/dist/browser.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { SECP256K1_SPKI_DER_HEADER, SECP256K1_SPKI_DER_HEADER_HEX, derEncodeSignature, publicKeyToSpkiDer } from './CMDFOA7C.js';
|
|
2
|
+
export { assertHexLength, codePointLength, formatDamlDecimal, intToHex, keccak256Hex, padLeft, showBool, showInt, textToHex, timeToUnixSeconds, toBigInt } from './EZIA6KIP.js';
|
|
3
|
+
import './VUOMXK5T.js';
|
|
4
|
+
//# sourceMappingURL=browser.js.map
|
|
5
|
+
//# sourceMappingURL=browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"browser.js"}
|
package/dist/client/grpc.d.ts
CHANGED
|
@@ -108,7 +108,6 @@ export declare class CantonGrpcClient {
|
|
|
108
108
|
* @throws {CantonError} If `transactions` is empty.
|
|
109
109
|
*/
|
|
110
110
|
submitTopologyTransactions(transactions: readonly SignedTopologyTransaction[]): Promise<void>;
|
|
111
|
-
grantCanActAs(partyId: string): Promise<void>;
|
|
112
111
|
/** Closes the underlying gRPC transport. */
|
|
113
112
|
close(): void;
|
|
114
113
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grpc.d.ts","sourceRoot":"","sources":["../../src/client/grpc.ts"],"names":[],"mappings":"AAAA,OAAO,EASH,KAAK,yBAAyB,EAIjC,MAAM,mCAAmC,CAAC;AAY3C,OAAO,KAAK,EACR,uBAAuB,EACvB,8CAA8C,EAC9C,iCAAiC,EACjC,+BAA+B,EAC/B,uCAAuC,EACvC,qCAAqC,EACrC,4BAA4B,EAC5B,wBAAwB,EACxB,sBAAsB,EACtB,8BAA8B,EAC9B,8CAA8C,EACjD,MAAM,kBAAkB,CAAC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AQG;IACG,0BAA0B,CAC5B,MAAM,EAAE,uCAAuC,GAChD,OAAO,CAAC,4BAA4B,CAAC;IAUxC;;;;;;;;;;;;OAYG;IACG,0BAA0B,CAC5B,YAAY,EAAE,SAAS,yBAAyB,EAAE,GACnD,OAAO,CAAC,IAAI,CAAC;IAchB,4CAA4C;IAC5C,KAAK,IAAI,IAAI;CAGhB"}
|
package/dist/client/grpc.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
export { CantonGrpcClient } from '../
|
|
1
|
+
export { CantonGrpcClient } from '../IA2UQ4WQ.js';
|
|
2
2
|
import '../RVQWP4JU.js';
|
|
3
3
|
import '../VJ4PVZYL.js';
|
|
4
4
|
import '../QAKOQQ7E.js';
|
|
5
|
-
import '../MIPVIR2V.js';
|
|
6
5
|
import '../WLV6EHDB.js';
|
|
7
6
|
import '../CMDFOA7C.js';
|
|
8
7
|
import '../3K5JL2TP.js';
|
package/dist/client/index.js
CHANGED
|
@@ -287,11 +287,10 @@ import '../5NV4O3K7.js';
|
|
|
287
287
|
import '../XOLOXB7M.js';
|
|
288
288
|
import '../KBNUN3MF.js';
|
|
289
289
|
export { AMULET_INSTRUMENT_ID, fetchAmuletContext, fetchDsoParty, injectExternalPartyAmuletRules } from '../DSYVONFP.js';
|
|
290
|
-
export { CantonGrpcClient } from '../
|
|
290
|
+
export { CantonGrpcClient } from '../IA2UQ4WQ.js';
|
|
291
291
|
import '../RVQWP4JU.js';
|
|
292
292
|
import '../VJ4PVZYL.js';
|
|
293
293
|
export { computeDecentralizedNamespace, computeMultiTransactionHash } from '../QAKOQQ7E.js';
|
|
294
|
-
import '../MIPVIR2V.js';
|
|
295
294
|
export { cantonMultihash, computeCantonFingerprint, computePublicKeyFingerprint, extractTransactions } from '../WLV6EHDB.js';
|
|
296
295
|
import '../CMDFOA7C.js';
|
|
297
296
|
import '../3K5JL2TP.js';
|
|
@@ -106,8 +106,6 @@ export type CantonGrpcClientOptions = {
|
|
|
106
106
|
host: string;
|
|
107
107
|
/** Supplies a fresh Bearer token before each RPC call. */
|
|
108
108
|
tokenProvider: TokenProvider;
|
|
109
|
-
/** Ledger API user ID used for user-management RPCs (e.g. `GrantUserRights`). */
|
|
110
|
-
userId: string;
|
|
111
109
|
/**
|
|
112
110
|
* Logical synchronizer id used as the topology store. When omitted, the first
|
|
113
111
|
* synchronizer the participant is connected to (via `ListConnectedSynchronizers`)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/client/topology/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,2BAA2B,EAChC,KAAK,iDAAiD,EACzD,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,8GAA8G;AAC9G,MAAM,MAAM,4BAA4B,GAAG,iDAAiD,CAAC;AAE7F,iFAAiF;AACjF,MAAM,MAAM,iCAAiC,GAAG;IAC5C,gHAAgH;IAChH,YAAY,EAAE,UAAU,CAAC;IACzB,gEAAgE;IAChE,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,+FAA+F;AAC/F,MAAM,MAAM,8CAA8C,GAAG;IACzD,kFAAkF;IAClF,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,8CAA8C;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,gEAAgE;IAChE,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,8CAA8C,GACtD,8CAA8C,GAAG;IAC7C,SAAS,EAAE,MAAM,CAAC;CACrB,CAAC;AAEN,iFAAiF;AACjF,MAAM,MAAM,+BAA+B,GAAG;IAC1C,0CAA0C;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,uCAAuC;IACvC,oBAAoB,EAAE,UAAU,EAAE,CAAC;IACnC,4CAA4C;IAC5C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MAAM,EAAE,CAAC;IACjC,gDAAgD;IAChD,MAAM,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,+EAA+E;AAC/E,MAAM,MAAM,8BAA8B,GAAG;IACzC,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAC;IAClB,gEAAgE;IAChE,YAAY,EAAE;QAAE,cAAc,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,2BAA2B,CAAA;KAAE,EAAE,CAAC;IACpF,gDAAgD;IAChD,MAAM,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,yDAAyD;AACzD,MAAM,MAAM,UAAU,GAAG;IACrB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yCAAyC;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,2DAA2D;AAC3D,MAAM,MAAM,uBAAuB,GAAG;IAClC,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,aAAa,EAAE,aAAa,CAAC;IAC7B;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,2EAA2E;IAC3E,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB,kDAAkD;IAClD,iBAAiB,CAAC,EAAE,aAAa,CAAC;CACrC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ export { buildMultiTransactionSignatures, buildSignedTransaction } from './WKC6X
|
|
|
10
10
|
import './IIWYAFUO.js';
|
|
11
11
|
export { createContractAddressResolver, isConcreteActiveContractRef, isRefAlive, matchesContractStateFilter, queryLiveContractIdsForRef, queryLiveContractsForRef } from './VAFLUPQJ.js';
|
|
12
12
|
export { parseMinFeeValue } from './M3GPMXME.js';
|
|
13
|
-
export { createCantonChainProvider, parseCantonChainUri } from './
|
|
13
|
+
export { createCantonChainProvider, parseCantonChainUri } from './AH32N3GF.js';
|
|
14
14
|
export { CantonClient } from './WAKNWPCR.js';
|
|
15
15
|
import './MNIG6M5P.js';
|
|
16
16
|
import './6CPYXAOF.js';
|
|
@@ -297,17 +297,16 @@ import './5NV4O3K7.js';
|
|
|
297
297
|
import './XOLOXB7M.js';
|
|
298
298
|
export { Configuration, ResponseError } from './KBNUN3MF.js';
|
|
299
299
|
export { AMULET_INSTRUMENT_ID, fetchAmuletContext, fetchDsoParty, injectExternalPartyAmuletRules } from './DSYVONFP.js';
|
|
300
|
-
export { CantonGrpcClient } from './
|
|
300
|
+
export { CantonGrpcClient } from './IA2UQ4WQ.js';
|
|
301
301
|
import './RVQWP4JU.js';
|
|
302
302
|
import './VJ4PVZYL.js';
|
|
303
303
|
export { computeDecentralizedNamespace, computeMultiTransactionHash } from './QAKOQQ7E.js';
|
|
304
|
-
import './MIPVIR2V.js';
|
|
305
304
|
export { cantonMultihash, computeCantonFingerprint, computePublicKeyFingerprint, extractTransactions } from './WLV6EHDB.js';
|
|
306
305
|
export { CommandStatus, IntLikeSchema, buildTemplateId, canonicalizeDamlDecimal, smallestUnitsToDamlDecimal } from './4WZTQJXP.js';
|
|
307
306
|
import './35ELVFTS.js';
|
|
307
|
+
import './RSV7WS7X.js';
|
|
308
308
|
export { ClientCredentialsTokenProvider } from './V2H2WXKE.js';
|
|
309
309
|
export { LocalTokenProvider } from './SCEF7TLZ.js';
|
|
310
|
-
import './RSV7WS7X.js';
|
|
311
310
|
export { CANTON_CID_ADDRESS_PREFIX, CANTON_PARTY_ADDRESS_PREFIX, cantonCidAddress, cantonDeferredAddress, cantonPartyAddress, isCantonAddress, toCantonAddress } from './TM5LJKTE.js';
|
|
312
311
|
export { parseAmuletAmount, parseAmuletDecimal } from './CXTOAS7N.js';
|
|
313
312
|
export { SECP256K1_SPKI_DER_HEADER, SECP256K1_SPKI_DER_HEADER_HEX, derEncodeSignature, publicKeyToSpkiDer } from './CMDFOA7C.js';
|
package/dist/provider.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,KAAK,oCAAoC,EAC5C,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAOxD;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAC9B,MAAM,EAAE,aAAa,CAAC;IACtB,UAAU,EAAE,gBAAgB,CAAC;IAC7B,aAAa,EAAE,aAAa,CAAC;IAC7B,sEAAsE;IACtE,SAAS,EAAE,MAAM,CAAC;CACrB,CAAC;AAMF,MAAM,MAAM,oBAAoB,GAAG;IAC/B,qEAAqE;IACrE,UAAU,EAAE,MAAM,CAAC;IACnB,8DAA8D;IAC9D,YAAY,EAAE,MAAM,CAAC;IACrB,wDAAwD;IACxD,MAAM,EAAE,MAAM,CAAC;IACf,+EAA+E;IAC/E,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,qGAAqG;IACrG,SAAS,EAAE,MAAM,CAAC;IAClB,iFAAiF;IACjF,MAAM,CAAC,EAAE,oCAAoC,CAAC;CACjD,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,oBAAoB,CA8DrE;AAMD,MAAM,MAAM,gCAAgC,GAAG;IAC3C,8CAA8C;IAC9C,GAAG,EAAE,MAAM,CAAC;IACZ,8EAA8E;IAC9E,OAAO,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,EACtC,GAAG,EACH,OAAO,GACV,EAAE,gCAAgC,GAAG,mBAAmB,
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,KAAK,oCAAoC,EAC5C,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAOxD;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAC9B,MAAM,EAAE,aAAa,CAAC;IACtB,UAAU,EAAE,gBAAgB,CAAC;IAC7B,aAAa,EAAE,aAAa,CAAC;IAC7B,sEAAsE;IACtE,SAAS,EAAE,MAAM,CAAC;CACrB,CAAC;AAMF,MAAM,MAAM,oBAAoB,GAAG;IAC/B,qEAAqE;IACrE,UAAU,EAAE,MAAM,CAAC;IACnB,8DAA8D;IAC9D,YAAY,EAAE,MAAM,CAAC;IACrB,wDAAwD;IACxD,MAAM,EAAE,MAAM,CAAC;IACf,+EAA+E;IAC/E,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,qGAAqG;IACrG,SAAS,EAAE,MAAM,CAAC;IAClB,iFAAiF;IACjF,MAAM,CAAC,EAAE,oCAAoC,CAAC;CACjD,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,oBAAoB,CA8DrE;AAMD,MAAM,MAAM,gCAAgC,GAAG;IAC3C,8CAA8C;IAC9C,GAAG,EAAE,MAAM,CAAC;IACZ,8EAA8E;IAC9E,OAAO,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,EACtC,GAAG,EACH,OAAO,GACV,EAAE,gCAAgC,GAAG,mBAAmB,CA2BxD"}
|
package/dist/provider.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { createCantonChainProvider, parseCantonChainUri } from './
|
|
1
|
+
export { createCantonChainProvider, parseCantonChainUri } from './AH32N3GF.js';
|
|
2
2
|
import './WAKNWPCR.js';
|
|
3
3
|
import './MNIG6M5P.js';
|
|
4
4
|
import './6CPYXAOF.js';
|
|
@@ -285,11 +285,10 @@ import './5NV4O3K7.js';
|
|
|
285
285
|
import './XOLOXB7M.js';
|
|
286
286
|
import './KBNUN3MF.js';
|
|
287
287
|
import './DSYVONFP.js';
|
|
288
|
-
import './
|
|
288
|
+
import './IA2UQ4WQ.js';
|
|
289
289
|
import './RVQWP4JU.js';
|
|
290
290
|
import './VJ4PVZYL.js';
|
|
291
291
|
import './QAKOQQ7E.js';
|
|
292
|
-
import './MIPVIR2V.js';
|
|
293
292
|
import './WLV6EHDB.js';
|
|
294
293
|
import './V2H2WXKE.js';
|
|
295
294
|
import './SCEF7TLZ.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@layerzerolabs/common-canton",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.32",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Canton VM client and utilities",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,6 +11,11 @@
|
|
|
11
11
|
"import": "./dist/index.js",
|
|
12
12
|
"default": "./dist/index.js"
|
|
13
13
|
},
|
|
14
|
+
"./browser": {
|
|
15
|
+
"types": "./dist/browser.d.ts",
|
|
16
|
+
"import": "./dist/browser.js",
|
|
17
|
+
"default": "./dist/browser.js"
|
|
18
|
+
},
|
|
14
19
|
"./types": {
|
|
15
20
|
"types": "./dist/types.d.ts",
|
|
16
21
|
"import": "./dist/types.js",
|
|
@@ -32,22 +37,22 @@
|
|
|
32
37
|
"@protobuf-ts/runtime-rpc": "^2.11.1",
|
|
33
38
|
"es-toolkit": "^1.39.10",
|
|
34
39
|
"zod": "4.3.5",
|
|
35
|
-
"@layerzerolabs/common-chain-model": "1.2.
|
|
36
|
-
"@layerzerolabs/common-
|
|
37
|
-
"@layerzerolabs/common-
|
|
38
|
-
"@layerzerolabs/typescript-utils": "1.2.
|
|
40
|
+
"@layerzerolabs/common-chain-model": "1.2.32",
|
|
41
|
+
"@layerzerolabs/common-encoding-utils": "1.2.32",
|
|
42
|
+
"@layerzerolabs/common-error-utils": "1.2.32",
|
|
43
|
+
"@layerzerolabs/typescript-utils": "1.2.32"
|
|
39
44
|
},
|
|
40
45
|
"devDependencies": {
|
|
41
|
-
"@vitest/coverage-v8": "
|
|
46
|
+
"@vitest/coverage-v8": "4.1.10",
|
|
42
47
|
"eslint": "9.39.1",
|
|
43
48
|
"tsup": "^8.4.0",
|
|
44
49
|
"typescript": "^6.0.3",
|
|
45
|
-
"vitest": "^
|
|
46
|
-
"@layerzerolabs/eslint-configuration": "^1.2.
|
|
47
|
-
"@layerzerolabs/typescript-configuration": "1.2.
|
|
48
|
-
"@layerzerolabs/
|
|
49
|
-
"@layerzerolabs/vm-tooling-canton": "1.2.
|
|
50
|
-
"@layerzerolabs/
|
|
50
|
+
"vitest": "^4.1.10",
|
|
51
|
+
"@layerzerolabs/eslint-configuration": "^1.2.32",
|
|
52
|
+
"@layerzerolabs/typescript-configuration": "1.2.32",
|
|
53
|
+
"@layerzerolabs/tsup-configuration": "1.2.32",
|
|
54
|
+
"@layerzerolabs/vm-tooling-canton": "1.2.32",
|
|
55
|
+
"@layerzerolabs/vitest-configuration": "1.2.32"
|
|
51
56
|
},
|
|
52
57
|
"publishConfig": {
|
|
53
58
|
"access": "public",
|
|
@@ -58,7 +63,8 @@
|
|
|
58
63
|
"audit-external",
|
|
59
64
|
"console-pen-test",
|
|
60
65
|
"gasolina-audit",
|
|
61
|
-
"layerzero-ver"
|
|
66
|
+
"layerzero-ver",
|
|
67
|
+
"lz-labs-sidecar"
|
|
62
68
|
]
|
|
63
69
|
},
|
|
64
70
|
"scripts": {
|
package/src/browser.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-safe Canton utilities.
|
|
3
|
+
*
|
|
4
|
+
* This entrypoint intentionally excludes the Canton ledger client and its Node-only
|
|
5
|
+
* transport dependencies. It may be used by frontend packages that need the
|
|
6
|
+
* deterministic encoding and signature helpers.
|
|
7
|
+
*/
|
|
8
|
+
export * from './crypto';
|
|
9
|
+
export * from './daml-serde';
|
package/src/client/grpc.ts
CHANGED
|
@@ -42,7 +42,6 @@ import {
|
|
|
42
42
|
headStateBaseQuery,
|
|
43
43
|
synchronizerStore,
|
|
44
44
|
} from './topology/utils';
|
|
45
|
-
import { UserManagementServiceClient } from './user-management';
|
|
46
45
|
import { computePublicKeyFingerprint } from './utils';
|
|
47
46
|
|
|
48
47
|
/** Default gRPC client options: 128 MiB message-size limits for large admin responses. */
|
|
@@ -65,9 +64,7 @@ export class CantonGrpcClient {
|
|
|
65
64
|
readonly #topologyRead: TopologyManagerReadServiceClient;
|
|
66
65
|
readonly #topologyWrite: TopologyManagerWriteServiceClient;
|
|
67
66
|
readonly #connectivity: SynchronizerConnectivityServiceClient;
|
|
68
|
-
readonly #userManagement: UserManagementServiceClient;
|
|
69
67
|
readonly #tokenProvider: TokenProvider;
|
|
70
|
-
readonly #userId: string;
|
|
71
68
|
#synchronizerId?: string;
|
|
72
69
|
|
|
73
70
|
/**
|
|
@@ -75,7 +72,6 @@ export class CantonGrpcClient {
|
|
|
75
72
|
*/
|
|
76
73
|
constructor(opts: CantonGrpcClientOptions) {
|
|
77
74
|
this.#tokenProvider = opts.tokenProvider;
|
|
78
|
-
this.#userId = opts.userId;
|
|
79
75
|
this.#synchronizerId = opts.synchronizerId;
|
|
80
76
|
this.#transport = new GrpcTransport({
|
|
81
77
|
host: opts.host,
|
|
@@ -85,7 +81,6 @@ export class CantonGrpcClient {
|
|
|
85
81
|
this.#topologyRead = new TopologyManagerReadServiceClient(this.#transport);
|
|
86
82
|
this.#topologyWrite = new TopologyManagerWriteServiceClient(this.#transport);
|
|
87
83
|
this.#connectivity = new SynchronizerConnectivityServiceClient(this.#transport);
|
|
88
|
-
this.#userManagement = new UserManagementServiceClient(this.#transport);
|
|
89
84
|
}
|
|
90
85
|
|
|
91
86
|
/** Returns per-RPC gRPC metadata with a fresh Bearer token. */
|
|
@@ -437,17 +432,6 @@ export class CantonGrpcClient {
|
|
|
437
432
|
);
|
|
438
433
|
}
|
|
439
434
|
|
|
440
|
-
async grantCanActAs(partyId: string): Promise<void> {
|
|
441
|
-
await this.#userManagement.grantUserRights(
|
|
442
|
-
{
|
|
443
|
-
userId: this.#userId,
|
|
444
|
-
rights: [{ canActAs: { party: partyId } }],
|
|
445
|
-
identityProviderId: '',
|
|
446
|
-
},
|
|
447
|
-
{ meta: await this.#getMeta() },
|
|
448
|
-
);
|
|
449
|
-
}
|
|
450
|
-
|
|
451
435
|
/** Closes the underlying gRPC transport. */
|
|
452
436
|
close(): void {
|
|
453
437
|
this.#transport.close();
|
|
@@ -120,8 +120,6 @@ export type CantonGrpcClientOptions = {
|
|
|
120
120
|
host: string;
|
|
121
121
|
/** Supplies a fresh Bearer token before each RPC call. */
|
|
122
122
|
tokenProvider: TokenProvider;
|
|
123
|
-
/** Ledger API user ID used for user-management RPCs (e.g. `GrantUserRights`). */
|
|
124
|
-
userId: string;
|
|
125
123
|
/**
|
|
126
124
|
* Logical synchronizer id used as the topology store. When omitted, the first
|
|
127
125
|
* synchronizer the participant is connected to (via `ListConnectedSynchronizers`)
|
package/src/provider.ts
CHANGED
package/dist/I7FWUGTT.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/client/grpc.ts"],"names":["DEFAULT_GRPC_CLIENT_OPTIONS","CantonGrpcClient","opts","tokenProvider","userId","synchronizerId","GrpcTransport","host","channelCredentials","buildChannelCredentials","tls","clientOptions","grpcClientOptions","TopologyManagerReadServiceClient","TopologyManagerWriteServiceClient","SynchronizerConnectivityServiceClient","UserManagementServiceClient","token","getToken","Authorization","response","listConnectedSynchronizers","meta","synchronizer","connectedSynchronizers","CantonProtocolError","mapping","serial","generateTransactions","GenerateTransactionsRequest","create","proposals","GenerateTransactionsRequest_Proposal","operation","Enums_TopologyChangeOp","ADD_REPLACE","store","synchronizerStore","generated","generatedTransactions","getNamespaceDelegation","namespaceFingerprint","listNamespaceDelegation","ListNamespaceDelegationRequest","baseQuery","headStateBaseQuery","filterNamespace","filterTargetKeyFingerprint","results","flatMap","result","item","publicKey","targetKey","namespace","targetKeyFingerprint","computePublicKeyFingerprint","isRootDelegation","context","getDecentralizedNamespaceDefinition","listDecentralizedNamespaceDefinition","ListDecentralizedNamespaceDefinitionRequest","decentralizedNamespace","threshold","owners","getPartyToKeyMapping","partyId","listPartyToKeyMapping","ListPartyToKeyMappingRequest","filterParty","party","signingKeyFingerprints","signingKeys","map","key","getPartyToParticipantMapping","listPartyToParticipant","ListPartyToParticipantRequest","filterParticipant","participants","participant","participantUid","permission","createNamespaceDelegationTx","params","buildNamespaceDelegationMapping","publicKeyDer","createDecentralizedNamespaceDefinitionTx","computeDecentralizedNamespace","buildDecentralizedNamespaceDefinitionMapping","updateDecentralizedNamespaceDefinitionTx","createPartyToKeyTx","buildPartyToKeyMapping","signingPublicKeyDers","createPartyToParticipantTx","buildPartyToParticipantMapping","participantIds","submitTopologyTransactions","transactions","length","CantonError","addTransactions","AddTransactionsRequest","grantCanActAs","grantUserRights","rights","canActAs","identityProviderId","close"],"mappings":";;;;;;;;;;AAgDA,IAAMA,2BAAAA,GAA8B;AAChC,EAAA,iCAAA,EAAmC,MAAM,IAAA,GAAO,IAAA;AAChD,EAAA,8BAAA,EAAgC,MAAM,IAAA,GAAO;AACjD,CAAA;AAWO,IAAMC,mBAAN,MAAMA;EA9Db;;;AA+Da,EAAA,UAAA;AACA,EAAA,aAAA;AACA,EAAA,cAAA;AACA,EAAA,aAAA;AACA,EAAA,eAAA;AACA,EAAA,cAAA;AACA,EAAA,OAAA;AACT,EAAA,eAAA;;;;AAKA,EAAA,WAAA,CAAYC,IAAAA,EAA+B;AACvC,IAAA,IAAA,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AAQ,IAAA,CAAK,OAAA;MACbqG,MAAAA,EAAQ;AAAC,QAAA;UAAEC,QAAAA,EAAU;YAAEpC,KAAAA,EAAOJ;AAAQ;AAAE;;MACxCyC,kBAAAA,EAAoB;KACxB,EACA;MAAErF,IAAAA,EAAM,MAAM,KAAK,QAAA;KAAW,CAAA;AAEtC,EAAA;;EAGAsF,KAAAA,GAAc;AACV,IAAA,IAAA,CAAK,WAAWA,KAAAA,EAAK;AACzB,EAAA;AACJ","file":"I7FWUGTT.js","sourcesContent":["import {\n AddTransactionsRequest,\n Enums_TopologyChangeOp,\n GenerateTransactionsRequest,\n GenerateTransactionsRequest_Proposal,\n ListDecentralizedNamespaceDefinitionRequest,\n ListNamespaceDelegationRequest,\n ListPartyToKeyMappingRequest,\n ListPartyToParticipantRequest,\n type SignedTopologyTransaction,\n TopologyManagerReadServiceClient,\n TopologyManagerWriteServiceClient,\n type TopologyMapping,\n} from '@canton-network/core-ledger-proto';\nimport { GrpcTransport } from '@protobuf-ts/grpc-transport';\n\nimport type { TokenProvider } from '../auth/token-provider';\nimport { CantonError, CantonProtocolError } from '../errors';\nimport {\n buildDecentralizedNamespaceDefinitionMapping,\n buildNamespaceDelegationMapping,\n buildPartyToKeyMapping,\n buildPartyToParticipantMapping,\n} from './topology/mappings';\nimport { SynchronizerConnectivityServiceClient } from './topology/synchronizer-connectivity';\nimport type {\n CantonGrpcClientOptions,\n CreateDecentralizedNamespaceDefinitionTxParams,\n CreateNamespaceDelegationTxParams,\n CreatePartyToKeyMappingTxParams,\n CreatePartyToParticipantMappingTxParams,\n DecentralizedNamespaceDefinitionState,\n GeneratedTopologyTransaction,\n NamespaceDelegationState,\n PartyToKeyMappingState,\n PartyToParticipantMappingState,\n UpdateDecentralizedNamespaceDefinitionTxParams,\n} from './topology/types';\nimport {\n buildChannelCredentials,\n computeDecentralizedNamespace,\n headStateBaseQuery,\n synchronizerStore,\n} from './topology/utils';\nimport { UserManagementServiceClient } from './user-management';\nimport { computePublicKeyFingerprint } from './utils';\n\n/** Default gRPC client options: 128 MiB message-size limits for large admin responses. */\nconst DEFAULT_GRPC_CLIENT_OPTIONS = {\n 'grpc.max_receive_message_length': 128 * 1024 * 1024,\n 'grpc.max_send_message_length': 128 * 1024 * 1024,\n} as const;\n\n/**\n * gRPC client for the Canton participant admin Topology Manager API.\n *\n * Exposes read queries for topology mappings and write helpers that call\n * `GenerateTransactions` to produce unsigned topology transactions and\n * `AddTransactions` to submit signed ones.\n *\n * A fresh Bearer token is attached to each RPC via {@link TokenProvider}.\n */\nexport class CantonGrpcClient {\n readonly #transport: GrpcTransport;\n readonly #topologyRead: TopologyManagerReadServiceClient;\n readonly #topologyWrite: TopologyManagerWriteServiceClient;\n readonly #connectivity: SynchronizerConnectivityServiceClient;\n readonly #userManagement: UserManagementServiceClient;\n readonly #tokenProvider: TokenProvider;\n readonly #userId: string;\n #synchronizerId?: string;\n\n /**\n * @param opts - Admin API host, auth, optional synchronizer id, and optional TLS.\n */\n constructor(opts: CantonGrpcClientOptions) {\n this.#tokenProvider = opts.tokenProvider;\n this.#userId = opts.userId;\n this.#synchronizerId = opts.synchronizerId;\n this.#transport = new GrpcTransport({\n host: opts.host,\n channelCredentials: buildChannelCredentials(opts.host, opts.tls),\n clientOptions: opts.grpcClientOptions ?? DEFAULT_GRPC_CLIENT_OPTIONS,\n });\n this.#topologyRead = new TopologyManagerReadServiceClient(this.#transport);\n this.#topologyWrite = new TopologyManagerWriteServiceClient(this.#transport);\n this.#connectivity = new SynchronizerConnectivityServiceClient(this.#transport);\n this.#userManagement = new UserManagementServiceClient(this.#transport);\n }\n\n /** Returns per-RPC gRPC metadata with a fresh Bearer token. */\n async #getMeta(): Promise<Record<string, string>> {\n const token = await this.#tokenProvider.getToken();\n return { Authorization: `Bearer ${token}` };\n }\n\n /**\n * Returns the client synchronizer id, discovering it on first use when omitted at construction.\n *\n * @throws {CantonProtocolError} If the participant exposes no synchronizer store.\n */\n async #getSynchronizerId(): Promise<string> {\n if (this.#synchronizerId) {\n return this.#synchronizerId;\n }\n this.#synchronizerId = await this.#discoverSynchronizerId();\n return this.#synchronizerId;\n }\n\n /**\n * Resolves the logical id of the first synchronizer the participant is connected to.\n *\n * @throws {CantonProtocolError} If the participant is not connected to any synchronizer.\n */\n async #discoverSynchronizerId(): Promise<string> {\n const { response } = await this.#connectivity.listConnectedSynchronizers(\n {},\n { meta: await this.#getMeta() },\n );\n for (const synchronizer of response.connectedSynchronizers) {\n if (synchronizer.synchronizerId) {\n return synchronizer.synchronizerId;\n }\n }\n throw new CantonProtocolError('Participant is not connected to any synchronizer');\n }\n\n /**\n * Calls `GenerateTransactions` for a single ADD_REPLACE mapping.\n *\n * @param synchronizerId - Synchronizer store to target.\n * @param mapping - Topology mapping to encode into the transaction.\n * @param serial - Topology serial (`0` lets Canton auto-determine).\n * @returns Unsigned topology transaction (`serializedTransaction`, `transactionHash`).\n * @throws {CantonProtocolError} If the RPC returns no generated transaction.\n */\n async #generateTopologyTransaction(\n synchronizerId: string,\n mapping: TopologyMapping,\n serial: number,\n ): Promise<GeneratedTopologyTransaction> {\n const { response } = await this.#topologyWrite.generateTransactions(\n GenerateTransactionsRequest.create({\n proposals: [\n GenerateTransactionsRequest_Proposal.create({\n operation: Enums_TopologyChangeOp.ADD_REPLACE,\n serial,\n mapping,\n store: synchronizerStore(synchronizerId),\n }),\n ],\n }),\n { meta: await this.#getMeta() },\n );\n\n const generated = response.generatedTransactions[0];\n if (!generated) {\n throw new CantonProtocolError('GenerateTransactions returned no topology transaction');\n }\n return generated;\n }\n\n /**\n * Lists Namespace Delegation (NSD) mappings for a namespace.\n *\n * Queries topology head state on the synchronizer. Returns every result from\n * the list RPC.\n *\n * @param namespaceFingerprint - Namespace to filter on (for root NSD, the owner key fingerprint).\n * @returns All matching NSD mappings, or an empty array if none exist.\n */\n async getNamespaceDelegation(\n namespaceFingerprint: string,\n ): Promise<NamespaceDelegationState[]> {\n const synchronizerId = await this.#getSynchronizerId();\n const { response } = await this.#topologyRead.listNamespaceDelegation(\n ListNamespaceDelegationRequest.create({\n baseQuery: headStateBaseQuery(synchronizerId),\n filterNamespace: namespaceFingerprint,\n // Empty string = no target-key filter; return all delegations for this namespace.\n filterTargetKeyFingerprint: '',\n }),\n { meta: await this.#getMeta() },\n );\n\n return response.results.flatMap((result) => {\n const item = result.item;\n const publicKey = item?.targetKey?.publicKey;\n if (!item || !publicKey) {\n return [];\n }\n return [\n {\n namespace: item.namespace,\n targetKeyFingerprint: computePublicKeyFingerprint(publicKey),\n isRootDelegation: item.isRootDelegation,\n serial: result.context?.serial ?? 0,\n },\n ];\n });\n }\n\n /**\n * Lists Decentralized Namespace Definition (DND) mappings for a namespace.\n *\n * Queries topology head state on the synchronizer. For a party id `hint::1220…`,\n * pass the `1220…` suffix as `namespaceFingerprint`.\n *\n * @param namespaceFingerprint - Decentralized namespace fingerprint to filter on.\n * @returns All matching DND mappings, or an empty array if none exist.\n */\n async getDecentralizedNamespaceDefinition(\n namespaceFingerprint: string,\n ): Promise<DecentralizedNamespaceDefinitionState[]> {\n const synchronizerId = await this.#getSynchronizerId();\n const { response } = await this.#topologyRead.listDecentralizedNamespaceDefinition(\n ListDecentralizedNamespaceDefinitionRequest.create({\n baseQuery: headStateBaseQuery(synchronizerId),\n filterNamespace: namespaceFingerprint,\n }),\n { meta: await this.#getMeta() },\n );\n\n return response.results.flatMap((result) => {\n const item = result.item;\n if (!item) {\n return [];\n }\n return [\n {\n namespace: item.decentralizedNamespace,\n threshold: item.threshold,\n owners: [...item.owners],\n serial: result.context?.serial ?? 0,\n },\n ];\n });\n }\n\n /**\n * Lists Party-to-Key (PTK) mappings for a party.\n *\n * Queries topology head state on the synchronizer.\n *\n * @param partyId - Full party identifier (e.g. `hint::1220…`).\n * @returns All matching PTK mappings, or an empty array if none exist.\n */\n async getPartyToKeyMapping(partyId: string): Promise<PartyToKeyMappingState[]> {\n const synchronizerId = await this.#getSynchronizerId();\n const { response } = await this.#topologyRead.listPartyToKeyMapping(\n ListPartyToKeyMappingRequest.create({\n baseQuery: headStateBaseQuery(synchronizerId),\n filterParty: partyId,\n }),\n { meta: await this.#getMeta() },\n );\n\n return response.results.flatMap((result) => {\n const item = result.item;\n if (!item) {\n return [];\n }\n return [\n {\n party: item.party,\n threshold: item.threshold,\n signingKeyFingerprints: item.signingKeys.map((key) =>\n computePublicKeyFingerprint(key.publicKey),\n ),\n serial: result.context?.serial ?? 0,\n },\n ];\n });\n }\n\n /**\n * Lists Party-to-Participant (PTP) mappings for a party.\n *\n * Queries topology head state on the synchronizer.\n *\n * @param partyId - Full party identifier (e.g. `hint::1220…`).\n * @param proposals - If `true`, query pending proposals instead of authorized mappings.\n * @returns All matching PTP mappings, or an empty array if none exist.\n */\n async getPartyToParticipantMapping(\n partyId: string,\n proposals = false,\n ): Promise<PartyToParticipantMappingState[]> {\n const synchronizerId = await this.#getSynchronizerId();\n const { response } = await this.#topologyRead.listPartyToParticipant(\n ListPartyToParticipantRequest.create({\n baseQuery: headStateBaseQuery(synchronizerId, proposals),\n filterParty: partyId,\n // Empty string = no participant filter; return all hosting mappings for this party.\n filterParticipant: '',\n }),\n { meta: await this.#getMeta() },\n );\n\n return response.results.flatMap((result) => {\n const item = result.item;\n if (!item) {\n return [];\n }\n return [\n {\n party: item.party,\n threshold: item.threshold,\n participants: item.participants.map((participant) => ({\n participantUid: participant.participantUid,\n permission: participant.permission,\n })),\n serial: result.context?.serial ?? 0,\n },\n ];\n });\n }\n\n /**\n * Builds an unsigned Namespace Delegation (NSD) topology transaction.\n *\n * Calls `GenerateTransactions` with an ADD_REPLACE mapping. The returned\n * `transactionHash` must be signed by the namespace key.\n *\n * @param params - Owner public key and optional serial.\n * @returns Unsigned topology transaction (`serializedTransaction`, `transactionHash`).\n */\n async createNamespaceDelegationTx(\n params: CreateNamespaceDelegationTxParams,\n ): Promise<GeneratedTopologyTransaction> {\n const synchronizerId = await this.#getSynchronizerId();\n const mapping = buildNamespaceDelegationMapping(params.publicKeyDer);\n return this.#generateTopologyTransaction(synchronizerId, mapping, params.serial ?? 0);\n }\n\n /**\n * Builds an unsigned Decentralized Namespace Definition (DND) topology transaction.\n *\n * The decentralized namespace id is derived from `params.owners`. All owners\n * must sign the transaction hash.\n *\n * @param params - Owner fingerprints, threshold, and optional serial.\n * @returns Unsigned topology transaction (`serializedTransaction`, `transactionHash`).\n */\n async createDecentralizedNamespaceDefinitionTx(\n params: CreateDecentralizedNamespaceDefinitionTxParams,\n ): Promise<GeneratedTopologyTransaction> {\n const synchronizerId = await this.#getSynchronizerId();\n const decentralizedNamespace = computeDecentralizedNamespace(params.owners);\n const mapping = buildDecentralizedNamespaceDefinitionMapping(\n decentralizedNamespace,\n params.threshold,\n params.owners,\n );\n return this.#generateTopologyTransaction(synchronizerId, mapping, params.serial ?? 0);\n }\n\n async updateDecentralizedNamespaceDefinitionTx(\n params: UpdateDecentralizedNamespaceDefinitionTxParams,\n ): Promise<GeneratedTopologyTransaction> {\n const synchronizerId = await this.#getSynchronizerId();\n const mapping = buildDecentralizedNamespaceDefinitionMapping(\n params.namespace,\n params.threshold,\n params.owners,\n );\n return this.#generateTopologyTransaction(synchronizerId, mapping, params.serial ?? 0);\n }\n\n /**\n * Builds an unsigned Party-to-Key (PTK) topology transaction.\n *\n * Decentralized namespace owners must sign the transaction hash.\n *\n * @param params - Party id, signing keys, threshold, and optional serial.\n * @returns Unsigned topology transaction (`serializedTransaction`, `transactionHash`).\n */\n async createPartyToKeyTx(\n params: CreatePartyToKeyMappingTxParams,\n ): Promise<GeneratedTopologyTransaction> {\n const synchronizerId = await this.#getSynchronizerId();\n const mapping = buildPartyToKeyMapping(\n params.partyId,\n params.signingPublicKeyDers,\n params.threshold,\n );\n return this.#generateTopologyTransaction(synchronizerId, mapping, params.serial ?? 0);\n }\n\n /**\n * Builds an unsigned Party-to-Participant (PTP) topology transaction.\n *\n * Party owners sign the transaction hash. On submit, set `proposal: true` on the\n * signed transaction so the hosting participant can authorize via `Authorize`.\n *\n * @param params - Party id, participant ids, threshold, and optional serial.\n * @returns Unsigned topology transaction (`serializedTransaction`, `transactionHash`).\n */\n async createPartyToParticipantTx(\n params: CreatePartyToParticipantMappingTxParams,\n ): Promise<GeneratedTopologyTransaction> {\n const synchronizerId = await this.#getSynchronizerId();\n const mapping = buildPartyToParticipantMapping(\n params.partyId,\n params.participantIds,\n params.threshold,\n );\n return this.#generateTopologyTransaction(synchronizerId, mapping, params.serial ?? 0);\n }\n\n /**\n * Submits signed topology transactions to the synchronizer store.\n *\n * Multiple transactions are submitted atomically in one `AddTransactions` call.\n * When batching, sign `computeMultiTransactionHash` over all transaction hashes\n * and attach the same `MultiTransactionSignatures` to each entry.\n *\n * Set `proposal: true` on a transaction when the hosting participant must\n * authorize that mapping afterward.\n *\n * @param transactions - One or more signed topology transactions.\n * @throws {CantonError} If `transactions` is empty.\n */\n async submitTopologyTransactions(\n transactions: readonly SignedTopologyTransaction[],\n ): Promise<void> {\n if (transactions.length === 0) {\n throw new CantonError('AddTransactions requires at least one transaction');\n }\n const synchronizerId = await this.#getSynchronizerId();\n await this.#topologyWrite.addTransactions(\n AddTransactionsRequest.create({\n transactions: [...transactions],\n store: synchronizerStore(synchronizerId),\n }),\n { meta: await this.#getMeta() },\n );\n }\n\n async grantCanActAs(partyId: string): Promise<void> {\n await this.#userManagement.grantUserRights(\n {\n userId: this.#userId,\n rights: [{ canActAs: { party: partyId } }],\n identityProviderId: '',\n },\n { meta: await this.#getMeta() },\n );\n }\n\n /** Closes the underlying gRPC transport. */\n close(): void {\n this.#transport.close();\n }\n}\n"]}
|
package/dist/KYBLHMHO.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/provider.ts"],"names":["parseCantonChainUri","uri","url","URL","adminApiHost","searchParams","get","Error","userId","actAsParam","actAs","split","map","party","trim","filter","length","walletUrl","tokenUrl","undefined","clientId","clientSecret","process","env","CANTON_CLIENT_SECRET","scope","audience","key","delete","jsonApiUrl","toString","replace","oauth2","createCantonChainProvider","isLocal","params","tokenProvider","createTokenProvider","configuration","Configuration","basePath","accessToken","getToken","client","CantonClient","grpcClient","CantonGrpcClient","host","LocalTokenProvider","admin","ClientCredentialsTokenProvider"],"mappings":";;;;;;;;AA6DO,SAASA,oBAAoBC,GAAAA,EAAW;AAC3C,EAAA,MAAMC,GAAAA,GAAM,IAAIC,GAAAA,CAAIF,GAAAA,CAAAA;AAEpB,EAAA,MAAMG,YAAAA,GAAeF,GAAAA,CAAIG,YAAAA,CAAaC,GAAAA,CAAI,WAAA,CAAA;AAC1C,EAAA,IAAI,CAACF,YAAAA,EAAc;AACf,IAAA,MAAM,IAAIG,MAAM,kEAAA,CAAA;AACpB,EAAA;AAEA,EAAA,MAAMC,MAAAA,GAASN,GAAAA,CAAIG,YAAAA,CAAaC,GAAAA,CAAI,SAAA,CAAA,IAAc,mBAAA;AAClD,EAAA,MAAMG,UAAAA,GAAaP,GAAAA,CAAIG,YAAAA,CAAaC,GAAAA,CAAI,QAAA,CAAA;AACxC,EAAA,MAAMI,QACFD,UAAAA,EACME,KAAAA,CAAM,GAAA,CAAA,CACPC,GAAAA,CAAI,CAACC,KAAAA,KAAUA,KAAAA,CAAMC,MAAI,CAAA,CACzBC,OAAO,CAACF,KAAAA,KAAUA,MAAMG,MAAAA,GAAS,CAAA,KAAM,EAAA;AAChD,EAAA,MAAMC,SAAAA,GAAYf,GAAAA,CAAIG,YAAAA,CAAaC,GAAAA,CAAI,YAAA,CAAA;AACvC,EAAA,IAAI,CAACW,SAAAA,EAAW;AACZ,IAAA,MAAM,IAAIV,MAAM,mEAAA,CAAA;AACpB,EAAA;AACA,EAAA,MAAMW,QAAAA,GAAWhB,GAAAA,CAAIG,YAAAA,CAAaC,GAAAA,CAAI,WAAA,CAAA,IAAgBa,MAAAA;AACtD,EAAA,MAAMC,QAAAA,GAAWlB,GAAAA,CAAIG,YAAAA,CAAaC,GAAAA,CAAI,WAAA,CAAA,IAAgBa,MAAAA;AAEtD,EAAA,MAAME,YAAAA,GACFnB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MAAM,IAAIzB,MACN,kHAAA,CAAA;AAER,EAAA;AAEA,EAAA,OAAO,IAAI2C,8BAAAA,CAA+Bf,MAAAA,CAAOH,MAAM,CAAA;AAC3D;AAjBSK,MAAAA,CAAAA,mBAAAA,EAAAA,qBAAAA,CAAAA","file":"KYBLHMHO.js","sourcesContent":["import {\n ClientCredentialsTokenProvider,\n type ClientCredentialsTokenProviderConfig,\n} from './auth/client-credentials-token-provider';\nimport { LocalTokenProvider } from './auth/local-token-provider';\nimport type { TokenProvider } from './auth/token-provider';\nimport { CantonClient } from './client/canton-client';\nimport { CantonGrpcClient } from './client/grpc';\nimport type { ICantonClient } from './client/interface';\nimport { Configuration } from './open-api/runtime';\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Provider Type\n// ─────────────────────────────────────────────────────────────────────────────\n\n/**\n * - {@link client} — JSON Ledger API (commands, queries, updates)\n * - {@link grpcClient} — gRPC Admin API (topology transactions, namespace queries)\n * - {@link tokenProvider} — Shared Bearer-token source used by both transports\n * - {@link walletUrl} — Canton Network validator wallet (scan-proxy CIP-56 endpoints)\n */\nexport type CantonChainProvider = {\n client: ICantonClient;\n grpcClient: CantonGrpcClient;\n tokenProvider: TokenProvider;\n /** Validator wallet URL for scan-proxy CIP-56 endpoints. Required. */\n walletUrl: string;\n};\n\n// ─────────────────────────────────────────────────────────────────────────────\n// URI Parsing\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport type CantonChainUriParams = {\n /** Base URL of the JSON Ledger API (e.g. \"http://localhost:5975\") */\n jsonApiUrl: string;\n /** Host:port of the gRPC Admin API (e.g. \"localhost:5076\") */\n adminApiHost: string;\n /** Ledger API user ID (default: \"participant_admin\") */\n userId: string;\n /** Parties granted `actAs` on localnet tokens (comma-separated in the URI). */\n actAs: string[];\n /** Validator wallet URL for scan-proxy CIP-56 endpoints (e.g. \"http://localhost:7201\"). Required. */\n walletUrl: string;\n /** OAuth2 client credentials config — present only for non-local environments */\n oauth2?: ClientCredentialsTokenProviderConfig;\n};\n\n/**\n * Parse a Canton chain provider URI into its constituent parts.\n *\n * URI format:\n * `<json-api-base>?admin-api=<host:port>&user-id=<id>&wallet-url=<url>[&token-url=...&client-id=...&client-secret=...&scope=...&audience=...]`\n *\n * The base URL (everything before the query string) is the JSON Ledger API endpoint.\n * Canton-specific params are extracted and removed; any remaining query params are\n * preserved on the JSON API URL.\n *\n * When `client-secret` is omitted from the URI, `CANTON_CLIENT_SECRET` is read from the\n * environment.\n */\nexport function parseCantonChainUri(uri: string): CantonChainUriParams {\n const url = new URL(uri);\n\n const adminApiHost = url.searchParams.get('admin-api');\n if (!adminApiHost) {\n throw new Error('Canton provider URI missing required \"admin-api\" query parameter');\n }\n\n const userId = url.searchParams.get('user-id') ?? 'participant_admin';\n const actAsParam = url.searchParams.get('act-as');\n const actAs =\n actAsParam\n ?.split(',')\n .map((party) => party.trim())\n .filter((party) => party.length > 0) ?? [];\n const walletUrl = url.searchParams.get('wallet-url');\n if (!walletUrl) {\n throw new Error('Canton provider URI missing required \"wallet-url\" query parameter');\n }\n const tokenUrl = url.searchParams.get('token-url') ?? undefined;\n const clientId = url.searchParams.get('client-id') ?? undefined;\n // Prefer URI param; fall back to env so secrets are not committed in provider configs.\n const clientSecret =\n url.searchParams.get('client-secret') ??\n // eslint-disable-next-line turbo/no-undeclared-env-vars -- runtime OAuth secret, not a turbo task input\n process.env.CANTON_CLIENT_SECRET ??\n undefined;\n const scope = url.searchParams.get('scope') ?? undefined;\n const audience = url.searchParams.get('audience') ?? undefined;\n\n for (const key of [\n 'admin-api',\n 'user-id',\n 'act-as',\n 'wallet-url',\n 'sequencer-url',\n 'sequencer-validators',\n 'sequencer-quorum',\n 'token-url',\n 'client-id',\n 'client-secret',\n 'scope',\n 'audience',\n ]) {\n url.searchParams.delete(key);\n }\n\n const jsonApiUrl = url.toString().replace(/\\/$/, '');\n\n const oauth2 =\n tokenUrl && clientId && clientSecret\n ? { tokenUrl, clientId, clientSecret, scope, audience }\n : undefined;\n\n return {\n jsonApiUrl,\n adminApiHost,\n userId,\n actAs,\n walletUrl,\n oauth2,\n };\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Provider Factory\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport type CreateCantonChainProviderOptions = {\n /** Raw provider URI (from provider config) */\n uri: string;\n /** When true, uses LocalTokenProvider (self-signed JWTs) instead of OAuth2 */\n isLocal: boolean;\n};\n\n/**\n * Create a {@link CantonChainProvider} from a provider URI.\n *\n * - **isLocal=true**: Uses {@link LocalTokenProvider} with admin-level access (self-signed JWTs).\n * - **isLocal=false**: Uses {@link ClientCredentialsTokenProvider} with OAuth2 client\n * credentials extracted from the URI query parameters.\n */\nexport function createCantonChainProvider({\n uri,\n isLocal,\n}: CreateCantonChainProviderOptions): CantonChainProvider {\n const params = parseCantonChainUri(uri);\n\n const tokenProvider = createTokenProvider(params, isLocal);\n\n // ── JSON Ledger API Client ──────────────────────────────────────────\n const configuration = new Configuration({\n basePath: params.jsonApiUrl,\n accessToken: () => tokenProvider.getToken(),\n });\n const client = new CantonClient(configuration, params.userId, {\n walletUrl: params.walletUrl,\n tokenProvider,\n });\n\n // ── gRPC Admin API Client ───────────────────────────────────────────\n const grpcClient = new CantonGrpcClient({\n host: params.adminApiHost,\n tokenProvider,\n userId: params.userId,\n });\n\n return {\n client,\n grpcClient,\n tokenProvider,\n walletUrl: params.walletUrl,\n };\n}\n\nfunction createTokenProvider(params: CantonChainUriParams, isLocal: boolean): TokenProvider {\n if (isLocal) {\n return new LocalTokenProvider({\n userId: params.userId,\n actAs: params.actAs,\n admin: true,\n });\n }\n\n // TODO(canton): add other prod auth methods (direct JWT passthrough, etc.).\n if (!params.oauth2) {\n throw new Error(\n 'Canton provider requires OAuth2 credentials (token-url, client-id, client-secret in URI or CANTON_CLIENT_SECRET)',\n );\n }\n\n return new ClientCredentialsTokenProvider(params.oauth2);\n}\n"]}
|
package/dist/MIPVIR2V.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { __name } from './VUOMXK5T.js';
|
|
2
|
-
import { MessageType, ScalarType, RepeatType } from '@protobuf-ts/runtime';
|
|
3
|
-
import { ServiceType, stackIntercept } from '@protobuf-ts/runtime-rpc';
|
|
4
|
-
|
|
5
|
-
var SERVICE_NAME = "com.daml.ledger.api.v2.admin.UserManagementService";
|
|
6
|
-
var canActAsMessage = new MessageType("com.daml.ledger.api.v2.admin.Right.CanActAs", [
|
|
7
|
-
{
|
|
8
|
-
no: 1,
|
|
9
|
-
name: "party",
|
|
10
|
-
kind: "scalar",
|
|
11
|
-
T: ScalarType.STRING
|
|
12
|
-
}
|
|
13
|
-
]);
|
|
14
|
-
var rightMessage = new MessageType("com.daml.ledger.api.v2.admin.Right", [
|
|
15
|
-
{
|
|
16
|
-
no: 2,
|
|
17
|
-
name: "can_act_as",
|
|
18
|
-
kind: "message",
|
|
19
|
-
T: /* @__PURE__ */ __name(() => canActAsMessage, "T")
|
|
20
|
-
}
|
|
21
|
-
]);
|
|
22
|
-
var grantRequestMessage = new MessageType("com.daml.ledger.api.v2.admin.GrantUserRightsRequest", [
|
|
23
|
-
{
|
|
24
|
-
no: 1,
|
|
25
|
-
name: "user_id",
|
|
26
|
-
kind: "scalar",
|
|
27
|
-
T: ScalarType.STRING
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
no: 2,
|
|
31
|
-
name: "rights",
|
|
32
|
-
kind: "message",
|
|
33
|
-
repeat: RepeatType.UNPACKED,
|
|
34
|
-
T: /* @__PURE__ */ __name(() => rightMessage, "T")
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
no: 3,
|
|
38
|
-
name: "identity_provider_id",
|
|
39
|
-
kind: "scalar",
|
|
40
|
-
T: ScalarType.STRING
|
|
41
|
-
}
|
|
42
|
-
]);
|
|
43
|
-
var grantResponseMessage = new MessageType("com.daml.ledger.api.v2.admin.GrantUserRightsResponse", []);
|
|
44
|
-
var service = new ServiceType(SERVICE_NAME, [
|
|
45
|
-
{
|
|
46
|
-
name: "GrantUserRights",
|
|
47
|
-
options: {},
|
|
48
|
-
I: grantRequestMessage,
|
|
49
|
-
O: grantResponseMessage
|
|
50
|
-
}
|
|
51
|
-
]);
|
|
52
|
-
var UserManagementServiceClient = class {
|
|
53
|
-
static {
|
|
54
|
-
__name(this, "UserManagementServiceClient");
|
|
55
|
-
}
|
|
56
|
-
#transport;
|
|
57
|
-
constructor(transport) {
|
|
58
|
-
this.#transport = transport;
|
|
59
|
-
}
|
|
60
|
-
grantUserRights(input, options) {
|
|
61
|
-
const method = service.methods[0];
|
|
62
|
-
return stackIntercept("unary", this.#transport, method, this.#transport.mergeOptions(options), input);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
export { UserManagementServiceClient };
|
|
67
|
-
//# sourceMappingURL=MIPVIR2V.js.map
|
|
68
|
-
//# sourceMappingURL=MIPVIR2V.js.map
|
package/dist/MIPVIR2V.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/client/user-management.ts"],"names":["SERVICE_NAME","canActAsMessage","MessageType","no","name","kind","T","ScalarType","STRING","rightMessage","grantRequestMessage","repeat","RepeatType","UNPACKED","grantResponseMessage","service","ServiceType","options","I","O","UserManagementServiceClient","transport","grantUserRights","input","method","methods","stackIntercept","mergeOptions"],"mappings":";;;;AAUA,IAAMA,YAAAA,GAAe,oDAAA;AAOrB,IAAMC,eAAAA,GAAkB,IAAIC,WAAAA,CAAsB,6CAAA,EAA+C;AAC7F,EAAA;IAAEC,EAAAA,EAAI,CAAA;IAAGC,IAAAA,EAAM,OAAA;IAASC,IAAAA,EAAM,QAAA;AAAUC,IAAAA,CAAAA,EAAGC,UAAAA,CAAWC;AAAO;AAChE,CAAA,CAAA;AAED,IAAMC,YAAAA,GAAe,IAAIP,WAAAA,CAAmB,oCAAA,EAAsC;AAC9E,EAAA;IAAEC,EAAAA,EAAI,CAAA;IAAGC,IAAAA,EAAM,YAAA;IAAcC,IAAAA,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,OAAOC,cAAAA,CACH,OAAA,EACA,IAAA,CAAK,UAAA,EACLF,MAAAA,EACA,KAAK,UAAA,CAAWG,YAAAA,CAAaV,OAAAA,CAAAA,EAC7BM,KAAAA,CAAAA;AAER,EAAA;AACJ","file":"MIPVIR2V.js","sourcesContent":["import { MessageType, RepeatType, ScalarType } from '@protobuf-ts/runtime';\nimport {\n type MethodInfo,\n type RpcOptions,\n type RpcTransport,\n ServiceType,\n stackIntercept,\n type UnaryCall,\n} from '@protobuf-ts/runtime-rpc';\n\nconst SERVICE_NAME = 'com.daml.ledger.api.v2.admin.UserManagementService';\n\ntype CanActAs = { party: string };\ntype Right = { canActAs: CanActAs };\ntype GrantUserRightsRequest = { userId: string; rights: Right[]; identityProviderId: string };\ntype GrantUserRightsResponse = Record<string, never>;\n\nconst canActAsMessage = new MessageType<CanActAs>('com.daml.ledger.api.v2.admin.Right.CanActAs', [\n { no: 1, name: 'party', kind: 'scalar', T: ScalarType.STRING },\n]);\n\nconst rightMessage = new MessageType<Right>('com.daml.ledger.api.v2.admin.Right', [\n { no: 2, name: 'can_act_as', kind: 'message', T: () => canActAsMessage },\n]);\n\nconst grantRequestMessage = new MessageType<GrantUserRightsRequest>(\n 'com.daml.ledger.api.v2.admin.GrantUserRightsRequest',\n [\n { no: 1, name: 'user_id', kind: 'scalar', T: ScalarType.STRING },\n {\n no: 2,\n name: 'rights',\n kind: 'message',\n repeat: RepeatType.UNPACKED,\n T: () => rightMessage,\n },\n { no: 3, name: 'identity_provider_id', kind: 'scalar', T: ScalarType.STRING },\n ],\n);\n\nconst grantResponseMessage = new MessageType<GrantUserRightsResponse>(\n 'com.daml.ledger.api.v2.admin.GrantUserRightsResponse',\n [],\n);\n\nconst service = new ServiceType(SERVICE_NAME, [\n { name: 'GrantUserRights', options: {}, I: grantRequestMessage, O: grantResponseMessage },\n]);\n\n/** Minimal gRPC client for `UserManagementService.GrantUserRights`. */\nexport class UserManagementServiceClient {\n readonly #transport: RpcTransport;\n\n constructor(transport: RpcTransport) {\n this.#transport = transport;\n }\n\n grantUserRights(\n input: GrantUserRightsRequest,\n options?: RpcOptions,\n ): UnaryCall<GrantUserRightsRequest, GrantUserRightsResponse> {\n const method = service.methods[0] as MethodInfo<\n GrantUserRightsRequest,\n GrantUserRightsResponse\n >;\n return stackIntercept<GrantUserRightsRequest, GrantUserRightsResponse>(\n 'unary',\n this.#transport,\n method,\n this.#transport.mergeOptions(options),\n input,\n );\n }\n}\n"]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { type RpcOptions, type RpcTransport, type UnaryCall } from '@protobuf-ts/runtime-rpc';
|
|
2
|
-
type CanActAs = {
|
|
3
|
-
party: string;
|
|
4
|
-
};
|
|
5
|
-
type Right = {
|
|
6
|
-
canActAs: CanActAs;
|
|
7
|
-
};
|
|
8
|
-
type GrantUserRightsRequest = {
|
|
9
|
-
userId: string;
|
|
10
|
-
rights: Right[];
|
|
11
|
-
identityProviderId: string;
|
|
12
|
-
};
|
|
13
|
-
type GrantUserRightsResponse = Record<string, never>;
|
|
14
|
-
/** Minimal gRPC client for `UserManagementService.GrantUserRights`. */
|
|
15
|
-
export declare class UserManagementServiceClient {
|
|
16
|
-
#private;
|
|
17
|
-
constructor(transport: RpcTransport);
|
|
18
|
-
grantUserRights(input: GrantUserRightsRequest, options?: RpcOptions): UnaryCall<GrantUserRightsRequest, GrantUserRightsResponse>;
|
|
19
|
-
}
|
|
20
|
-
export {};
|
|
21
|
-
//# sourceMappingURL=user-management.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"user-management.d.ts","sourceRoot":"","sources":["../../src/client/user-management.ts"],"names":[],"mappings":"AACA,OAAO,EAEH,KAAK,UAAU,EACf,KAAK,YAAY,EAGjB,KAAK,SAAS,EACjB,MAAM,0BAA0B,CAAC;AAIlC,KAAK,QAAQ,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAClC,KAAK,KAAK,GAAG;IAAE,QAAQ,EAAE,QAAQ,CAAA;CAAE,CAAC;AACpC,KAAK,sBAAsB,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,KAAK,EAAE,CAAC;IAAC,kBAAkB,EAAE,MAAM,CAAA;CAAE,CAAC;AAC9F,KAAK,uBAAuB,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAkCrD,uEAAuE;AACvE,qBAAa,2BAA2B;;gBAGxB,SAAS,EAAE,YAAY;IAInC,eAAe,CACX,KAAK,EAAE,sBAAsB,EAC7B,OAAO,CAAC,EAAE,UAAU,GACrB,SAAS,CAAC,sBAAsB,EAAE,uBAAuB,CAAC;CAahE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"user-management.js"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { MessageType, RepeatType, ScalarType } from '@protobuf-ts/runtime';
|
|
2
|
-
import {
|
|
3
|
-
type MethodInfo,
|
|
4
|
-
type RpcOptions,
|
|
5
|
-
type RpcTransport,
|
|
6
|
-
ServiceType,
|
|
7
|
-
stackIntercept,
|
|
8
|
-
type UnaryCall,
|
|
9
|
-
} from '@protobuf-ts/runtime-rpc';
|
|
10
|
-
|
|
11
|
-
const SERVICE_NAME = 'com.daml.ledger.api.v2.admin.UserManagementService';
|
|
12
|
-
|
|
13
|
-
type CanActAs = { party: string };
|
|
14
|
-
type Right = { canActAs: CanActAs };
|
|
15
|
-
type GrantUserRightsRequest = { userId: string; rights: Right[]; identityProviderId: string };
|
|
16
|
-
type GrantUserRightsResponse = Record<string, never>;
|
|
17
|
-
|
|
18
|
-
const canActAsMessage = new MessageType<CanActAs>('com.daml.ledger.api.v2.admin.Right.CanActAs', [
|
|
19
|
-
{ no: 1, name: 'party', kind: 'scalar', T: ScalarType.STRING },
|
|
20
|
-
]);
|
|
21
|
-
|
|
22
|
-
const rightMessage = new MessageType<Right>('com.daml.ledger.api.v2.admin.Right', [
|
|
23
|
-
{ no: 2, name: 'can_act_as', kind: 'message', T: () => canActAsMessage },
|
|
24
|
-
]);
|
|
25
|
-
|
|
26
|
-
const grantRequestMessage = new MessageType<GrantUserRightsRequest>(
|
|
27
|
-
'com.daml.ledger.api.v2.admin.GrantUserRightsRequest',
|
|
28
|
-
[
|
|
29
|
-
{ no: 1, name: 'user_id', kind: 'scalar', T: ScalarType.STRING },
|
|
30
|
-
{
|
|
31
|
-
no: 2,
|
|
32
|
-
name: 'rights',
|
|
33
|
-
kind: 'message',
|
|
34
|
-
repeat: RepeatType.UNPACKED,
|
|
35
|
-
T: () => rightMessage,
|
|
36
|
-
},
|
|
37
|
-
{ no: 3, name: 'identity_provider_id', kind: 'scalar', T: ScalarType.STRING },
|
|
38
|
-
],
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
const grantResponseMessage = new MessageType<GrantUserRightsResponse>(
|
|
42
|
-
'com.daml.ledger.api.v2.admin.GrantUserRightsResponse',
|
|
43
|
-
[],
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
const service = new ServiceType(SERVICE_NAME, [
|
|
47
|
-
{ name: 'GrantUserRights', options: {}, I: grantRequestMessage, O: grantResponseMessage },
|
|
48
|
-
]);
|
|
49
|
-
|
|
50
|
-
/** Minimal gRPC client for `UserManagementService.GrantUserRights`. */
|
|
51
|
-
export class UserManagementServiceClient {
|
|
52
|
-
readonly #transport: RpcTransport;
|
|
53
|
-
|
|
54
|
-
constructor(transport: RpcTransport) {
|
|
55
|
-
this.#transport = transport;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
grantUserRights(
|
|
59
|
-
input: GrantUserRightsRequest,
|
|
60
|
-
options?: RpcOptions,
|
|
61
|
-
): UnaryCall<GrantUserRightsRequest, GrantUserRightsResponse> {
|
|
62
|
-
const method = service.methods[0] as MethodInfo<
|
|
63
|
-
GrantUserRightsRequest,
|
|
64
|
-
GrantUserRightsResponse
|
|
65
|
-
>;
|
|
66
|
-
return stackIntercept<GrantUserRightsRequest, GrantUserRightsResponse>(
|
|
67
|
-
'unary',
|
|
68
|
-
this.#transport,
|
|
69
|
-
method,
|
|
70
|
-
this.#transport.mergeOptions(options),
|
|
71
|
-
input,
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
}
|