@distrohelena/canton-typescript-sdk 0.1.4 → 0.1.6

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.
Files changed (254) hide show
  1. package/README.md +333 -1
  2. package/dist/client/canton-client-options.d.ts +3 -0
  3. package/dist/client/canton-client-options.js +2 -0
  4. package/dist/client/service-registry.js +4 -3
  5. package/dist/core/errors/grpc-transport-error.d.ts +14 -0
  6. package/dist/core/errors/grpc-transport-error.js +76 -0
  7. package/dist/core/signing/sign-command-request.d.ts +4 -0
  8. package/dist/core/signing/sign-command-request.js +4 -0
  9. package/dist/core/signing/sign-command-result.d.ts +2 -0
  10. package/dist/core/signing/sign-command-result.js +9 -0
  11. package/dist/core/transports/transport.interface.d.ts +2 -2
  12. package/dist/core/types/canton-hash-purpose.d.ts +2 -1
  13. package/dist/core/types/canton-hash-purpose.js +1 -0
  14. package/dist/core/types/commands/create-and-exercise-command.js +1 -1
  15. package/dist/core/types/commands/exercise-by-key-command.js +2 -2
  16. package/dist/core/types/commands/exercise-command.js +2 -2
  17. package/dist/core/types/daml-numeric.d.ts +6 -0
  18. package/dist/core/types/daml-numeric.js +14 -0
  19. package/dist/core/types/daml-party.d.ts +6 -0
  20. package/dist/core/types/daml-party.js +14 -0
  21. package/dist/core/types/requests/create-decentralized-party-request.d.ts +41 -0
  22. package/dist/core/types/requests/create-decentralized-party-request.js +82 -0
  23. package/dist/core/types/requests/create-external-party-request.d.ts +42 -0
  24. package/dist/core/types/requests/create-external-party-request.js +47 -0
  25. package/dist/core/types/requests/finalize-decentralized-party-request.d.ts +39 -0
  26. package/dist/core/types/requests/finalize-decentralized-party-request.js +42 -0
  27. package/dist/core/types/requests/get-active-contracts-page-request.d.ts +15 -2
  28. package/dist/core/types/requests/get-active-contracts-page-request.js +4 -0
  29. package/dist/core/types/requests/submit-command-request.d.ts +2 -0
  30. package/dist/core/types/requests/submit-command-request.js +2 -0
  31. package/dist/core/types/topology/topology-signature-format.d.ts +2 -1
  32. package/dist/core/types/topology/topology-signature-format.js +1 -0
  33. package/dist/daml-lf/container/dar-archive-entry.d.ts +8 -0
  34. package/dist/daml-lf/container/dar-archive-entry.js +8 -0
  35. package/dist/daml-lf/container/dar-archive-loader.js +14 -0
  36. package/dist/daml-lf/container/dar-archive.d.ts +6 -0
  37. package/dist/daml-lf/container/dar-archive.js +4 -0
  38. package/dist/daml-lf/container/dar-source-bundle-loader.d.ts +5 -0
  39. package/dist/daml-lf/container/dar-source-bundle-loader.js +33 -0
  40. package/dist/daml-lf/container/dar-source-bundle.d.ts +45 -0
  41. package/dist/daml-lf/container/dar-source-bundle.js +11 -0
  42. package/dist/daml-lf/container/dar-source-file-entry.d.ts +8 -0
  43. package/dist/daml-lf/container/dar-source-file-entry.js +8 -0
  44. package/dist/daml-lf/daml-lf-compilation.d.ts +12 -0
  45. package/dist/daml-lf/daml-lf-compilation.js +35 -0
  46. package/dist/daml-lf/index.d.ts +11 -0
  47. package/dist/daml-lf/index.js +10 -0
  48. package/dist/daml-lf/interpreter/daml-lf-builtin-dispatch.d.ts +43 -0
  49. package/dist/daml-lf/interpreter/daml-lf-builtin-dispatch.js +933 -0
  50. package/dist/daml-lf/interpreter/daml-lf-evaluator.d.ts +95 -0
  51. package/dist/daml-lf/interpreter/daml-lf-evaluator.js +1131 -0
  52. package/dist/daml-lf/interpreter/daml-lf-interpreter-scaffold.d.ts +3 -0
  53. package/dist/daml-lf/interpreter/daml-lf-interpreter-scaffold.js +6 -1
  54. package/dist/daml-lf/interpreter/daml-lf-lexical-scope.d.ts +13 -0
  55. package/dist/daml-lf/interpreter/daml-lf-lexical-scope.js +46 -0
  56. package/dist/daml-lf/interpreter/daml-lf-runtime-frame.d.ts +16 -0
  57. package/dist/daml-lf/interpreter/daml-lf-runtime-frame.js +15 -0
  58. package/dist/daml-lf/interpreter/daml-lf-runtime-value.d.ts +21 -0
  59. package/dist/daml-lf/interpreter/daml-lf-runtime-value.js +4 -1
  60. package/dist/daml-lf/interpreter/daml-lf-step-kind.d.ts +7 -0
  61. package/dist/daml-lf/interpreter/daml-lf-step-kind.js +8 -0
  62. package/dist/daml-lf/interpreter/daml-lf-trace-sink.interface.d.ts +30 -0
  63. package/dist/daml-lf/interpreter/daml-lf-trace-sink.interface.js +1 -0
  64. package/dist/daml-lf/model/daml-lf-builtin-type.d.ts +3 -0
  65. package/dist/daml-lf/model/daml-lf-builtin-type.js +3 -0
  66. package/dist/daml-lf/model/daml-lf-choice.d.ts +5 -0
  67. package/dist/daml-lf/model/daml-lf-choice.js +4 -0
  68. package/dist/daml-lf/model/daml-lf-expression-path.d.ts +2 -0
  69. package/dist/daml-lf/model/daml-lf-expression-path.js +81 -0
  70. package/dist/daml-lf/model/daml-lf-expression.d.ts +146 -0
  71. package/dist/daml-lf/model/daml-lf-expression.js +71 -0
  72. package/dist/daml-lf/model/daml-lf-template.d.ts +2 -0
  73. package/dist/daml-lf/model/daml-lf-template.js +2 -0
  74. package/dist/daml-lf/model/daml-lf-type.d.ts +2 -0
  75. package/dist/daml-lf/model/daml-lf-type.js +4 -0
  76. package/dist/daml-lf/model/lf-2-model-mapper.d.ts +5 -0
  77. package/dist/daml-lf/model/lf-2-model-mapper.js +445 -12
  78. package/dist/debugger/errors/replay-determinism.exception.d.ts +3 -0
  79. package/dist/debugger/errors/replay-determinism.exception.js +3 -0
  80. package/dist/debugger/errors/replay-missing-package.exception.d.ts +3 -0
  81. package/dist/debugger/errors/replay-missing-package.exception.js +3 -0
  82. package/dist/debugger/errors/replay-missing-source.exception.d.ts +3 -0
  83. package/dist/debugger/errors/replay-missing-source.exception.js +3 -0
  84. package/dist/debugger/errors/replay-source-map.exception.d.ts +3 -0
  85. package/dist/debugger/errors/replay-source-map.exception.js +3 -0
  86. package/dist/debugger/errors/replay-state-hydration.exception.d.ts +3 -0
  87. package/dist/debugger/errors/replay-state-hydration.exception.js +3 -0
  88. package/dist/debugger/errors/replay-unsupported-lf-construct.exception.d.ts +3 -0
  89. package/dist/debugger/errors/replay-unsupported-lf-construct.exception.js +3 -0
  90. package/dist/debugger/errors/replay-unsupported-update.exception.d.ts +3 -0
  91. package/dist/debugger/errors/replay-unsupported-update.exception.js +3 -0
  92. package/dist/debugger/index.d.ts +31 -0
  93. package/dist/debugger/index.js +31 -0
  94. package/dist/debugger/ledger-replay-debugger-client.d.ts +31 -0
  95. package/dist/debugger/ledger-replay-debugger-client.js +53 -0
  96. package/dist/debugger/replay/ledger-replay-environment-builder.d.ts +95 -0
  97. package/dist/debugger/replay/ledger-replay-environment-builder.js +249 -0
  98. package/dist/debugger/replay/ledger-replay-session-loader.d.ts +78 -0
  99. package/dist/debugger/replay/ledger-replay-session-loader.js +565 -0
  100. package/dist/debugger/replay/replay-artifact-resolver.d.ts +30 -0
  101. package/dist/debugger/replay/replay-artifact-resolver.js +210 -0
  102. package/dist/debugger/replay/replay-determinism-validator.d.ts +12 -0
  103. package/dist/debugger/replay/replay-determinism-validator.js +161 -0
  104. package/dist/debugger/replay/replay-entrypoint-definition-resolver.d.ts +40 -0
  105. package/dist/debugger/replay/replay-entrypoint-definition-resolver.js +337 -0
  106. package/dist/debugger/replay/replay-entrypoint.d.ts +22 -0
  107. package/dist/debugger/replay/replay-entrypoint.js +14 -0
  108. package/dist/debugger/replay/replay-ledger-value-normalizer.d.ts +7 -0
  109. package/dist/debugger/replay/replay-ledger-value-normalizer.js +194 -0
  110. package/dist/debugger/replay/replay-update-loader.d.ts +24 -0
  111. package/dist/debugger/replay/replay-update-loader.js +94 -0
  112. package/dist/debugger/replay/replay-update-visibility-validator.d.ts +19 -0
  113. package/dist/debugger/replay/replay-update-visibility-validator.js +19 -0
  114. package/dist/debugger/session/in-memory-replay-session-store.d.ts +27 -0
  115. package/dist/debugger/session/in-memory-replay-session-store.js +109 -0
  116. package/dist/debugger/session/replay-phase.d.ts +7 -0
  117. package/dist/debugger/session/replay-phase.js +8 -0
  118. package/dist/debugger/session/replay-scope.d.ts +10 -0
  119. package/dist/debugger/session/replay-scope.js +10 -0
  120. package/dist/debugger/session/replay-session-metadata.d.ts +10 -0
  121. package/dist/debugger/session/replay-session-metadata.js +10 -0
  122. package/dist/debugger/session/replay-session-request.d.ts +6 -0
  123. package/dist/debugger/session/replay-session-request.js +10 -0
  124. package/dist/debugger/session/replay-session.d.ts +12 -0
  125. package/dist/debugger/session/replay-session.js +10 -0
  126. package/dist/debugger/session/replay-source-location.d.ts +17 -0
  127. package/dist/debugger/session/replay-source-location.js +16 -0
  128. package/dist/debugger/session/replay-stack-frame.d.ts +8 -0
  129. package/dist/debugger/session/replay-stack-frame.js +8 -0
  130. package/dist/debugger/session/replay-state-delta.d.ts +29 -0
  131. package/dist/debugger/session/replay-state-delta.js +24 -0
  132. package/dist/debugger/session/replay-step-advance-result.d.ts +24 -0
  133. package/dist/debugger/session/replay-step-advance-result.js +16 -0
  134. package/dist/debugger/session/replay-step.d.ts +30 -0
  135. package/dist/debugger/session/replay-step.js +24 -0
  136. package/dist/debugger/session/replay-value-preview.d.ts +8 -0
  137. package/dist/debugger/session/replay-value-preview.js +15 -0
  138. package/dist/debugger/source/daml-source-mapper.d.ts +12 -0
  139. package/dist/debugger/source/daml-source-mapper.js +21 -0
  140. package/dist/debugger/source/dar-source-map-metadata.d.ts +26 -0
  141. package/dist/debugger/source/dar-source-map-metadata.js +10 -0
  142. package/dist/debugger/source/source-coverage-validator.d.ts +8 -0
  143. package/dist/debugger/source/source-coverage-validator.js +16 -0
  144. package/dist/debugger/source/source-indexed-compilation.d.ts +45 -0
  145. package/dist/debugger/source/source-indexed-compilation.js +110 -0
  146. package/dist/debugger/source/source-mapping-precision.d.ts +5 -0
  147. package/dist/debugger/source/source-mapping-precision.js +4 -0
  148. package/dist/index.d.ts +20 -0
  149. package/dist/index.js +12 -0
  150. package/dist/query/cache/memory-query-cache.d.ts +9 -0
  151. package/dist/query/cache/memory-query-cache.js +24 -0
  152. package/dist/query/cache/query-cache-store.d.ts +5 -0
  153. package/dist/query/cache/query-cache-store.js +1 -0
  154. package/dist/query/canton-manager-options.d.ts +17 -0
  155. package/dist/query/canton-manager-options.js +1 -0
  156. package/dist/query/canton-manager.d.ts +11 -0
  157. package/dist/query/canton-manager.js +42 -0
  158. package/dist/query/errors/pqs-query-error.d.ts +10 -0
  159. package/dist/query/errors/pqs-query-error.js +11 -0
  160. package/dist/query/errors/pqs-schema-profile-error.d.ts +3 -0
  161. package/dist/query/errors/pqs-schema-profile-error.js +3 -0
  162. package/dist/query/errors/query-capability-error.d.ts +7 -0
  163. package/dist/query/errors/query-capability-error.js +10 -0
  164. package/dist/query/grpc/grpc-contract-query-client.d.ts +32 -0
  165. package/dist/query/grpc/grpc-contract-query-client.js +126 -0
  166. package/dist/query/model-types.d.ts +258 -0
  167. package/dist/query/model-types.js +14 -0
  168. package/dist/query/pqs/pqs-pool.d.ts +13 -0
  169. package/dist/query/pqs/pqs-pool.js +18 -0
  170. package/dist/query/pqs/pqs-query-client.d.ts +49 -0
  171. package/dist/query/pqs/pqs-query-client.js +324 -0
  172. package/dist/query/pqs/pqs-schema-profile.d.ts +25 -0
  173. package/dist/query/pqs/pqs-schema-profile.js +120 -0
  174. package/dist/query/pqs/pqs-sql-compiler.d.ts +7 -0
  175. package/dist/query/pqs/pqs-sql-compiler.js +132 -0
  176. package/dist/query/pqs/read-only-sql.d.ts +1 -0
  177. package/dist/query/pqs/read-only-sql.js +35 -0
  178. package/dist/query/query-client.d.ts +61 -0
  179. package/dist/query/query-client.js +1 -0
  180. package/dist/query/query-source.d.ts +4 -0
  181. package/dist/query/query-source.js +5 -0
  182. package/dist/services/commands/command-payload-builder.js +3 -3
  183. package/dist/services/commands/command-submission-pipeline.js +1 -7
  184. package/dist/services/party-management/decentralized-party-lifecycle.d.ts +6 -0
  185. package/dist/services/party-management/decentralized-party-lifecycle.js +82 -0
  186. package/dist/services/party-management/party-management-service-client.d.ts +16 -1
  187. package/dist/services/party-management/party-management-service-client.js +142 -1
  188. package/dist/services/topology-manager-write/topology-signed-transaction-assembler.js +4 -0
  189. package/dist/testing/campaign/campaign-artifact.d.ts +20 -0
  190. package/dist/testing/campaign/campaign-artifact.js +147 -0
  191. package/dist/testing/campaign/campaign-definition.d.ts +9 -0
  192. package/dist/testing/campaign/campaign-definition.js +78 -0
  193. package/dist/testing/campaign/campaign-metrics.d.ts +32 -0
  194. package/dist/testing/campaign/campaign-metrics.js +26 -0
  195. package/dist/testing/campaign/campaign-model.d.ts +11 -0
  196. package/dist/testing/campaign/campaign-model.js +21 -0
  197. package/dist/testing/campaign/campaign-runner.d.ts +99 -0
  198. package/dist/testing/campaign/campaign-runner.js +194 -0
  199. package/dist/testing/campaign/campaign-scheduler.d.ts +40 -0
  200. package/dist/testing/campaign/campaign-scheduler.js +75 -0
  201. package/dist/testing/campaign/campaign-types.d.ts +52 -0
  202. package/dist/testing/campaign/campaign-types.js +11 -0
  203. package/dist/testing/daml/daml-action-arbitrary.d.ts +13 -0
  204. package/dist/testing/daml/daml-action-arbitrary.js +24 -0
  205. package/dist/testing/daml/daml-choice-action-arbitrary.d.ts +18 -0
  206. package/dist/testing/daml/daml-choice-action-arbitrary.js +27 -0
  207. package/dist/testing/daml/daml-create-action-arbitrary.d.ts +19 -0
  208. package/dist/testing/daml/daml-create-action-arbitrary.js +34 -0
  209. package/dist/testing/daml/daml-testing-catalog.d.ts +38 -0
  210. package/dist/testing/daml/daml-testing-catalog.js +40 -0
  211. package/dist/testing/daml/daml-value-arbitrary.d.ts +8 -0
  212. package/dist/testing/daml/daml-value-arbitrary.js +43 -0
  213. package/dist/testing/daml/declarative-campaign-arbitrary.d.ts +15 -0
  214. package/dist/testing/daml/declarative-campaign-arbitrary.js +30 -0
  215. package/dist/testing/errors/invariant-campaign-failure.d.ts +24 -0
  216. package/dist/testing/errors/invariant-campaign-failure.js +37 -0
  217. package/dist/testing/errors/testing-configuration-error.d.ts +3 -0
  218. package/dist/testing/errors/testing-configuration-error.js +6 -0
  219. package/dist/testing/handlers/handler.d.ts +19 -0
  220. package/dist/testing/handlers/handler.js +31 -0
  221. package/dist/testing/index.d.ts +22 -0
  222. package/dist/testing/index.js +22 -0
  223. package/dist/testing/runtime/campaign-isolation.d.ts +14 -0
  224. package/dist/testing/runtime/campaign-isolation.js +23 -0
  225. package/dist/testing/runtime/canton-test-runtime.d.ts +58 -0
  226. package/dist/testing/runtime/canton-test-runtime.js +138 -0
  227. package/dist/testing/runtime/declarative-action-executor.d.ts +16 -0
  228. package/dist/testing/runtime/declarative-action-executor.js +41 -0
  229. package/dist/testing/targets/target.d.ts +49 -0
  230. package/dist/testing/targets/target.js +121 -0
  231. package/dist/transports/grpc/grpc-channel-factory.d.ts +4 -0
  232. package/dist/transports/grpc/grpc-channel-factory.js +42 -1
  233. package/dist/transports/grpc/grpc-transport.d.ts +2 -2
  234. package/dist/transports/grpc/grpc-transport.js +42 -3
  235. package/dist/transports/grpc/mappers/commands-mapper.d.ts +10 -2
  236. package/dist/transports/grpc/mappers/commands-mapper.js +30 -12
  237. package/dist/transports/grpc/mappers/contracts-mapper.d.ts +3 -1
  238. package/dist/transports/grpc/mappers/contracts-mapper.js +16 -3
  239. package/dist/transports/grpc/mappers/interactive-command-mapper.d.ts +15 -0
  240. package/dist/transports/grpc/mappers/interactive-command-mapper.js +54 -0
  241. package/dist/transports/grpc/mappers/topology-manager-write-mapper.js +59 -1
  242. package/dist/transports/json/json-transport.d.ts +2 -2
  243. package/dist/transports/json/json-transport.js +2 -2
  244. package/dist/transports/json/mappers/commands-mapper.js +23 -9
  245. package/node/.generated/start-local/additional-config.extra-participants.conf +37 -0
  246. package/node/.generated/start-local/additional-config.extra-validators.conf +35 -0
  247. package/node/.generated/start-local/compose-extra-participants.yaml +147 -0
  248. package/node/.generated/start-local/extra-participants.env +30 -0
  249. package/node/es256-jwt.mjs +177 -0
  250. package/node/start-local.sh +886 -0
  251. package/node/stop-local.sh +200 -0
  252. package/node/test-start-local.sh +354 -0
  253. package/node/test-stop-local.sh +112 -0
  254. package/package.json +21 -2
@@ -8,10 +8,10 @@ export class ExerciseCommand {
8
8
  if (!init.templateId) {
9
9
  throw new ValidationError("exercise commands require a templateId");
10
10
  }
11
- if (!init.contractId) {
11
+ else if (!init.contractId) {
12
12
  throw new ValidationError("exercise commands require a contractId");
13
13
  }
14
- if (!init.choice) {
14
+ else if (!init.choice) {
15
15
  throw new ValidationError("exercise commands require a choice");
16
16
  }
17
17
  this.templateId = init.templateId;
@@ -0,0 +1,6 @@
1
+ /** Exact decimal DAML Numeric value, encoded without floating-point rounding. */
2
+ export declare class DamlNumeric {
3
+ readonly value: string;
4
+ constructor(value: string);
5
+ toJSON(): string;
6
+ }
@@ -0,0 +1,14 @@
1
+ import { ValidationError } from "../errors/validation-error.js";
2
+ /** Exact decimal DAML Numeric value, encoded without floating-point rounding. */
3
+ export class DamlNumeric {
4
+ value;
5
+ constructor(value) {
6
+ if (!/^-?(?:0|[1-9]\d*)(?:\.\d+)?$/.test(value)) {
7
+ throw new ValidationError("DAML numeric values must be exact decimal strings");
8
+ }
9
+ this.value = value;
10
+ }
11
+ toJSON() {
12
+ return this.value;
13
+ }
14
+ }
@@ -0,0 +1,6 @@
1
+ /** Explicit DAML Party value for commands whose field type is Party, not Text. */
2
+ export declare class DamlParty {
3
+ readonly value: string;
4
+ constructor(value: string);
5
+ toJSON(): string;
6
+ }
@@ -0,0 +1,14 @@
1
+ import { ValidationError } from "../errors/validation-error.js";
2
+ /** Explicit DAML Party value for commands whose field type is Party, not Text. */
3
+ export class DamlParty {
4
+ value;
5
+ constructor(value) {
6
+ if (value.length === 0) {
7
+ throw new ValidationError("DAML party values must not be empty");
8
+ }
9
+ this.value = value;
10
+ }
11
+ toJSON() {
12
+ return this.value;
13
+ }
14
+ }
@@ -0,0 +1,41 @@
1
+ import { ExternalPartySigningPublicKey } from "../external-party/external-party-signing-public-key.js";
2
+ import { ExternalPartySigningRequest, ExternalPartySigningResult } from "./create-external-party-request.js";
3
+ export interface DecentralizedPartyKey {
4
+ readonly publicKey: ExternalPartySigningPublicKey;
5
+ readonly sign?: DecentralizedPartySigner;
6
+ }
7
+ export interface DecentralizedPartySigningRequest extends ExternalPartySigningRequest {
8
+ readonly role: "owner" | "partySigningKey";
9
+ readonly transactionHash: Uint8Array;
10
+ }
11
+ export type DecentralizedPartySigner = (request: DecentralizedPartySigningRequest) => Promise<ExternalPartySigningResult>;
12
+ export declare class CreateDecentralizedPartyRequest {
13
+ readonly synchronizer: string;
14
+ readonly partyHint: string;
15
+ readonly owners: readonly DecentralizedPartyKey[];
16
+ readonly ownerThreshold: number;
17
+ readonly partySigningKeys: readonly DecentralizedPartyKey[];
18
+ readonly partySigningThreshold: number;
19
+ readonly localParticipantObservationOnly: boolean;
20
+ readonly otherConfirmingParticipantUids: readonly string[];
21
+ readonly confirmationThreshold: number;
22
+ readonly observingParticipantUids: readonly string[];
23
+ readonly identityProviderId?: string;
24
+ readonly waitForAllocation?: boolean;
25
+ readonly userId?: string;
26
+ constructor(init: {
27
+ synchronizer?: string;
28
+ partyHint?: string;
29
+ owners?: readonly DecentralizedPartyKey[];
30
+ ownerThreshold?: number;
31
+ partySigningKeys?: readonly DecentralizedPartyKey[];
32
+ partySigningThreshold?: number;
33
+ localParticipantObservationOnly?: boolean;
34
+ otherConfirmingParticipantUids?: readonly string[];
35
+ confirmationThreshold?: number;
36
+ observingParticipantUids?: readonly string[];
37
+ identityProviderId?: string;
38
+ waitForAllocation?: boolean;
39
+ userId?: string;
40
+ });
41
+ }
@@ -0,0 +1,82 @@
1
+ import { ValidationError } from "../../errors/validation-error.js";
2
+ import { computeCantonPublicKeyFingerprint } from "../../hashing/canton-hash.js";
3
+ import { ExternalPartySigningPublicKey } from "../external-party/external-party-signing-public-key.js";
4
+ export class CreateDecentralizedPartyRequest {
5
+ synchronizer;
6
+ partyHint;
7
+ owners;
8
+ ownerThreshold;
9
+ partySigningKeys;
10
+ partySigningThreshold;
11
+ localParticipantObservationOnly;
12
+ otherConfirmingParticipantUids;
13
+ confirmationThreshold;
14
+ observingParticipantUids;
15
+ identityProviderId;
16
+ waitForAllocation;
17
+ userId;
18
+ constructor(init) {
19
+ const owners = [...(init.owners ?? [])];
20
+ const partySigningKeys = [...(init.partySigningKeys ?? [])];
21
+ if (init.synchronizer === undefined || init.synchronizer.length === 0) {
22
+ throw new ValidationError("decentralized party creation requires a synchronizer");
23
+ }
24
+ else if (init.partyHint === undefined || init.partyHint.length === 0) {
25
+ throw new ValidationError("decentralized party creation requires a party hint");
26
+ }
27
+ else if (owners.length < 2) {
28
+ throw new ValidationError("decentralized party creation requires at least two unique owner keys");
29
+ }
30
+ else if (partySigningKeys.length === 0) {
31
+ throw new ValidationError("decentralized party creation requires at least one party signing key");
32
+ }
33
+ else if (init.ownerThreshold === undefined) {
34
+ throw new ValidationError("decentralized party creation requires an owner threshold");
35
+ }
36
+ else if (init.partySigningThreshold === undefined) {
37
+ throw new ValidationError("decentralized party creation requires a party signing threshold");
38
+ }
39
+ else if (init.ownerThreshold < 1 || init.ownerThreshold > owners.length) {
40
+ throw new ValidationError("decentralized party owner threshold must be within the owner key count");
41
+ }
42
+ else if (init.partySigningThreshold < 1 || init.partySigningThreshold > partySigningKeys.length) {
43
+ throw new ValidationError("decentralized party signing threshold must be within the party signing key count");
44
+ }
45
+ validateUniqueKeys(owners, "owner");
46
+ validateUniqueKeys(partySigningKeys, "party signing");
47
+ this.synchronizer = init.synchronizer;
48
+ this.partyHint = init.partyHint;
49
+ this.owners = owners.map(cloneKey);
50
+ this.ownerThreshold = init.ownerThreshold;
51
+ this.partySigningKeys = partySigningKeys.map(cloneKey);
52
+ this.partySigningThreshold = init.partySigningThreshold;
53
+ this.localParticipantObservationOnly = init.localParticipantObservationOnly ?? false;
54
+ this.otherConfirmingParticipantUids = [...(init.otherConfirmingParticipantUids ?? [])];
55
+ this.confirmationThreshold = init.confirmationThreshold ?? 0;
56
+ this.observingParticipantUids = [...(init.observingParticipantUids ?? [])];
57
+ this.identityProviderId = init.identityProviderId;
58
+ this.waitForAllocation = init.waitForAllocation;
59
+ this.userId = init.userId;
60
+ }
61
+ }
62
+ function cloneKey(value) {
63
+ return {
64
+ publicKey: new ExternalPartySigningPublicKey({
65
+ format: value.publicKey.format,
66
+ keyData: value.publicKey.keyData,
67
+ keySpec: value.publicKey.keySpec,
68
+ }),
69
+ sign: value.sign,
70
+ };
71
+ }
72
+ function validateUniqueKeys(values, label) {
73
+ const fingerprints = values.map((value) => {
74
+ if (value.publicKey.keyData.length === 0) {
75
+ throw new ValidationError(`decentralized party ${label} key requires public key material`);
76
+ }
77
+ return computeCantonPublicKeyFingerprint(value.publicKey.keyData, value.publicKey.format);
78
+ });
79
+ if (new Set(fingerprints).size !== fingerprints.length) {
80
+ throw new ValidationError(`decentralized party ${label} keys must be unique`);
81
+ }
82
+ }
@@ -0,0 +1,42 @@
1
+ import { ExternalPartySignatureFormat } from "../external-party/external-party-signature-format.js";
2
+ import { ExternalPartySigningAlgorithmSpec } from "../external-party/external-party-signing-algorithm-spec.js";
3
+ import { ExternalPartySigningPublicKey } from "../external-party/external-party-signing-public-key.js";
4
+ export type ExternalPartySigningPayloadKind = "topology-transaction" | "multi-hash";
5
+ export interface ExternalPartySigningRequest {
6
+ readonly payload: Uint8Array;
7
+ readonly kind: ExternalPartySigningPayloadKind;
8
+ readonly partyId: string;
9
+ readonly publicKeyFingerprint: string;
10
+ }
11
+ export interface ExternalPartySigningResult {
12
+ readonly signature: Uint8Array;
13
+ readonly format: ExternalPartySignatureFormat;
14
+ readonly signingAlgorithmSpec: ExternalPartySigningAlgorithmSpec;
15
+ }
16
+ export type ExternalPartySigner = (request: ExternalPartySigningRequest) => Promise<ExternalPartySigningResult>;
17
+ export declare class CreateExternalPartyRequest {
18
+ readonly synchronizer: string;
19
+ readonly partyHint: string;
20
+ readonly publicKey: ExternalPartySigningPublicKey;
21
+ readonly localParticipantObservationOnly: boolean;
22
+ readonly otherConfirmingParticipantUids: readonly string[];
23
+ readonly confirmationThreshold: number;
24
+ readonly observingParticipantUids: readonly string[];
25
+ readonly identityProviderId?: string;
26
+ readonly waitForAllocation?: boolean;
27
+ readonly userId?: string;
28
+ readonly sign: ExternalPartySigner;
29
+ constructor(init: {
30
+ synchronizer?: string;
31
+ partyHint?: string;
32
+ publicKey?: ExternalPartySigningPublicKey;
33
+ localParticipantObservationOnly?: boolean;
34
+ otherConfirmingParticipantUids?: readonly string[];
35
+ confirmationThreshold?: number;
36
+ observingParticipantUids?: readonly string[];
37
+ identityProviderId?: string;
38
+ waitForAllocation?: boolean;
39
+ userId?: string;
40
+ sign?: ExternalPartySigner;
41
+ });
42
+ }
@@ -0,0 +1,47 @@
1
+ import { ValidationError } from "../../errors/validation-error.js";
2
+ import { ExternalPartySigningPublicKey } from "../external-party/external-party-signing-public-key.js";
3
+ export class CreateExternalPartyRequest {
4
+ synchronizer;
5
+ partyHint;
6
+ publicKey;
7
+ localParticipantObservationOnly;
8
+ otherConfirmingParticipantUids;
9
+ confirmationThreshold;
10
+ observingParticipantUids;
11
+ identityProviderId;
12
+ waitForAllocation;
13
+ userId;
14
+ sign;
15
+ constructor(init) {
16
+ if (init.synchronizer === undefined || init.synchronizer.length === 0) {
17
+ throw new ValidationError("external party creation requires a synchronizer");
18
+ }
19
+ else if (init.partyHint === undefined || init.partyHint.length === 0) {
20
+ throw new ValidationError("external party creation requires a party hint");
21
+ }
22
+ else if (init.publicKey === undefined || init.publicKey.keyData.length === 0) {
23
+ throw new ValidationError("external party creation requires public key material");
24
+ }
25
+ else if (init.sign === undefined) {
26
+ throw new ValidationError("external party creation requires a signer");
27
+ }
28
+ this.synchronizer = init.synchronizer;
29
+ this.partyHint = init.partyHint;
30
+ this.publicKey = new ExternalPartySigningPublicKey({
31
+ format: init.publicKey.format,
32
+ keyData: init.publicKey.keyData,
33
+ keySpec: init.publicKey.keySpec,
34
+ });
35
+ this.localParticipantObservationOnly =
36
+ init.localParticipantObservationOnly ?? false;
37
+ this.otherConfirmingParticipantUids = [
38
+ ...(init.otherConfirmingParticipantUids ?? []),
39
+ ];
40
+ this.confirmationThreshold = init.confirmationThreshold ?? 0;
41
+ this.observingParticipantUids = [...(init.observingParticipantUids ?? [])];
42
+ this.identityProviderId = init.identityProviderId;
43
+ this.waitForAllocation = init.waitForAllocation;
44
+ this.userId = init.userId;
45
+ this.sign = init.sign;
46
+ }
47
+ }
@@ -0,0 +1,39 @@
1
+ import { PreparedTopologyTransaction } from "../topology/prepared-topology-transaction.js";
2
+ import { ExternalPartySigningResult } from "./create-external-party-request.js";
3
+ export interface PreparedDecentralizedPartySigningRequest {
4
+ readonly id: string;
5
+ readonly transactionHash: Uint8Array;
6
+ readonly payload: Uint8Array;
7
+ readonly publicKeyFingerprint: string;
8
+ readonly role: "owner" | "partySigningKey";
9
+ }
10
+ export declare class PreparedDecentralizedParty {
11
+ readonly synchronizer: string;
12
+ readonly partyId: string;
13
+ readonly decentralizedNamespace: string;
14
+ readonly ownerThreshold: number;
15
+ readonly partySigningThreshold: number;
16
+ readonly transactions: readonly PreparedTopologyTransaction[];
17
+ readonly signingRequests: readonly PreparedDecentralizedPartySigningRequest[];
18
+ constructor(init: {
19
+ synchronizer: string;
20
+ partyId: string;
21
+ decentralizedNamespace: string;
22
+ ownerThreshold: number;
23
+ partySigningThreshold: number;
24
+ transactions?: readonly PreparedTopologyTransaction[];
25
+ signingRequests?: readonly PreparedDecentralizedPartySigningRequest[];
26
+ });
27
+ }
28
+ export interface DecentralizedPartyDetachedSignature {
29
+ readonly signingRequestId: string;
30
+ readonly result: ExternalPartySigningResult;
31
+ }
32
+ export declare class FinalizeDecentralizedPartyRequest {
33
+ readonly prepared: PreparedDecentralizedParty;
34
+ readonly signatures: readonly DecentralizedPartyDetachedSignature[];
35
+ constructor(init: {
36
+ prepared: PreparedDecentralizedParty;
37
+ signatures?: readonly DecentralizedPartyDetachedSignature[];
38
+ });
39
+ }
@@ -0,0 +1,42 @@
1
+ import { PreparedTopologyTransaction } from "../topology/prepared-topology-transaction.js";
2
+ export class PreparedDecentralizedParty {
3
+ synchronizer;
4
+ partyId;
5
+ decentralizedNamespace;
6
+ ownerThreshold;
7
+ partySigningThreshold;
8
+ transactions;
9
+ signingRequests;
10
+ constructor(init) {
11
+ this.synchronizer = init.synchronizer;
12
+ this.partyId = init.partyId;
13
+ this.decentralizedNamespace = init.decentralizedNamespace;
14
+ this.ownerThreshold = init.ownerThreshold;
15
+ this.partySigningThreshold = init.partySigningThreshold;
16
+ this.transactions = [...(init.transactions ?? [])].map((transaction) => new PreparedTopologyTransaction({
17
+ serializedTransaction: transaction.serializedTransaction,
18
+ transactionHash: transaction.transactionHash,
19
+ proposal: transaction.proposal,
20
+ }));
21
+ this.signingRequests = [...(init.signingRequests ?? [])].map((request) => ({
22
+ ...request,
23
+ transactionHash: new Uint8Array(request.transactionHash),
24
+ payload: new Uint8Array(request.payload),
25
+ }));
26
+ }
27
+ }
28
+ export class FinalizeDecentralizedPartyRequest {
29
+ prepared;
30
+ signatures;
31
+ constructor(init) {
32
+ this.prepared = init.prepared;
33
+ this.signatures = [...(init.signatures ?? [])].map((signature) => ({
34
+ signingRequestId: signature.signingRequestId,
35
+ result: {
36
+ signature: new Uint8Array(signature.result.signature),
37
+ format: signature.result.format,
38
+ signingAlgorithmSpec: signature.result.signingAlgorithmSpec,
39
+ },
40
+ }));
41
+ }
42
+ }
@@ -1,5 +1,7 @@
1
1
  export declare class GetActiveContractsPageRequest {
2
- readonly party: string;
2
+ readonly party?: string;
3
+ readonly parties?: readonly string[];
4
+ readonly allParties?: boolean;
3
5
  readonly templateId?: string;
4
6
  readonly interfaceId?: string;
5
7
  readonly includeInterfaceView?: boolean;
@@ -7,8 +9,19 @@ export declare class GetActiveContractsPageRequest {
7
9
  readonly activeAtOffset?: string;
8
10
  readonly maxPageSize?: number;
9
11
  readonly pageToken?: Uint8Array;
10
- constructor(init: {
12
+ constructor(init: ({
11
13
  party: string;
14
+ parties?: never;
15
+ allParties?: never;
16
+ } | {
17
+ party?: never;
18
+ parties: readonly string[];
19
+ allParties?: never;
20
+ } | {
21
+ party?: never;
22
+ parties?: never;
23
+ allParties: true;
24
+ }) & {
12
25
  templateId?: string;
13
26
  interfaceId?: string;
14
27
  includeInterfaceView?: boolean;
@@ -1,5 +1,7 @@
1
1
  export class GetActiveContractsPageRequest {
2
2
  party;
3
+ parties;
4
+ allParties;
3
5
  templateId;
4
6
  interfaceId;
5
7
  includeInterfaceView;
@@ -9,6 +11,8 @@ export class GetActiveContractsPageRequest {
9
11
  pageToken;
10
12
  constructor(init) {
11
13
  this.party = init.party;
14
+ this.parties = init.parties;
15
+ this.allParties = init.allParties;
12
16
  this.templateId = init.templateId;
13
17
  this.interfaceId = init.interfaceId;
14
18
  this.includeInterfaceView = init.includeInterfaceView;
@@ -1,11 +1,13 @@
1
1
  import { LedgerCommand } from "../commands/ledger-command.js";
2
2
  export declare class SubmitCommandRequest {
3
3
  readonly applicationId: string;
4
+ readonly userId?: string;
4
5
  readonly actAs: readonly string[];
5
6
  readonly readAs: readonly string[];
6
7
  readonly command: LedgerCommand;
7
8
  constructor(init: {
8
9
  applicationId: string;
10
+ userId?: string;
9
11
  actAs: readonly string[];
10
12
  readAs?: readonly string[];
11
13
  command: LedgerCommand;
@@ -1,6 +1,7 @@
1
1
  import { ValidationError } from "../../errors/validation-error.js";
2
2
  export class SubmitCommandRequest {
3
3
  applicationId;
4
+ userId;
4
5
  actAs;
5
6
  readAs;
6
7
  command;
@@ -9,6 +10,7 @@ export class SubmitCommandRequest {
9
10
  throw new ValidationError("submit requests require at least one actAs party");
10
11
  }
11
12
  this.applicationId = init.applicationId;
13
+ this.userId = init.userId;
12
14
  this.actAs = init.actAs;
13
15
  this.readAs = init.readAs ?? [];
14
16
  this.command = init.command;
@@ -1,3 +1,4 @@
1
1
  export declare enum TopologySignatureFormat {
2
- ed25519 = "ed25519"
2
+ ed25519 = "ed25519",
3
+ ecDsaSha256 = "ecDsaSha256"
3
4
  }
@@ -1,4 +1,5 @@
1
1
  export var TopologySignatureFormat;
2
2
  (function (TopologySignatureFormat) {
3
3
  TopologySignatureFormat["ed25519"] = "ed25519";
4
+ TopologySignatureFormat["ecDsaSha256"] = "ecDsaSha256";
4
5
  })(TopologySignatureFormat || (TopologySignatureFormat = {}));
@@ -0,0 +1,8 @@
1
+ export declare class DarArchiveEntry {
2
+ readonly path: string;
3
+ readonly bytes: Uint8Array;
4
+ constructor(init: {
5
+ path: string;
6
+ bytes: Uint8Array;
7
+ });
8
+ }
@@ -0,0 +1,8 @@
1
+ export class DarArchiveEntry {
2
+ path;
3
+ bytes;
4
+ constructor(init) {
5
+ this.path = init.path;
6
+ this.bytes = init.bytes;
7
+ }
8
+ }
@@ -1,8 +1,10 @@
1
1
  import { strFromU8, unzipSync } from "fflate";
2
2
  import { DamlLfArchiveException } from "../errors/daml-lf-archive.exception.js";
3
3
  import { DarArchive } from "./dar-archive.js";
4
+ import { DarArchiveEntry } from "./dar-archive-entry.js";
4
5
  import { DarManifest } from "./dar-manifest.js";
5
6
  import { DarPackageEntry } from "./dar-package-entry.js";
7
+ import { DarSourceFileEntry } from "./dar-source-file-entry.js";
6
8
  export class DarArchiveLoader {
7
9
  async loadDarOrThrowAsync(archiveBytes) {
8
10
  try {
@@ -12,20 +14,32 @@ export class DarArchiveLoader {
12
14
  throw new DamlLfArchiveException("dar archive does not contain META-INF/MANIFEST.MF");
13
15
  }
14
16
  const manifest = this.parseManifestOrThrow(strFromU8(manifestBytes));
17
+ const entries = Object.entries(archiveEntries).map(([path, bytes]) => new DarArchiveEntry({
18
+ path,
19
+ bytes,
20
+ }));
15
21
  const packageEntries = Object.entries(archiveEntries)
16
22
  .filter(([path]) => path.endsWith(".dalf"))
17
23
  .map(([path, bytes]) => new DarPackageEntry({
18
24
  path,
19
25
  bytes,
20
26
  }));
27
+ const sourceFiles = Object.entries(archiveEntries)
28
+ .filter(([path]) => path.endsWith(".daml"))
29
+ .map(([path, bytes]) => new DarSourceFileEntry({
30
+ path,
31
+ content: strFromU8(bytes),
32
+ }));
21
33
  const mainPackageEntry = packageEntries.find((entry) => entry.path === manifest.mainDalfPath);
22
34
  if (mainPackageEntry === undefined) {
23
35
  throw new DamlLfArchiveException(`dar archive does not contain the main dalf entry '${manifest.mainDalfPath}'`);
24
36
  }
25
37
  return new DarArchive({
38
+ entries,
26
39
  manifest,
27
40
  mainPackageEntry,
28
41
  packageEntries,
42
+ sourceFiles,
29
43
  });
30
44
  }
31
45
  catch (error) {
@@ -1,12 +1,18 @@
1
1
  import { DarManifest } from "./dar-manifest.js";
2
+ import { DarArchiveEntry } from "./dar-archive-entry.js";
2
3
  import { DarPackageEntry } from "./dar-package-entry.js";
4
+ import { DarSourceFileEntry } from "./dar-source-file-entry.js";
3
5
  export declare class DarArchive {
6
+ readonly entries: readonly DarArchiveEntry[];
4
7
  readonly manifest: DarManifest;
5
8
  readonly mainPackageEntry: DarPackageEntry;
6
9
  readonly packageEntries: readonly DarPackageEntry[];
10
+ readonly sourceFiles: readonly DarSourceFileEntry[];
7
11
  constructor(init: {
12
+ entries: readonly DarArchiveEntry[];
8
13
  manifest: DarManifest;
9
14
  mainPackageEntry: DarPackageEntry;
10
15
  packageEntries: readonly DarPackageEntry[];
16
+ sourceFiles: readonly DarSourceFileEntry[];
11
17
  });
12
18
  }
@@ -1,10 +1,14 @@
1
1
  export class DarArchive {
2
+ entries;
2
3
  manifest;
3
4
  mainPackageEntry;
4
5
  packageEntries;
6
+ sourceFiles;
5
7
  constructor(init) {
8
+ this.entries = init.entries;
6
9
  this.manifest = init.manifest;
7
10
  this.mainPackageEntry = init.mainPackageEntry;
8
11
  this.packageEntries = init.packageEntries;
12
+ this.sourceFiles = init.sourceFiles;
9
13
  }
10
14
  }
@@ -0,0 +1,5 @@
1
+ import { DarSourceBundle } from "./dar-source-bundle.js";
2
+ export declare class DarSourceBundleLoader {
3
+ private readonly archiveLoader;
4
+ loadSourceBundleOrThrowAsync(archiveBytes: Uint8Array): Promise<DarSourceBundle>;
5
+ }
@@ -0,0 +1,33 @@
1
+ import { strFromU8 } from "fflate";
2
+ import { DamlLfArchiveException } from "../errors/daml-lf-archive.exception.js";
3
+ import { DarArchiveLoader } from "./dar-archive-loader.js";
4
+ import { DarSourceBundle, } from "./dar-source-bundle.js";
5
+ export class DarSourceBundleLoader {
6
+ archiveLoader = new DarArchiveLoader();
7
+ async loadSourceBundleOrThrowAsync(archiveBytes) {
8
+ const archive = await this.archiveLoader.loadDarOrThrowAsync(archiveBytes);
9
+ const metadataEntry = archive.entries.find((entry) => entry.path === "debug/source-map.json");
10
+ if (metadataEntry === undefined) {
11
+ throw new DamlLfArchiveException("dar archive does not contain debug/source-map.json");
12
+ }
13
+ const metadata = JSON.parse(strFromU8(metadataEntry.bytes));
14
+ if (!Array.isArray(metadata.executables)) {
15
+ throw new DamlLfArchiveException("dar source-map metadata must define an executables array");
16
+ }
17
+ return new DarSourceBundle({
18
+ sourceFiles: archive.sourceFiles,
19
+ metadata: {
20
+ packageId: typeof metadata.packageId === "string"
21
+ ? metadata.packageId
22
+ : undefined,
23
+ importedPackages: Array.isArray(metadata.importedPackages)
24
+ ? metadata.importedPackages.filter((entry) => typeof entry === "string")
25
+ : [],
26
+ executables: metadata.executables,
27
+ expressionLocations: Array.isArray(metadata.expressionLocations)
28
+ ? metadata.expressionLocations
29
+ : [],
30
+ },
31
+ });
32
+ }
33
+ }
@@ -0,0 +1,45 @@
1
+ import { DarSourceFileEntry } from "./dar-source-file-entry.js";
2
+ export interface DarSourceBundleMetadataExecutable {
3
+ packageId: string;
4
+ moduleName: string;
5
+ definitionName: string;
6
+ path: string;
7
+ startLine: number;
8
+ startColumn: number;
9
+ endLine: number;
10
+ endColumn: number;
11
+ precision?: "exact" | "fallback";
12
+ entrypointKind?: "create" | "exercise";
13
+ templateName?: string;
14
+ choiceName?: string;
15
+ choiceArgumentFieldName?: string;
16
+ }
17
+ export interface DarSourceBundleMetadataExpressionLocation {
18
+ packageId: string;
19
+ moduleName: string;
20
+ definitionName: string;
21
+ expressionPath: readonly number[];
22
+ path: string;
23
+ startLine: number;
24
+ startColumn: number;
25
+ endLine: number;
26
+ endColumn: number;
27
+ }
28
+ export declare class DarSourceBundle {
29
+ readonly sourceFiles: readonly DarSourceFileEntry[];
30
+ readonly metadata: {
31
+ packageId?: string;
32
+ importedPackages?: readonly string[];
33
+ executables: readonly DarSourceBundleMetadataExecutable[];
34
+ expressionLocations: readonly DarSourceBundleMetadataExpressionLocation[];
35
+ };
36
+ constructor(init: {
37
+ sourceFiles: readonly DarSourceFileEntry[];
38
+ metadata: {
39
+ packageId?: string;
40
+ importedPackages?: readonly string[];
41
+ executables: readonly DarSourceBundleMetadataExecutable[];
42
+ expressionLocations?: readonly DarSourceBundleMetadataExpressionLocation[];
43
+ };
44
+ });
45
+ }
@@ -0,0 +1,11 @@
1
+ export class DarSourceBundle {
2
+ sourceFiles;
3
+ metadata;
4
+ constructor(init) {
5
+ this.sourceFiles = init.sourceFiles;
6
+ this.metadata = {
7
+ ...init.metadata,
8
+ expressionLocations: init.metadata.expressionLocations ?? [],
9
+ };
10
+ }
11
+ }
@@ -0,0 +1,8 @@
1
+ export declare class DarSourceFileEntry {
2
+ readonly path: string;
3
+ readonly content: string;
4
+ constructor(init: {
5
+ path: string;
6
+ content: string;
7
+ });
8
+ }