@fairmint/canton-node-sdk 0.0.33 → 0.0.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Fairmint
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,14 +1,16 @@
1
1
  import { z } from 'zod';
2
2
  import type { paths } from '../../../../../generated/openapi-types';
3
3
  declare const endpoint: "/v2/updates/update-by-id";
4
- export type GetUpdateByIdParams = paths[typeof endpoint]['post']['requestBody']['content']['application/json'];
4
+ export type GetUpdateByIdParams = {
5
+ /** The ID of the update to fetch. */
6
+ updateId: string;
7
+ /** Parties to read as (optional). */
8
+ readAs: string[];
9
+ };
5
10
  export type GetUpdateByIdResponse = paths[typeof endpoint]['post']['responses']['200']['content']['application/json'];
6
11
  export declare const GetUpdateById: {
7
12
  new (client: import("../../../../../core").BaseClient): {
8
- execute(params: {
9
- updateId: string;
10
- updateFormat?: import("../../../../../generated/openapi-types").components["schemas"]["UpdateFormat"];
11
- }): Promise<{
13
+ execute(params: GetUpdateByIdParams): Promise<{
12
14
  update: import("../../../../../generated/openapi-types").components["schemas"]["Update"];
13
15
  }>;
14
16
  client: import("../../../../../core").BaseClient;
@@ -1 +1 @@
1
- {"version":3,"file":"get-update-by-id.d.ts","sourceRoot":"","sources":["../../../../../../../src/clients/ledger-json-api/operations/v2/updates/get-update-by-id.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AAEpE,QAAA,MAAM,QAAQ,EAAG,0BAAmC,CAAC;AAErD,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AAC/G,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AAEtH,eAAO,MAAM,aAAa;;;;2BAK4jrE,sEAAsB;;oBAA6wuB,sEAAsB;;;;;;;;;;;;;CAA745F,CAAC"}
1
+ {"version":3,"file":"get-update-by-id.d.ts","sourceRoot":"","sources":["../../../../../../../src/clients/ledger-json-api/operations/v2/updates/get-update-by-id.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AAEpE,QAAA,MAAM,QAAQ,EAAG,0BAAmC,CAAC;AAGrD,MAAM,MAAM,mBAAmB,GAAG;IAChC,qCAAqC;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,qCAAqC;IACrC,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AAEtH,eAAO,MAAM,aAAa;;;oBA8Bs73F,sEAAsB;;;;;;;;;;;;;CAAp+3F,CAAC"}
@@ -5,9 +5,31 @@ const core_1 = require("../../../../../core");
5
5
  const zod_1 = require("zod");
6
6
  const endpoint = '/v2/updates/update-by-id';
7
7
  exports.GetUpdateById = (0, core_1.createApiOperation)({
8
- paramsSchema: zod_1.z.any(),
8
+ paramsSchema: zod_1.z.object({
9
+ updateId: zod_1.z.string().min(1, 'updateId must be a non-empty string'),
10
+ readAs: zod_1.z.array(zod_1.z.string()),
11
+ }),
9
12
  method: 'POST',
10
13
  buildUrl: (_params, apiUrl) => `${apiUrl}${endpoint}`,
11
- buildRequestData: (params) => params,
14
+ buildRequestData: (params) => {
15
+ // Validate updateId parameter
16
+ if (!params.updateId || params.updateId === 'undefined' || params.updateId.trim() === '') {
17
+ throw new Error(`Invalid updateId: "${params.updateId}". updateId must be a non-empty string.`);
18
+ }
19
+ // Build the request body according to the API specification
20
+ return {
21
+ updateId: params.updateId,
22
+ updateFormat: {
23
+ includeTransactions: {
24
+ eventFormat: {
25
+ verbose: true,
26
+ },
27
+ transactionShape: 'TRANSACTION_SHAPE_UNSPECIFIED',
28
+ },
29
+ },
30
+ // Include requestingParties if readAs is provided
31
+ ...(params.readAs && params.readAs.length > 0 && { requestingParties: params.readAs }),
32
+ };
33
+ },
12
34
  });
13
35
  //# sourceMappingURL=get-update-by-id.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-update-by-id.js","sourceRoot":"","sources":["../../../../../../../src/clients/ledger-json-api/operations/v2/updates/get-update-by-id.ts"],"names":[],"mappings":";;;AAAA,8CAAyD;AACzD,6BAAwB;AAGxB,MAAM,QAAQ,GAAG,0BAAmC,CAAC;AAKxC,QAAA,aAAa,GAAG,IAAA,yBAAkB,EAA6C;IAC1F,YAAY,EAAE,OAAC,CAAC,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM;IACd,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,GAAG,MAAM,GAAG,QAAQ,EAAE;IACrD,gBAAgB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM;CACrC,CAAC,CAAC"}
1
+ {"version":3,"file":"get-update-by-id.js","sourceRoot":"","sources":["../../../../../../../src/clients/ledger-json-api/operations/v2/updates/get-update-by-id.ts"],"names":[],"mappings":";;;AAAA,8CAAyD;AACzD,6BAAwB;AAGxB,MAAM,QAAQ,GAAG,0BAAmC,CAAC;AAYxC,QAAA,aAAa,GAAG,IAAA,yBAAkB,EAA6C;IAC1F,YAAY,EAAE,OAAC,CAAC,MAAM,CAAC;QACrB,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,qCAAqC,CAAC;QAClE,MAAM,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC;KAC5B,CAAC;IACF,MAAM,EAAE,MAAM;IACd,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,GAAG,MAAM,GAAG,QAAQ,EAAE;IACrD,gBAAgB,EAAE,CAAC,MAAM,EAAE,EAAE;QAC3B,8BAA8B;QAC9B,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,KAAK,WAAW,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YACzF,MAAM,IAAI,KAAK,CACb,sBAAsB,MAAM,CAAC,QAAQ,yCAAyC,CAC/E,CAAC;QACJ,CAAC;QAED,4DAA4D;QAC5D,OAAO;YACL,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,YAAY,EAAE;gBACZ,mBAAmB,EAAE;oBACnB,WAAW,EAAE;wBACX,OAAO,EAAE,IAAI;qBACd;oBACD,gBAAgB,EAAE,+BAA+B;iBAClD;aACF;YACD,kDAAkD;YAClD,GAAG,CAAC,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;SACvF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fairmint/canton-node-sdk",
3
- "version": "0.0.33",
3
+ "version": "0.0.35",
4
4
  "description": "Canton Node SDK",
5
5
  "main": "build/src/index.js",
6
6
  "types": "build/src/index.d.ts",