@fairmint/canton-node-sdk 0.0.265 → 0.0.267

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 (168) hide show
  1. package/README.md +12 -3
  2. package/build/src/clients/ledger-json-api/LedgerJsonApiClient.generated.d.ts +6 -21
  3. package/build/src/clients/ledger-json-api/LedgerJsonApiClient.generated.d.ts.map +1 -1
  4. package/build/src/clients/ledger-json-api/LedgerJsonApiClient.generated.js +2 -12
  5. package/build/src/clients/ledger-json-api/LedgerJsonApiClient.generated.js.map +1 -1
  6. package/build/src/clients/ledger-json-api/index.d.ts +6 -1
  7. package/build/src/clients/ledger-json-api/index.d.ts.map +1 -1
  8. package/build/src/clients/ledger-json-api/index.js +7 -1
  9. package/build/src/clients/ledger-json-api/index.js.map +1 -1
  10. package/build/src/clients/ledger-json-api/operations/v2/commands/async/submit.d.ts +52 -52
  11. package/build/src/clients/ledger-json-api/operations/v2/commands/index.d.ts +0 -1
  12. package/build/src/clients/ledger-json-api/operations/v2/commands/index.d.ts.map +1 -1
  13. package/build/src/clients/ledger-json-api/operations/v2/commands/index.js +0 -1
  14. package/build/src/clients/ledger-json-api/operations/v2/commands/index.js.map +1 -1
  15. package/build/src/clients/ledger-json-api/operations/v2/commands/submit-and-wait-for-reassignment.d.ts +2 -2
  16. package/build/src/clients/ledger-json-api/operations/v2/commands/submit-and-wait-for-transaction.d.ts +13 -0
  17. package/build/src/clients/ledger-json-api/operations/v2/commands/submit-and-wait-for-transaction.d.ts.map +1 -1
  18. package/build/src/clients/ledger-json-api/operations/v2/commands/submit-and-wait-for-transaction.js +29 -2
  19. package/build/src/clients/ledger-json-api/operations/v2/commands/submit-and-wait-for-transaction.js.map +1 -1
  20. package/build/src/clients/ledger-json-api/operations/v2/commands/submit-and-wait.d.ts +52 -52
  21. package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/index.d.ts +0 -1
  22. package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/index.d.ts.map +1 -1
  23. package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/index.js +0 -1
  24. package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/index.js.map +1 -1
  25. package/build/src/clients/ledger-json-api/operations/v2/state/active-contracts-request.d.ts +49 -0
  26. package/build/src/clients/ledger-json-api/operations/v2/state/active-contracts-request.d.ts.map +1 -0
  27. package/build/src/clients/ledger-json-api/operations/v2/state/active-contracts-request.js +127 -0
  28. package/build/src/clients/ledger-json-api/operations/v2/state/active-contracts-request.js.map +1 -0
  29. package/build/src/clients/ledger-json-api/operations/v2/state/get-active-contracts.d.ts +10 -13
  30. package/build/src/clients/ledger-json-api/operations/v2/state/get-active-contracts.d.ts.map +1 -1
  31. package/build/src/clients/ledger-json-api/operations/v2/state/get-active-contracts.js +18 -106
  32. package/build/src/clients/ledger-json-api/operations/v2/state/get-active-contracts.js.map +1 -1
  33. package/build/src/clients/ledger-json-api/operations/v2/state/index.d.ts +1 -0
  34. package/build/src/clients/ledger-json-api/operations/v2/state/index.d.ts.map +1 -1
  35. package/build/src/clients/ledger-json-api/operations/v2/state/index.js +1 -0
  36. package/build/src/clients/ledger-json-api/operations/v2/state/index.js.map +1 -1
  37. package/build/src/clients/ledger-json-api/operations/v2/state/stream-active-contracts.d.ts +64 -0
  38. package/build/src/clients/ledger-json-api/operations/v2/state/stream-active-contracts.d.ts.map +1 -0
  39. package/build/src/clients/ledger-json-api/operations/v2/state/stream-active-contracts.js +211 -0
  40. package/build/src/clients/ledger-json-api/operations/v2/state/stream-active-contracts.js.map +1 -0
  41. package/build/src/clients/ledger-json-api/operations/v2/updates/get-update-by-id.d.ts +45 -7
  42. package/build/src/clients/ledger-json-api/operations/v2/updates/get-update-by-id.d.ts.map +1 -1
  43. package/build/src/clients/ledger-json-api/operations/v2/updates/get-update-by-id.js +64 -7
  44. package/build/src/clients/ledger-json-api/operations/v2/updates/get-update-by-id.js.map +1 -1
  45. package/build/src/clients/ledger-json-api/operations/v2/updates/get-update-by-offset.d.ts +17 -0
  46. package/build/src/clients/ledger-json-api/operations/v2/updates/get-update-by-offset.d.ts.map +1 -1
  47. package/build/src/clients/ledger-json-api/operations/v2/updates/get-update-by-offset.js +17 -0
  48. package/build/src/clients/ledger-json-api/operations/v2/updates/get-update-by-offset.js.map +1 -1
  49. package/build/src/clients/ledger-json-api/operations/v2/updates/index.d.ts +0 -4
  50. package/build/src/clients/ledger-json-api/operations/v2/updates/index.d.ts.map +1 -1
  51. package/build/src/clients/ledger-json-api/operations/v2/updates/index.js +0 -4
  52. package/build/src/clients/ledger-json-api/operations/v2/updates/index.js.map +1 -1
  53. package/build/src/clients/ledger-json-api/operations/v2/updates/subscribe-to-updates.d.ts +46 -8
  54. package/build/src/clients/ledger-json-api/operations/v2/updates/subscribe-to-updates.d.ts.map +1 -1
  55. package/build/src/clients/ledger-json-api/operations/v2/updates/subscribe-to-updates.js +12 -25
  56. package/build/src/clients/ledger-json-api/operations/v2/updates/subscribe-to-updates.js.map +1 -1
  57. package/build/src/clients/ledger-json-api/operations/v2/utils/event-format-builder.d.ts +29 -0
  58. package/build/src/clients/ledger-json-api/operations/v2/utils/event-format-builder.d.ts.map +1 -1
  59. package/build/src/clients/ledger-json-api/operations/v2/utils/event-format-builder.js +43 -0
  60. package/build/src/clients/ledger-json-api/operations/v2/utils/event-format-builder.js.map +1 -1
  61. package/build/src/clients/ledger-json-api/schemas/api/event-details.d.ts +22 -4
  62. package/build/src/clients/ledger-json-api/schemas/api/event-details.d.ts.map +1 -1
  63. package/build/src/clients/ledger-json-api/schemas/api/events.d.ts +44 -422
  64. package/build/src/clients/ledger-json-api/schemas/api/events.d.ts.map +1 -1
  65. package/build/src/clients/ledger-json-api/schemas/api/events.js +1 -111
  66. package/build/src/clients/ledger-json-api/schemas/api/events.js.map +1 -1
  67. package/build/src/clients/ledger-json-api/schemas/api/interface-view.d.ts +28 -5
  68. package/build/src/clients/ledger-json-api/schemas/api/interface-view.d.ts.map +1 -1
  69. package/build/src/clients/ledger-json-api/schemas/api/interface-view.js +16 -4
  70. package/build/src/clients/ledger-json-api/schemas/api/interface-view.js.map +1 -1
  71. package/build/src/clients/ledger-json-api/schemas/api/packages.d.ts +1 -43
  72. package/build/src/clients/ledger-json-api/schemas/api/packages.d.ts.map +1 -1
  73. package/build/src/clients/ledger-json-api/schemas/api/packages.js +2 -18
  74. package/build/src/clients/ledger-json-api/schemas/api/packages.js.map +1 -1
  75. package/build/src/clients/ledger-json-api/schemas/api/reassignment.d.ts +88 -16
  76. package/build/src/clients/ledger-json-api/schemas/api/reassignment.d.ts.map +1 -1
  77. package/build/src/clients/ledger-json-api/schemas/api/state.d.ts +176 -32
  78. package/build/src/clients/ledger-json-api/schemas/api/state.d.ts.map +1 -1
  79. package/build/src/clients/ledger-json-api/schemas/api/transactions.d.ts +0 -885
  80. package/build/src/clients/ledger-json-api/schemas/api/transactions.d.ts.map +1 -1
  81. package/build/src/clients/ledger-json-api/schemas/api/transactions.js +1 -61
  82. package/build/src/clients/ledger-json-api/schemas/api/transactions.js.map +1 -1
  83. package/build/src/clients/ledger-json-api/schemas/api/updates.d.ts +1162 -3688
  84. package/build/src/clients/ledger-json-api/schemas/api/updates.d.ts.map +1 -1
  85. package/build/src/clients/ledger-json-api/schemas/api/updates.js +13 -89
  86. package/build/src/clients/ledger-json-api/schemas/api/updates.js.map +1 -1
  87. package/build/src/clients/ledger-json-api/schemas/operations/commands.d.ts +0 -419
  88. package/build/src/clients/ledger-json-api/schemas/operations/commands.d.ts.map +1 -1
  89. package/build/src/clients/ledger-json-api/schemas/operations/commands.js +2 -6
  90. package/build/src/clients/ledger-json-api/schemas/operations/commands.js.map +1 -1
  91. package/build/src/clients/ledger-json-api/schemas/operations/interactive-submission.d.ts +0 -8
  92. package/build/src/clients/ledger-json-api/schemas/operations/interactive-submission.d.ts.map +1 -1
  93. package/build/src/clients/ledger-json-api/schemas/operations/interactive-submission.js +1 -12
  94. package/build/src/clients/ledger-json-api/schemas/operations/interactive-submission.js.map +1 -1
  95. package/build/src/clients/ledger-json-api/schemas/operations/packages.d.ts +0 -8
  96. package/build/src/clients/ledger-json-api/schemas/operations/packages.d.ts.map +1 -1
  97. package/build/src/clients/ledger-json-api/schemas/operations/packages.js +1 -12
  98. package/build/src/clients/ledger-json-api/schemas/operations/packages.js.map +1 -1
  99. package/build/src/clients/ledger-json-api/schemas/operations/updates.d.ts +0 -281
  100. package/build/src/clients/ledger-json-api/schemas/operations/updates.d.ts.map +1 -1
  101. package/build/src/clients/ledger-json-api/schemas/operations/updates.js +1 -31
  102. package/build/src/clients/ledger-json-api/schemas/operations/updates.js.map +1 -1
  103. package/build/src/core/ws/WebSocketClient.d.ts +8 -0
  104. package/build/src/core/ws/WebSocketClient.d.ts.map +1 -1
  105. package/build/src/core/ws/WebSocketClient.js +24 -1
  106. package/build/src/core/ws/WebSocketClient.js.map +1 -1
  107. package/build/src/utils/amulet/offers.d.ts +2 -2
  108. package/build/src/utils/amulet/offers.d.ts.map +1 -1
  109. package/build/src/utils/amulet/offers.js +2 -2
  110. package/build/src/utils/amulet/offers.js.map +1 -1
  111. package/build/src/utils/amulet/pre-approve-transfers.js +2 -2
  112. package/build/src/utils/amulet/pre-approve-transfers.js.map +1 -1
  113. package/build/src/utils/amulet/transfer-to-preapproved.d.ts +2 -2
  114. package/build/src/utils/amulet/transfer-to-preapproved.d.ts.map +1 -1
  115. package/build/src/utils/amulet/transfer-to-preapproved.js +1 -1
  116. package/build/src/utils/amulet/transfer-to-preapproved.js.map +1 -1
  117. package/build/src/utils/canton-response-utils.d.ts.map +1 -1
  118. package/build/src/utils/canton-response-utils.js +16 -1
  119. package/build/src/utils/canton-response-utils.js.map +1 -1
  120. package/build/src/utils/contracts/findCreatedEvent.d.ts +16 -26
  121. package/build/src/utils/contracts/findCreatedEvent.d.ts.map +1 -1
  122. package/build/src/utils/contracts/findCreatedEvent.js +28 -32
  123. package/build/src/utils/contracts/findCreatedEvent.js.map +1 -1
  124. package/build/src/utils/parsers/event-parser.d.ts +3 -2
  125. package/build/src/utils/parsers/event-parser.d.ts.map +1 -1
  126. package/build/src/utils/parsers/event-parser.js +17 -57
  127. package/build/src/utils/parsers/event-parser.js.map +1 -1
  128. package/build/src/utils/parsers/fee-parser.d.ts +20 -16
  129. package/build/src/utils/parsers/fee-parser.d.ts.map +1 -1
  130. package/build/src/utils/parsers/fee-parser.js +27 -48
  131. package/build/src/utils/parsers/fee-parser.js.map +1 -1
  132. package/build/src/utils/token-standard/v2/allocation.d.ts +4 -4
  133. package/build/src/utils/token-standard/v2/allocation.d.ts.map +1 -1
  134. package/build/src/utils/token-standard/v2/allocation.js +9 -9
  135. package/build/src/utils/token-standard/v2/allocation.js.map +1 -1
  136. package/build/src/utils/transactions/TransactionBatch.d.ts +5 -4
  137. package/build/src/utils/transactions/TransactionBatch.d.ts.map +1 -1
  138. package/build/src/utils/transactions/TransactionBatch.js +7 -6
  139. package/build/src/utils/transactions/TransactionBatch.js.map +1 -1
  140. package/build/src/utils/transactions/find-created-event.d.ts +8 -8
  141. package/build/src/utils/transactions/find-created-event.d.ts.map +1 -1
  142. package/build/src/utils/transactions/find-created-event.js +10 -16
  143. package/build/src/utils/transactions/find-created-event.js.map +1 -1
  144. package/package.json +1 -1
  145. package/build/src/clients/ledger-json-api/operations/v2/commands/submit-and-wait-for-transaction-tree.d.ts +0 -512
  146. package/build/src/clients/ledger-json-api/operations/v2/commands/submit-and-wait-for-transaction-tree.d.ts.map +0 -1
  147. package/build/src/clients/ledger-json-api/operations/v2/commands/submit-and-wait-for-transaction-tree.js +0 -26
  148. package/build/src/clients/ledger-json-api/operations/v2/commands/submit-and-wait-for-transaction-tree.js.map +0 -1
  149. package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/get-preferred-package-version.d.ts +0 -36
  150. package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/get-preferred-package-version.d.ts.map +0 -1
  151. package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/get-preferred-package-version.js +0 -39
  152. package/build/src/clients/ledger-json-api/operations/v2/interactive-submission/get-preferred-package-version.js.map +0 -1
  153. package/build/src/clients/ledger-json-api/operations/v2/updates/get-transaction-by-id.d.ts +0 -139
  154. package/build/src/clients/ledger-json-api/operations/v2/updates/get-transaction-by-id.d.ts.map +0 -1
  155. package/build/src/clients/ledger-json-api/operations/v2/updates/get-transaction-by-id.js +0 -14
  156. package/build/src/clients/ledger-json-api/operations/v2/updates/get-transaction-by-id.js.map +0 -1
  157. package/build/src/clients/ledger-json-api/operations/v2/updates/get-transaction-by-offset.d.ts +0 -139
  158. package/build/src/clients/ledger-json-api/operations/v2/updates/get-transaction-by-offset.d.ts.map +0 -1
  159. package/build/src/clients/ledger-json-api/operations/v2/updates/get-transaction-by-offset.js +0 -14
  160. package/build/src/clients/ledger-json-api/operations/v2/updates/get-transaction-by-offset.js.map +0 -1
  161. package/build/src/clients/ledger-json-api/operations/v2/updates/get-transaction-tree-by-id.d.ts +0 -37
  162. package/build/src/clients/ledger-json-api/operations/v2/updates/get-transaction-tree-by-id.d.ts.map +0 -1
  163. package/build/src/clients/ledger-json-api/operations/v2/updates/get-transaction-tree-by-id.js +0 -46
  164. package/build/src/clients/ledger-json-api/operations/v2/updates/get-transaction-tree-by-id.js.map +0 -1
  165. package/build/src/clients/ledger-json-api/operations/v2/updates/get-transaction-tree-by-offset.d.ts +0 -37
  166. package/build/src/clients/ledger-json-api/operations/v2/updates/get-transaction-tree-by-offset.d.ts.map +0 -1
  167. package/build/src/clients/ledger-json-api/operations/v2/updates/get-transaction-tree-by-offset.js +0 -46
  168. package/build/src/clients/ledger-json-api/operations/v2/updates/get-transaction-tree-by-offset.js.map +0 -1
@@ -1,9 +1,22 @@
1
1
  import { type z } from 'zod';
2
2
  import type { paths } from '../../../../../generated/canton/community/ledger/ledger-json-api/src/test/resources/json-api-docs/openapi';
3
3
  import { SubmitAndWaitForTransactionParamsSchema } from '../../../schemas/operations';
4
+ import { type TransactionFormat } from '../../../schemas/operations/updates';
4
5
  declare const endpoint: '/v2/commands/submit-and-wait-for-transaction';
5
6
  export type SubmitAndWaitForTransactionParams = z.infer<typeof SubmitAndWaitForTransactionParamsSchema>;
6
7
  export type SubmitAndWaitForTransactionResponse = paths[typeof endpoint]['post']['responses']['200']['content']['application/json'];
8
+ /**
9
+ * The transaction format used when a caller does not pass one: every event visible to the submitting parties (`actAs` ∪
10
+ * `readAs`), in `TRANSACTION_SHAPE_LEDGER_EFFECTS` so exercised events and their results are included, verbose, with
11
+ * created-event blobs for disclosure.
12
+ */
13
+ export declare function defaultSubmitTransactionFormat(parties: readonly string[]): TransactionFormat;
14
+ /**
15
+ * Submits commands and waits for the resulting transaction.
16
+ *
17
+ * Without an explicit `transactionFormat`, the response carries the full ledger effects (creates and exercises, with
18
+ * exercise results) visible to `actAs` ∪ `readAs` — see {@link defaultSubmitTransactionFormat}.
19
+ */
7
20
  export declare const SubmitAndWaitForTransaction: new (client: import("../../../../..").BaseClient) => import("../../../../..").ApiOperation<{
8
21
  commands: ({
9
22
  CreateCommand: {
@@ -1 +1 @@
1
- {"version":3,"file":"submit-and-wait-for-transaction.d.ts","sourceRoot":"","sources":["../../../../../../../src/clients/ledger-json-api/operations/v2/commands/submit-and-wait-for-transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2GAA2G,CAAC;AACvI,OAAO,EAAE,uCAAuC,EAAE,MAAM,6BAA6B,CAAC;AAEtF,QAAA,MAAM,QAAQ,EAAG,8CAAuD,CAAC;AAMzE,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uCAAuC,CAAC,CAAC;AAExG,MAAM,MAAM,mCAAmC,GAC7C,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AAEpF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoBtC,CAAC"}
1
+ {"version":3,"file":"submit-and-wait-for-transaction.d.ts","sourceRoot":"","sources":["../../../../../../../src/clients/ledger-json-api/operations/v2/commands/submit-and-wait-for-transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2GAA2G,CAAC;AACvI,OAAO,EAAE,uCAAuC,EAAE,MAAM,6BAA6B,CAAC;AACtF,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAE7E,QAAA,MAAM,QAAQ,EAAG,8CAAuD,CAAC;AAEzE,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,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ormat = defaultSubmitTransactionFormat;
4
5
  const core_1 = require("../../../../../core");
5
6
  const operations_1 = require("../../../schemas/operations");
6
7
  const endpoint = '/v2/commands/submit-and-wait-for-transaction';
8
+ /**
9
+ * The transaction format used when a caller does not pass one: every event visible to the submitting parties (`actAs` ∪
10
+ * `readAs`), in `TRANSACTION_SHAPE_LEDGER_EFFECTS` so exercised events and their results are included, verbose, with
11
+ * created-event blobs for disclosure.
12
+ */
13
+ function defaultSubmitTransactionFormat(parties) {
14
+ return {
15
+ eventFormat: {
16
+ filtersByParty: Object.fromEntries(Array.from(new Set(parties)).map((party) => [
17
+ party,
18
+ {
19
+ cumulative: [{ identifierFilter: { WildcardFilter: { value: { includeCreatedEventBlob: true } } } }],
20
+ },
21
+ ])),
22
+ verbose: true,
23
+ },
24
+ transactionShape: 'TRANSACTION_SHAPE_LEDGER_EFFECTS',
25
+ };
26
+ }
27
+ /**
28
+ * Submits commands and waits for the resulting transaction.
29
+ *
30
+ * Without an explicit `transactionFormat`, the response carries the full ledger effects (creates and exercises, with
31
+ * exercise results) visible to `actAs` ∪ `readAs` — see {@link defaultSubmitTransactionFormat}.
32
+ */
7
33
  exports.SubmitAndWaitForTransaction = (0, core_1.createApiOperation)({
8
34
  paramsSchema: operations_1.SubmitAndWaitForTransactionParamsSchema,
9
35
  method: 'POST',
10
36
  buildUrl: (_params, apiUrl) => `${apiUrl}${endpoint}`,
11
37
  buildRequestData: (params, client) => {
12
38
  const { transactionFormat, ...commands } = params;
39
+ const actAs = params.actAs ?? [client.getPartyId()];
13
40
  return {
14
41
  commands: {
15
42
  ...commands,
16
43
  commandId: params.commandId ??
17
44
  `submit-and-wait-for-transaction-${Date.now()}-${Math.random().toString(36).substring(2, 8)}`,
18
- actAs: params.actAs ?? [client.getPartyId()],
45
+ actAs,
19
46
  },
20
- ...(transactionFormat !== undefined ? { transactionFormat } : {}),
47
+ transactionFormat: transactionFormat ?? defaultSubmitTransactionFormat([...actAs, ...(params.readAs ?? [])]),
21
48
  };
22
49
  },
23
50
  });
@@ -1 +1 @@
1
- {"version":3,"file":"submit-and-wait-for-transaction.js","sourceRoot":"","sources":["../../../../../../../src/clients/ledger-json-api/operations/v2/commands/submit-and-wait-for-transaction.ts"],"names":[],"mappings":";;;AACA,8CAAyD;AAEzD,4DAAsF;AAEtF,MAAM,QAAQ,GAAG,8CAAuD,CAAC;AAW5D,QAAA,2BAA2B,GAAG,IAAA,yBAAkB,EAG3D;IACA,YAAY,EAAE,oDAAuC;IACrD,MAAM,EAAE,MAAM;IACd,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,GAAG,MAAM,GAAG,QAAQ,EAAE;IACrD,gBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE;QACnC,MAAM,EAAE,iBAAiB,EAAE,GAAG,QAAQ,EAAE,GAAG,MAAM,CAAC;QAClD,OAAO;YACL,QAAQ,EAAE;gBACR,GAAG,QAAQ;gBACX,SAAS,EACP,MAAM,CAAC,SAAS;oBAChB,mCAAmC,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE;gBAC/F,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;aAC7C;YACD,GAAG,CAAC,iBAAiB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAClE,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"submit-and-wait-for-transaction.js","sourceRoot":"","sources":["../../../../../../../src/clients/ledger-json-api/operations/v2/commands/submit-and-wait-for-transaction.ts"],"names":[],"mappings":";;;;AACA,8CAAyD;AAEzD,4DAAsF;AAGtF,MAAM,QAAQ,GAAG,8CAAuD,CAAC;AAOzE;;;;GAIG;AACH,w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,EAAE,CAAC,CAAC,CAAC;SAC7G,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -11,7 +11,19 @@ export type SubmitAndWaitResponse = paths[typeof endpoint]['post']['responses'][
11
11
  */
12
12
  export declare const SubmitAndWait: new (client: import("../../../../..").BaseClient) => import("../../../../..").ApiOperation<{
13
13
  commands: ({
14
- CreateCommand: {
14
+ AssignCommand: {
15
+ reassignmentId: string;
16
+ source: string;
17
+ target: string;
18
+ };
19
+ } | {
20
+ UnassignCommand: {
21
+ contractId: string;
22
+ source: string;
23
+ target: string;
24
+ };
25
+ } | {
26
+ CreateAndExerciseCommand: {
15
27
  templateId: string;
16
28
  createArguments: Record<string, string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | {
17
29
  [key: string]: string | number | boolean | /*elided*/ any | /*elided*/ any | null;
@@ -38,11 +50,6 @@ export declare const SubmitAndWait: new (client: import("../../../../..").BaseCl
38
50
  } | null)[] | {
39
51
  [key: string]: string | number | boolean | any | any | null;
40
52
  } | null>;
41
- };
42
- } | {
43
- ExerciseCommand: {
44
- templateId: string;
45
- contractId: string;
46
53
  choice: string;
47
54
  choiceArgument: Record<string, string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | any | {
48
55
  [key: string]: string | number | boolean | any | any | null;
@@ -71,7 +78,7 @@ export declare const SubmitAndWait: new (client: import("../../../../..").BaseCl
71
78
  } | null>;
72
79
  };
73
80
  } | {
74
- CreateAndExerciseCommand: {
81
+ CreateCommand: {
75
82
  templateId: string;
76
83
  createArguments: Record<string, string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | any | {
77
84
  [key: string]: string | number | boolean | any | any | null;
@@ -98,8 +105,11 @@ export declare const SubmitAndWait: new (client: import("../../../../..").BaseCl
98
105
  } | null)[] | {
99
106
  [key: string]: string | number | boolean | any | any | null;
100
107
  } | null>;
101
- choice: string;
102
- choiceArgument: Record<string, string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | any | {
108
+ };
109
+ } | {
110
+ ExerciseByKeyCommand: {
111
+ templateId: string;
112
+ contractKey: Record<string, string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | any | {
103
113
  [key: string]: string | number | boolean | any | any | null;
104
114
  } | null)[] | {
105
115
  [key: string]: string | number | boolean | any | any | null;
@@ -124,11 +134,8 @@ export declare const SubmitAndWait: new (client: import("../../../../..").BaseCl
124
134
  } | null)[] | {
125
135
  [key: string]: string | number | boolean | any | any | null;
126
136
  } | null>;
127
- };
128
- } | {
129
- ExerciseByKeyCommand: {
130
- templateId: string;
131
- contractKey: Record<string, string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | any | {
137
+ choice: string;
138
+ choiceArgument: Record<string, string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | any | {
132
139
  [key: string]: string | number | boolean | any | any | null;
133
140
  } | null)[] | {
134
141
  [key: string]: string | number | boolean | any | any | null;
@@ -153,6 +160,11 @@ export declare const SubmitAndWait: new (client: import("../../../../..").BaseCl
153
160
  } | null)[] | {
154
161
  [key: string]: string | number | boolean | any | any | null;
155
162
  } | null>;
163
+ };
164
+ } | {
165
+ ExerciseCommand: {
166
+ templateId: string;
167
+ contractId: string;
156
168
  choice: string;
157
169
  choiceArgument: Record<string, string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | any | {
158
170
  [key: string]: string | number | boolean | any | any | null;
@@ -180,18 +192,6 @@ export declare const SubmitAndWait: new (client: import("../../../../..").BaseCl
180
192
  [key: string]: string | number | boolean | any | any | null;
181
193
  } | null>;
182
194
  };
183
- } | {
184
- AssignCommand: {
185
- reassignmentId: string;
186
- source: string;
187
- target: string;
188
- };
189
- } | {
190
- UnassignCommand: {
191
- contractId: string;
192
- source: string;
193
- target: string;
194
- };
195
195
  })[];
196
196
  commandId?: string | undefined;
197
197
  actAs?: string[] | undefined;
@@ -264,7 +264,19 @@ export declare const SubmitAndWait: new (client: import("../../../../..").BaseCl
264
264
  completionOffset: number;
265
265
  }, import("../../../../..").OperationExecuteOptions<{
266
266
  commands: ({
267
- CreateCommand: {
267
+ AssignCommand: {
268
+ reassignmentId: string;
269
+ source: string;
270
+ target: string;
271
+ };
272
+ } | {
273
+ UnassignCommand: {
274
+ contractId: string;
275
+ source: string;
276
+ target: string;
277
+ };
278
+ } | {
279
+ CreateAndExerciseCommand: {
268
280
  templateId: string;
269
281
  createArguments: Record<string, string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | any | {
270
282
  [key: string]: string | number | boolean | any | any | null;
@@ -291,11 +303,6 @@ export declare const SubmitAndWait: new (client: import("../../../../..").BaseCl
291
303
  } | null)[] | {
292
304
  [key: string]: string | number | boolean | any | any | null;
293
305
  } | null>;
294
- };
295
- } | {
296
- ExerciseCommand: {
297
- templateId: string;
298
- contractId: string;
299
306
  choice: string;
300
307
  choiceArgument: Record<string, string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | any | {
301
308
  [key: string]: string | number | boolean | any | any | null;
@@ -324,7 +331,7 @@ export declare const SubmitAndWait: new (client: import("../../../../..").BaseCl
324
331
  } | null>;
325
332
  };
326
333
  } | {
327
- CreateAndExerciseCommand: {
334
+ CreateCommand: {
328
335
  templateId: string;
329
336
  createArguments: Record<string, string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | any | {
330
337
  [key: string]: string | number | boolean | any | any | null;
@@ -351,8 +358,11 @@ export declare const SubmitAndWait: new (client: import("../../../../..").BaseCl
351
358
  } | null)[] | {
352
359
  [key: string]: string | number | boolean | any | any | null;
353
360
  } | null>;
354
- choice: string;
355
- choiceArgument: Record<string, string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | any | {
361
+ };
362
+ } | {
363
+ ExerciseByKeyCommand: {
364
+ templateId: string;
365
+ contractKey: Record<string, string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | any | {
356
366
  [key: string]: string | number | boolean | any | any | null;
357
367
  } | null)[] | {
358
368
  [key: string]: string | number | boolean | any | any | null;
@@ -377,11 +387,8 @@ export declare const SubmitAndWait: new (client: import("../../../../..").BaseCl
377
387
  } | null)[] | {
378
388
  [key: string]: string | number | boolean | any | any | null;
379
389
  } | null>;
380
- };
381
- } | {
382
- ExerciseByKeyCommand: {
383
- templateId: string;
384
- contractKey: Record<string, string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | any | {
390
+ choice: string;
391
+ choiceArgument: Record<string, string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | any | {
385
392
  [key: string]: string | number | boolean | any | any | null;
386
393
  } | null)[] | {
387
394
  [key: string]: string | number | boolean | any | any | null;
@@ -406,6 +413,11 @@ export declare const SubmitAndWait: new (client: import("../../../../..").BaseCl
406
413
  } | null)[] | {
407
414
  [key: string]: string | number | boolean | any | any | null;
408
415
  } | null>;
416
+ };
417
+ } | {
418
+ ExerciseCommand: {
419
+ templateId: string;
420
+ contractId: string;
409
421
  choice: string;
410
422
  choiceArgument: Record<string, string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | any | {
411
423
  [key: string]: string | number | boolean | any | any | null;
@@ -433,18 +445,6 @@ export declare const SubmitAndWait: new (client: import("../../../../..").BaseCl
433
445
  [key: string]: string | number | boolean | any | any | null;
434
446
  } | null>;
435
447
  };
436
- } | {
437
- AssignCommand: {
438
- reassignmentId: string;
439
- source: string;
440
- target: string;
441
- };
442
- } | {
443
- UnassignCommand: {
444
- contractId: string;
445
- source: string;
446
- target: string;
447
- };
448
448
  })[];
449
449
  commandId?: string | undefined;
450
450
  actAs?: string[] | undefined;
@@ -1,7 +1,6 @@
1
1
  export * from './execute';
2
2
  export * from './execute-and-wait';
3
3
  export * from './execute-and-wait-for-transaction';
4
- export * from './get-preferred-package-version';
5
4
  export * from './get-preferred-packages';
6
5
  export * from './prepare';
7
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/clients/ledger-json-api/operations/v2/interactive-submission/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oCAAoC,CAAC;AACnD,cAAc,iCAAiC,CAAC;AAChD,cAAc,0BAA0B,CAAC;AACzC,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/clients/ledger-json-api/operations/v2/interactive-submission/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC;AACzC,cAAc,WAAW,CAAC"}
@@ -17,7 +17,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./execute"), exports);
18
18
  __exportStar(require("./execute-and-wait"), exports);
19
19
  __exportStar(require("./execute-and-wait-for-transaction"), exports);
20
- __exportStar(require("./get-preferred-package-version"), exports);
21
20
  __exportStar(require("./get-preferred-packages"), exports);
22
21
  __exportStar(require("./prepare"), exports);
23
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/clients/ledger-json-api/operations/v2/interactive-submission/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,qDAAmC;AACnC,qEAAmD;AACnD,kEAAgD;AAChD,2DAAyC;AACzC,4CAA0B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/clients/ledger-json-api/operations/v2/interactive-submission/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,qDAAmC;AACnC,qEAAmD;AACnD,2DAAyC;AACzC,4CAA0B"}
@@ -0,0 +1,49 @@
1
+ import { z } from 'zod';
2
+ import { ApiError } from '../../../../../core/errors';
3
+ import type { LedgerJsonApiClient } from '../../../LedgerJsonApiClient.generated';
4
+ import { type JsGetActiveContractsResponseItem } from '../../../schemas/api/state';
5
+ import { buildEventFormat } from '../utils/event-format-builder';
6
+ /** WebSocket endpoint shared by the collecting and the streaming active-contracts reads. */
7
+ export declare const ACTIVE_CONTRACTS_PATH: '/v2/state/active-contracts';
8
+ export declare const ActiveContractsParamsSchema: z.ZodObject<{
9
+ parties: z.ZodOptional<z.ZodArray<z.ZodString>>;
10
+ templateIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
11
+ interfaceIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
12
+ includeInterfaceView: z.ZodOptional<z.ZodBoolean>;
13
+ includeCreatedEventBlob: z.ZodOptional<z.ZodBoolean>;
14
+ activeAtOffset: z.ZodOptional<z.ZodNumber>;
15
+ idleTimeoutMs: z.ZodOptional<z.ZodNumber>;
16
+ }, z.core.$strip>;
17
+ export type ActiveContractsParams = z.infer<typeof ActiveContractsParamsSchema>;
18
+ /** Request message for the active contracts WebSocket endpoint. */
19
+ export interface ActiveContractsRequestMessage {
20
+ verbose: boolean;
21
+ activeAtOffset: number;
22
+ eventFormat: ReturnType<typeof buildEventFormat>;
23
+ }
24
+ export interface ActiveContractsRequest {
25
+ readonly requestMessage: ActiveContractsRequestMessage;
26
+ readonly idleTimeoutMs: number;
27
+ }
28
+ /**
29
+ * Validates the parameters and builds the snapshot request. The offset defaults to the ledger end and the parties to
30
+ * the client's party list.
31
+ */
32
+ export declare function buildActiveContractsRequest(client: LedgerJsonApiClient, params: ActiveContractsParams): Promise<ActiveContractsRequest>;
33
+ /** One decoded snapshot frame: an item, or the error that a Canton error frame or an unexpected frame stands for. */
34
+ export type ActiveContractsFrame = {
35
+ readonly item: JsGetActiveContractsResponseItem;
36
+ } | {
37
+ readonly error: ApiError;
38
+ };
39
+ /**
40
+ * The error a socket close stands for, or `undefined` when the close completes the snapshot.
41
+ *
42
+ * The participant reports failures as error frames and closes with 1000 after the last item. Every close that
43
+ * `WebSocketClient` starts itself reports an error first, so any other code that reaches `onClose` comes from the peer
44
+ * or the network: a dropped connection (1006), a proxy idle timeout or a server going away (1001). The items received
45
+ * before it are only part of the snapshot.
46
+ */
47
+ export declare function activeContractsCloseError(code: number, reason: string): ApiError | undefined;
48
+ export declare function decodeActiveContractsFrame(parsed: unknown): ActiveContractsFrame;
49
+ //# sourceMappingURL=active-contracts-request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"active-contracts-request.d.ts","sourceRoot":"","sources":["../../../../../../../src/clients/ledger-json-api/operations/v2/state/active-contracts-request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAOlF,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,4FAA4F;AAC5F,eAAO,MAAM,qBAAqB,EAAG,4BAAqC,CAAC;AAa3E,eAAO,MAAM,2BAA2B;;;;;;;;iBAkBtC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,mEAAmE;AACnE,MAAM,WAAW,6BAA6B;IAC5C,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;CAClD;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,cAAc,EAAE,6BAA6B,CAAC;IACvD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAED;;;GAGG;AACH,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,mBAAmB,EAC3B,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,sBAAsB,CAAC,CAwCjC;AAQD,qHAAqH;AACrH,MAAM,MAAM,oBAAoB,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,gCAAgC,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAA;CAAE,CAAC;AAkBtH;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAK5F;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,OAAO,GAAG,oBAAoB,CAShF"}
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ActiveContractsParamsSchema = exports.ACTIVE_CONTRACTS_PATH = void 0;
4
+ exports.buildActiveContractsRequest = buildActiveContractsRequest;
5
+ exports.activeContractsCloseError = activeContractsCloseError;
6
+ exports.decodeActiveContractsFrame = decodeActiveContractsFrame;
7
+ const zod_1 = require("zod");
8
+ const errors_1 = require("../../../../../core/errors");
9
+ const HttpClient_1 = require("../../../../../core/http/HttpClient");
10
+ const errors_2 = require("../../../schemas/api/errors");
11
+ const state_1 = require("../../../schemas/api/state");
12
+ const event_format_builder_1 = require("../utils/event-format-builder");
13
+ /** WebSocket endpoint shared by the collecting and the streaming active-contracts reads. */
14
+ exports.ACTIVE_CONTRACTS_PATH = '/v2/state/active-contracts';
15
+ /**
16
+ * Idle timeout for the active-contracts snapshot stream.
17
+ *
18
+ * The snapshot is a bounded stream that the server closes on its own, so silence this long means the connection is hung
19
+ * rather than slow. Callers that expect longer gaps can raise it or pass `0` to wait indefinitely.
20
+ *
21
+ * Intentionally reuses {@link DEFAULT_HTTP_TIMEOUT_MS} rather than an independent literal: both exist to detect a hung
22
+ * connection at the same "this is clearly stuck" horizon.
23
+ */
24
+ const DEFAULT_IDLE_TIMEOUT_MS = HttpClient_1.DEFAULT_HTTP_TIMEOUT_MS;
25
+ exports.ActiveContractsParamsSchema = zod_1.z.object({
26
+ /** Optional list of parties to scope the filter. */
27
+ parties: zod_1.z.array(zod_1.z.string()).optional(),
28
+ /** Optional template filters applied server-side. */
29
+ templateIds: zod_1.z.array(zod_1.z.string()).optional(),
30
+ /** Optional interface filters applied server-side. */
31
+ interfaceIds: zod_1.z.array(zod_1.z.string()).optional(),
32
+ /** Include interface views in InterfaceFilter results (default true). */
33
+ includeInterfaceView: zod_1.z.boolean().optional(),
34
+ /** Include created event blobs in template and interface filter results (default false). */
35
+ includeCreatedEventBlob: zod_1.z.boolean().optional(),
36
+ /**
37
+ * Offset to read the snapshot at; defaults to the ledger end. A reader that continues with `subscribeToUpdates` uses
38
+ * the same offset as `beginExclusive`.
39
+ */
40
+ activeAtOffset: zod_1.z.number().optional(),
41
+ /** Fail the snapshot when no message arrives for this many milliseconds. `0` waits indefinitely. */
42
+ idleTimeoutMs: zod_1.z.number().min(0).optional(),
43
+ });
44
+ /**
45
+ * Validates the parameters and builds the snapshot request. The offset defaults to the ledger end and the parties to
46
+ * the client's party list.
47
+ */
48
+ async function buildActiveContractsRequest(client, params) {
49
+ const validated = exports.ActiveContractsParamsSchema.parse(params);
50
+ // Determine activeAtOffset (default to ledger end if not specified)
51
+ let activeAtOffset;
52
+ if (validated.activeAtOffset !== undefined) {
53
+ ({ activeAtOffset } = validated);
54
+ }
55
+ else {
56
+ const ledgerEnd = await client.getLedgerEnd({});
57
+ const { offset } = ledgerEnd;
58
+ if (offset === undefined) {
59
+ throw new errors_1.ApiError('Ledger end response did not include an offset');
60
+ }
61
+ activeAtOffset = offset;
62
+ }
63
+ // Build party list - default to client's party list if not provided
64
+ const partyList = validated.parties && validated.parties.length > 0 ? validated.parties : client.buildPartyList();
65
+ // Build event format
66
+ const eventFormat = (0, event_format_builder_1.buildEventFormat)({
67
+ parties: partyList,
68
+ ...(validated.templateIds !== undefined && { templateIds: validated.templateIds }),
69
+ ...(validated.interfaceIds !== undefined && { interfaceIds: validated.interfaceIds }),
70
+ ...(validated.includeInterfaceView !== undefined && {
71
+ includeInterfaceView: validated.includeInterfaceView,
72
+ }),
73
+ ...(validated.includeCreatedEventBlob !== undefined && {
74
+ includeCreatedEventBlob: validated.includeCreatedEventBlob,
75
+ }),
76
+ });
77
+ return {
78
+ requestMessage: {
79
+ verbose: false,
80
+ activeAtOffset,
81
+ eventFormat,
82
+ },
83
+ idleTimeoutMs: validated.idleTimeoutMs ?? DEFAULT_IDLE_TIMEOUT_MS,
84
+ };
85
+ }
86
+ const ActiveContractsResponseMessageSchema = zod_1.z.union([
87
+ state_1.JsGetActiveContractsResponseItemSchema,
88
+ errors_2.JsCantonErrorSchema,
89
+ errors_2.WsCantonErrorSchema,
90
+ ]);
91
+ /** Convert a Canton error response to a proper Error object */
92
+ function toError(errorResponse) {
93
+ // JsCantonError has 'message' string, WsCantonError has 'cause' string
94
+ // JsCantonError has code as object, WsCantonError has code as string
95
+ if ('cause' in errorResponse) {
96
+ // WsCantonError
97
+ return new errors_1.ApiError(`WebSocket error [${errorResponse.code}]: ${errorResponse.cause}`);
98
+ }
99
+ // JsCantonError
100
+ const codeStr = JSON.stringify(errorResponse.code);
101
+ return new errors_1.ApiError(`WebSocket error [${codeStr}]: ${errorResponse.message}`);
102
+ }
103
+ /** Close code the participant sends once it has sent the whole snapshot. */
104
+ const SNAPSHOT_COMPLETE_CLOSE_CODE = 1000;
105
+ /**
106
+ * The error a socket close stands for, or `undefined` when the close completes the snapshot.
107
+ *
108
+ * The participant reports failures as error frames and closes with 1000 after the last item. Every close that
109
+ * `WebSocketClient` starts itself reports an error first, so any other code that reaches `onClose` comes from the peer
110
+ * or the network: a dropped connection (1006), a proxy idle timeout or a server going away (1001). The items received
111
+ * before it are only part of the snapshot.
112
+ */
113
+ function activeContractsCloseError(code, reason) {
114
+ if (code === SNAPSHOT_COMPLETE_CLOSE_CODE)
115
+ return undefined;
116
+ return new errors_1.ApiError(`Active-contracts stream closed before the snapshot completed [${code}]${reason === '' ? '' : `: ${reason}`}`);
117
+ }
118
+ function decodeActiveContractsFrame(parsed) {
119
+ const decoded = ActiveContractsResponseMessageSchema.safeParse(parsed);
120
+ if (!decoded.success) {
121
+ return { error: new errors_1.ApiError('Unexpected active-contracts WebSocket message') };
122
+ }
123
+ const message = decoded.data;
124
+ // Distinguish item vs error union members; treat any non-item as an error message
125
+ return 'contractEntry' in message ? { item: message } : { error: toError(message) };
126
+ }
127
+ //# sourceMappingURL=active-contracts-request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"active-contracts-request.js","sourceRoot":"","sources":["../../../../../../../src/clients/ledger-json-api/operations/v2/state/active-contracts-request.ts"],"names":[],"mappings":";;;;;;AAAA,6BAAwB;AACxB,uDAAsD;AACtD,oEAA8E;AAE9E,wDAKqC;AACrC,sDAGoC;AACpC,wEAAiE;AAEjE,4FAA4F;AAC/E,QAAA,qBAAqB,GAAG,4BAAqC,CAAC;AAE3E;;;;;;;;GAQG;AACH,MAAM,uBAAuB,GAAG,oCAAuB,CAAC;AAE3C,QAAA,2BAA2B,GAAG,OAAC,CAAC,MAAM,CAAC;IAClD,oDAAoD;IACpD,OAAO,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACvC,qDAAqD;IACrD,WAAW,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC3C,sDAAsD;IACtD,YAAY,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC5C,yEAAyE;IACzE,oBAAoB,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC5C,4FAA4F;IAC5F,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MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,EAAE,CAC9G,CAAC;AACJ,CAAC;AAED,oCAA2C,MAAe;IACxD,MAAM,OAAO,GAAG,oCAAoC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACvE,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACrB,OAAO,EAAE,KAAK,EAAE,IAAI,iBAAQ,CAAC,+CAA+C,CAAC,EAAE,CAAC;IAClF,CAAC;IACD,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAE7B,kFAAkF;IAClF,OAAO,eAAe,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;AACtF,CAAC"}
@@ -1,22 +1,20 @@
1
- import { z } from 'zod';
2
1
  import type { LedgerJsonApiClient } from '../../../LedgerJsonApiClient.generated';
3
2
  import { type JsGetActiveContractsResponse, type JsGetActiveContractsResponseItem } from '../../../schemas/api/state';
3
+ import { type ActiveContractsParams } from './active-contracts-request';
4
4
  /**
5
5
  * We intentionally do not expose the JSON/REST version of this endpoint. The REST variant is too limited, while the
6
6
  * WebSocket variant returns the same snapshot and automatically closes the connection once the current state is sent.
7
7
  * Wrapping the WebSocket call behind a simple awaitable method gives a better DX and keeps the door open for optional
8
- * streaming via a callback.
8
+ * streaming via a callback. To read a snapshot without holding it in memory, use `streamActiveContracts`.
9
+ *
10
+ * The promise resolves only on the participant's normal close (1000) after the last item. Any other close, such as a
11
+ * dropped connection, rejects instead of resolving with part of the snapshot.
12
+ *
13
+ * When `activeAtOffset` is omitted the snapshot is read at the ledger end, and the result does not say which offset
14
+ * that was. A reader that continues with `subscribeToUpdates` passes `activeAtOffset` explicitly and the same value as
15
+ * `beginExclusive`; reading the ledger end again instead would skip the updates in between.
9
16
  */
10
- declare const ActiveContractsParamsSchema: z.ZodObject<{
11
- parties: z.ZodOptional<z.ZodArray<z.ZodString>>;
12
- templateIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
13
- interfaceIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
14
- includeInterfaceView: z.ZodOptional<z.ZodBoolean>;
15
- includeCreatedEventBlob: z.ZodOptional<z.ZodBoolean>;
16
- activeAtOffset: z.ZodOptional<z.ZodNumber>;
17
- idleTimeoutMs: z.ZodOptional<z.ZodNumber>;
18
- }, z.core.$strip>;
19
- export type GetActiveContractsParams = z.infer<typeof ActiveContractsParamsSchema> & {
17
+ export type GetActiveContractsParams = ActiveContractsParams & {
20
18
  /** Optional per-item callback to consume results as they arrive. */
21
19
  onItem?: (item: JsGetActiveContractsResponseItem) => void | Promise<void>;
22
20
  };
@@ -25,5 +23,4 @@ export declare class GetActiveContracts {
25
23
  constructor(client: LedgerJsonApiClient);
26
24
  execute(params: GetActiveContractsParams): Promise<JsGetActiveContractsResponse>;
27
25
  }
28
- export {};
29
26
  //# sourceMappingURL=get-active-contracts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-active-contracts.d.ts","sourceRoot":"","sources":["../../../../../../../src/clients/ledger-json-api/operations/v2/state/get-active-contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAOlF,OAAO,EAEL,KAAK,4BAA4B,EACjC,KAAK,gCAAgC,EACtC,MAAM,4BAA4B,CAAC;AAgBpC;;;;;GAKG;AAEH,QAAA,MAAM,2BAA2B;;;;;;;;iBAe/B,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,GAAG;IACnF,oEAAoE;IACpE,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,gCAAgC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3E,CAAC;AAEF,qBAAa,kBAAkB;IACjB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAAnC,YAA6B,MAAM,EAAE,mBAAmB,EAAI;IAE/C,OAAO,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAuH5F;CACF"}
1
+ {"version":3,"file":"get-active-contracts.d.ts","sourceRoot":"","sources":["../../../../../../../src/clients/ledger-json-api/operations/v2/state/get-active-contracts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAClF,OAAO,EAAE,KAAK,4BAA4B,EAAE,KAAK,gCAAgC,EAAE,MAAM,4BAA4B,CAAC;AACtH,OAAO,EAKL,KAAK,qBAAqB,EAE3B,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;;;;;GAYG;AAEH,MAAM,MAAM,wBAAwB,GAAG,qBAAqB,GAAG;IAC7D,oEAAoE;IACpE,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,gCAAgC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3E,CAAC;AAEF,qBAAa,kBAAkB;IACjB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAAnC,YAA6B,MAAM,EAAE,mBAAmB,EAAI;IAE/C,OAAO,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAuD5F;CACF"}