@canton-network/core-tx-visualizer 0.8.1 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,93 +1,552 @@
1
- // Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { PreparedTransaction } from '@canton-network/core-ledger-proto';
4
- import { computePreparedTransaction } from './hashing_scheme_v2.js';
5
- import { fromBase64, toBase64, toHex } from './utils.js';
6
- export { computeSha256CantonHash, computeMultiHashForTopology, } from './hashing_scheme_v2.js';
7
- /**
8
- * Decodes a base64 encoded prepared transaction into a well-typed data model, generated directly from Protobuf definitions.
9
- *
10
- * @param preparedTransaction - The prepared transaction in base64 format
11
- * @returns The decoded prepared transaction
12
- */
13
- export const decodePreparedTransaction = (preparedTransaction) => {
14
- const bytes = fromBase64(preparedTransaction);
15
- return PreparedTransaction.fromBinary(bytes);
16
- };
17
- /**
18
- * Computes the hash of a prepared transaction.
19
- *
20
- * @param preparedTransaction - The prepared transaction to hash
21
- * @param format - The format of the output hash (base64 or hex)
22
- * @returns The computed hash in the specified format
23
- */
24
- export const hashPreparedTransaction = async (preparedTransaction, format = 'base64') => {
25
- let preparedTx;
26
- if (typeof preparedTransaction === 'string') {
27
- preparedTx = decodePreparedTransaction(preparedTransaction);
1
+ import { HashingSchemeVersion, PreparedTransaction } from '@canton-network/core-ledger-proto';
2
+
3
+ // src/index.ts
4
+
5
+ // src/utils.ts
6
+ function fromBase64(b64) {
7
+ const binaryString = atob(b64);
8
+ const len = binaryString.length;
9
+ const bytes = new Uint8Array(len);
10
+ for (let i = 0; i < len; i++) {
11
+ bytes[i] = binaryString.charCodeAt(i);
12
+ }
13
+ return bytes;
14
+ }
15
+ function toBase64(data) {
16
+ let binaryString = "";
17
+ const len = data.byteLength;
18
+ for (let i = 0; i < len; i++) {
19
+ binaryString += String.fromCharCode(data[i]);
20
+ }
21
+ return btoa(binaryString);
22
+ }
23
+ function toHex(bytes) {
24
+ return Array.from(bytes).map((byte) => byte.toString(16).padStart(2, "0")).join("");
25
+ }
26
+ async function sha256(message) {
27
+ const msg = typeof message === "string" ? new TextEncoder().encode(message) : message;
28
+ return crypto.subtle.digest("SHA-256", new Uint8Array(msg)).then((hash) => new Uint8Array(hash));
29
+ }
30
+ async function mkByteArray(...args) {
31
+ const normalizedArgs = args.map((arg) => {
32
+ if (typeof arg === "number") {
33
+ return new Uint8Array([arg]);
34
+ } else {
35
+ return arg;
28
36
  }
29
- else {
30
- preparedTx = preparedTransaction;
37
+ });
38
+ let totalLength = 0;
39
+ normalizedArgs.forEach((arg) => {
40
+ totalLength += arg.length;
41
+ });
42
+ const mergedArray = new Uint8Array(totalLength);
43
+ let offset = 0;
44
+ normalizedArgs.forEach((arg) => {
45
+ mergedArray.set(arg, offset);
46
+ offset += arg.length;
47
+ });
48
+ return mergedArray;
49
+ }
50
+
51
+ // src/hashing_scheme_v2.ts
52
+ var PREPARED_TRANSACTION_HASH_PURPOSE = Uint8Array.from([
53
+ 0,
54
+ 0,
55
+ 0,
56
+ 48
57
+ ]);
58
+ var NODE_ENCODING_VERSION = Uint8Array.from([1]);
59
+ var HASHING_SCHEME_VERSION = Uint8Array.from([HashingSchemeVersion.V2]);
60
+ async function encodeBool(value) {
61
+ return new Uint8Array([value ? 1 : 0]);
62
+ }
63
+ async function encodeInt32(value) {
64
+ const buffer = new ArrayBuffer(4);
65
+ const view = new DataView(buffer);
66
+ view.setInt32(0, value, false);
67
+ return new Uint8Array(buffer);
68
+ }
69
+ async function encodeInt64(value) {
70
+ const num = typeof value === "bigint" ? value : BigInt(value || 0);
71
+ const buffer = new ArrayBuffer(8);
72
+ const view = new DataView(buffer);
73
+ view.setBigInt64(0, num, false);
74
+ return new Uint8Array(buffer);
75
+ }
76
+ async function encodeString(value = "") {
77
+ const utf8Bytes = new TextEncoder().encode(value);
78
+ return encodeBytes(utf8Bytes);
79
+ }
80
+ async function encodeBytes(value) {
81
+ const length = await encodeInt32(value.length);
82
+ return mkByteArray(length, value);
83
+ }
84
+ async function encodeHash(value) {
85
+ return value;
86
+ }
87
+ function encodeHexString(value = "") {
88
+ const bytes = new Uint8Array(value.length / 2);
89
+ for (let i = 0; i < value.length; i += 2) {
90
+ bytes[i / 2] = parseInt(value.slice(i, i + 2), 16);
91
+ }
92
+ return encodeBytes(bytes);
93
+ }
94
+ async function encodeOptional(value, encodeFn) {
95
+ if (value === void 0 || value === null) {
96
+ return new Uint8Array([0]);
97
+ } else {
98
+ return mkByteArray(1, await encodeFn(value));
99
+ }
100
+ }
101
+ async function encodeProtoOptional(parentValue, fieldName, value, encodeFn) {
102
+ if (parentValue && parentValue[fieldName] !== void 0) {
103
+ return mkByteArray(1, await encodeFn(value));
104
+ } else {
105
+ return new Uint8Array([0]);
106
+ }
107
+ }
108
+ async function encodeRepeated(values = [], encodeFn) {
109
+ const length = await encodeInt32(values.length);
110
+ const encodedValues = await Promise.all(values.map(encodeFn));
111
+ return mkByteArray(length, ...encodedValues);
112
+ }
113
+ function findSeed(nodeId, nodeSeeds) {
114
+ const seed = nodeSeeds.find(
115
+ (seed2) => seed2.nodeId.toString() === nodeId
116
+ )?.seed;
117
+ return seed;
118
+ }
119
+ async function encodeIdentifier(identifier) {
120
+ return mkByteArray(
121
+ await encodeString(identifier.packageId),
122
+ await encodeRepeated(identifier.moduleName.split("."), encodeString),
123
+ await encodeRepeated(identifier.entityName.split("."), encodeString)
124
+ );
125
+ }
126
+ async function encodeMetadata(metadata) {
127
+ return mkByteArray(
128
+ Uint8Array.from([1]),
129
+ await encodeRepeated(metadata.submitterInfo?.actAs, encodeString),
130
+ await encodeString(metadata.submitterInfo?.commandId),
131
+ await encodeString(metadata.transactionUuid),
132
+ await encodeInt32(metadata.mediatorGroup),
133
+ await encodeString(metadata.synchronizerId),
134
+ await encodeProtoOptional(
135
+ metadata,
136
+ "minLedgerEffectiveTime",
137
+ metadata.minLedgerEffectiveTime,
138
+ encodeInt64
139
+ ),
140
+ await encodeProtoOptional(
141
+ metadata,
142
+ "maxLedgerEffectiveTime",
143
+ metadata.maxLedgerEffectiveTime,
144
+ encodeInt64
145
+ ),
146
+ await encodeInt64(metadata.preparationTime),
147
+ await encodeRepeated(metadata.inputContracts, encodeInputContract)
148
+ );
149
+ }
150
+ async function encodeCreateNode(create, nodeId, nodeSeeds) {
151
+ return create ? mkByteArray(
152
+ NODE_ENCODING_VERSION,
153
+ await encodeString(create.lfVersion),
154
+ 0,
155
+ await encodeOptional(findSeed(nodeId, nodeSeeds), encodeHash),
156
+ await encodeHexString(create.contractId),
157
+ await encodeString(create.packageName),
158
+ await encodeIdentifier(create.templateId),
159
+ await encodeValue(create.argument),
160
+ await encodeRepeated(create.signatories, encodeString),
161
+ await encodeRepeated(create.stakeholders, encodeString)
162
+ ) : mkByteArray();
163
+ }
164
+ async function encodeExerciseNode(exercise, nodeId, nodesDict, nodeSeeds) {
165
+ return mkByteArray(
166
+ NODE_ENCODING_VERSION,
167
+ await encodeString(exercise.lfVersion),
168
+ 1,
169
+ await encodeHash(findSeed(nodeId, nodeSeeds)),
170
+ await encodeHexString(exercise.contractId),
171
+ await encodeString(exercise.packageName),
172
+ await encodeIdentifier(exercise.templateId),
173
+ await encodeRepeated(exercise.signatories, encodeString),
174
+ await encodeRepeated(exercise.stakeholders, encodeString),
175
+ await encodeRepeated(exercise.actingParties, encodeString),
176
+ await encodeProtoOptional(
177
+ exercise,
178
+ "interfaceId",
179
+ exercise.interfaceId,
180
+ encodeIdentifier
181
+ ),
182
+ await encodeString(exercise.choiceId),
183
+ await encodeValue(exercise.chosenValue),
184
+ await encodeBool(exercise.consuming),
185
+ await encodeProtoOptional(
186
+ exercise,
187
+ "exerciseResult",
188
+ exercise.exerciseResult,
189
+ encodeValue
190
+ ),
191
+ await encodeRepeated(exercise.choiceObservers, encodeString),
192
+ await encodeRepeated(
193
+ exercise.children,
194
+ encodeNodeId(nodesDict, nodeSeeds)
195
+ )
196
+ );
197
+ }
198
+ async function encodeFetchNode(fetch) {
199
+ return mkByteArray(
200
+ NODE_ENCODING_VERSION,
201
+ await encodeString(fetch.lfVersion),
202
+ 2,
203
+ await encodeHexString(fetch.contractId),
204
+ await encodeString(fetch.packageName),
205
+ await encodeIdentifier(fetch.templateId),
206
+ await encodeRepeated(fetch.signatories, encodeString),
207
+ await encodeRepeated(fetch.stakeholders, encodeString),
208
+ await encodeProtoOptional(
209
+ fetch,
210
+ "interfaceId",
211
+ fetch.interfaceId,
212
+ encodeIdentifier
213
+ ),
214
+ await encodeRepeated(fetch.actingParties, encodeString)
215
+ );
216
+ }
217
+ async function encodeRollbackNode(rollback, nodesDict, nodeSeeds) {
218
+ return mkByteArray(
219
+ NODE_ENCODING_VERSION,
220
+ 3,
221
+ await encodeRepeated(
222
+ rollback.children,
223
+ encodeNodeId(nodesDict, nodeSeeds)
224
+ )
225
+ );
226
+ }
227
+ async function encodeInputContract(contract) {
228
+ if (contract.contract.oneofKind === "v1")
229
+ return mkByteArray(
230
+ await encodeInt64(contract.createdAt),
231
+ await sha256(
232
+ await encodeCreateNode(
233
+ contract.contract.v1,
234
+ "unused_node_id",
235
+ []
236
+ )
237
+ )
238
+ );
239
+ else throw new Error("Unsupported contract version");
240
+ }
241
+ async function encodeValue(value) {
242
+ if (value.sum.oneofKind === "unit") {
243
+ return Uint8Array.from([0]);
244
+ } else if (value.sum.oneofKind === "bool") {
245
+ return mkByteArray(
246
+ Uint8Array.from([1]),
247
+ await encodeBool(value.sum.bool)
248
+ );
249
+ } else if (value.sum.oneofKind === "int64") {
250
+ return mkByteArray(
251
+ Uint8Array.from([2]),
252
+ await encodeInt64(parseInt(value.sum.int64))
253
+ );
254
+ } else if (value.sum.oneofKind === "numeric") {
255
+ return mkByteArray(
256
+ Uint8Array.from([3]),
257
+ await encodeString(value.sum.numeric)
258
+ );
259
+ } else if (value.sum.oneofKind === "timestamp") {
260
+ return mkByteArray(
261
+ Uint8Array.from([4]),
262
+ await encodeInt64(BigInt(value.sum.timestamp))
263
+ );
264
+ } else if (value.sum.oneofKind === "date") {
265
+ return mkByteArray(
266
+ Uint8Array.from([5]),
267
+ await encodeInt32(value.sum.date)
268
+ );
269
+ } else if (value.sum.oneofKind === "party") {
270
+ return mkByteArray(
271
+ Uint8Array.from([6]),
272
+ await encodeString(value.sum.party)
273
+ );
274
+ } else if (value.sum.oneofKind === "text") {
275
+ return mkByteArray(
276
+ Uint8Array.from([7]),
277
+ await encodeString(value.sum.text)
278
+ );
279
+ } else if (value.sum.oneofKind === "contractId") {
280
+ return mkByteArray(
281
+ Uint8Array.from([8]),
282
+ await encodeHexString(value.sum.contractId)
283
+ );
284
+ } else if (value.sum.oneofKind === "optional") {
285
+ return mkByteArray(
286
+ Uint8Array.from([9]),
287
+ await encodeProtoOptional(
288
+ value.sum.optional,
289
+ "value",
290
+ value.sum.optional.value,
291
+ encodeValue
292
+ )
293
+ );
294
+ } else if (value.sum.oneofKind === "list") {
295
+ return mkByteArray(
296
+ Uint8Array.from([10]),
297
+ await encodeRepeated(value.sum.list.elements, encodeValue)
298
+ );
299
+ } else if (value.sum.oneofKind === "textMap") {
300
+ return mkByteArray(
301
+ Uint8Array.from([11]),
302
+ await encodeRepeated(value.sum.textMap?.entries, encodeTextMapEntry)
303
+ );
304
+ } else if (value.sum.oneofKind === "record") {
305
+ return mkByteArray(
306
+ Uint8Array.from([12]),
307
+ await encodeProtoOptional(
308
+ value.sum.record,
309
+ "recordId",
310
+ value.sum.record.recordId,
311
+ encodeIdentifier
312
+ ),
313
+ await encodeRepeated(value.sum.record.fields, encodeRecordField)
314
+ );
315
+ } else if (value.sum.oneofKind === "variant") {
316
+ return mkByteArray(
317
+ Uint8Array.from([13]),
318
+ await encodeProtoOptional(
319
+ value.sum.variant,
320
+ "variantId",
321
+ value.sum.variant.variantId,
322
+ encodeIdentifier
323
+ ),
324
+ await encodeString(value.sum.variant.constructor),
325
+ await encodeValue(value.sum.variant.value)
326
+ );
327
+ } else if (value.sum.oneofKind === "enum") {
328
+ return mkByteArray(
329
+ Uint8Array.from([14]),
330
+ await encodeProtoOptional(
331
+ value.sum.enum,
332
+ "enumId",
333
+ value.sum.enum.enumId,
334
+ encodeIdentifier
335
+ ),
336
+ await encodeString(value.sum.enum.constructor)
337
+ );
338
+ } else if (value.sum.oneofKind === "genMap") {
339
+ return mkByteArray(
340
+ Uint8Array.from([15]),
341
+ await encodeRepeated(value.sum.genMap?.entries, encodeGenMapEntry)
342
+ );
343
+ }
344
+ throw new Error("Unsupported value type: " + JSON.stringify(value));
345
+ }
346
+ async function encodeTextMapEntry(entry) {
347
+ return mkByteArray(
348
+ await encodeString(entry.key),
349
+ await encodeValue(entry.value)
350
+ );
351
+ }
352
+ async function encodeRecordField(field) {
353
+ return mkByteArray(
354
+ await encodeOptional(field.label, encodeString),
355
+ await encodeValue(field.value)
356
+ );
357
+ }
358
+ async function encodeGenMapEntry(entry) {
359
+ return mkByteArray(
360
+ await encodeValue(entry.key),
361
+ await encodeValue(entry.value)
362
+ );
363
+ }
364
+ function encodeNodeId(nodesDict, nodeSeeds) {
365
+ return async (nodeId) => {
366
+ const node = nodesDict[nodeId];
367
+ if (!node) {
368
+ throw new Error(`Node with ID ${nodeId} not found in transaction`);
31
369
  }
32
- const hash = await computePreparedTransaction(preparedTx);
33
- switch (format) {
34
- case 'base64':
35
- return toBase64(hash);
36
- case 'hex':
37
- return toHex(hash);
370
+ const encodedNode = await encodeNode(node, nodesDict, nodeSeeds);
371
+ return sha256(encodedNode);
372
+ };
373
+ }
374
+ async function encodeNode(node, nodesDict, nodeSeeds) {
375
+ if (node.versionedNode.oneofKind === "v1") {
376
+ if (node.versionedNode.v1.nodeType.oneofKind === "create") {
377
+ return encodeCreateNode(
378
+ node.versionedNode.v1.nodeType.create,
379
+ node.nodeId,
380
+ nodeSeeds
381
+ );
382
+ } else if (node.versionedNode.v1.nodeType.oneofKind === "exercise") {
383
+ return encodeExerciseNode(
384
+ node.versionedNode.v1.nodeType.exercise,
385
+ node.nodeId,
386
+ nodesDict,
387
+ nodeSeeds
388
+ );
389
+ } else if (node.versionedNode.v1.nodeType.oneofKind === "fetch") {
390
+ return encodeFetchNode(node.versionedNode.v1.nodeType.fetch);
391
+ } else if (node.versionedNode.v1.nodeType.oneofKind === "rollback") {
392
+ return encodeRollbackNode(
393
+ node.versionedNode.v1.nodeType.rollback,
394
+ nodesDict,
395
+ nodeSeeds
396
+ );
38
397
  }
398
+ throw new Error("Unsupported node type");
399
+ } else {
400
+ throw new Error(`Unsupported node version`);
401
+ }
402
+ }
403
+ function createNodesDict(preparedTransaction) {
404
+ const nodesDict = {};
405
+ const nodes = preparedTransaction.transaction?.nodes || [];
406
+ for (const node of nodes) {
407
+ nodesDict[node.nodeId] = node;
408
+ }
409
+ return nodesDict;
410
+ }
411
+ async function encodeTransaction(transaction, nodesDict, nodeSeeds) {
412
+ return mkByteArray(
413
+ await encodeString(transaction.version),
414
+ await encodeRepeated(
415
+ transaction.roots,
416
+ encodeNodeId(nodesDict, nodeSeeds)
417
+ )
418
+ );
419
+ }
420
+ async function hashTransaction(transaction, nodesDict) {
421
+ const encodedTransaction = await encodeTransaction(
422
+ transaction,
423
+ nodesDict,
424
+ transaction.nodeSeeds
425
+ );
426
+ const hash = await sha256(
427
+ await mkByteArray(PREPARED_TRANSACTION_HASH_PURPOSE, encodedTransaction)
428
+ );
429
+ return hash;
430
+ }
431
+ async function hashMetadata(metadata) {
432
+ const hash = await sha256(
433
+ await mkByteArray(
434
+ PREPARED_TRANSACTION_HASH_PURPOSE,
435
+ await encodeMetadata(metadata)
436
+ )
437
+ );
438
+ return hash;
439
+ }
440
+ async function encodePreparedTransaction(preparedTransaction) {
441
+ const nodesDict = createNodesDict(preparedTransaction);
442
+ const transactionHash = await hashTransaction(
443
+ preparedTransaction.transaction,
444
+ nodesDict
445
+ );
446
+ const metadataHash = await hashMetadata(preparedTransaction.metadata);
447
+ return mkByteArray(
448
+ PREPARED_TRANSACTION_HASH_PURPOSE,
449
+ HASHING_SCHEME_VERSION,
450
+ transactionHash,
451
+ metadataHash
452
+ );
453
+ }
454
+ async function computePreparedTransaction(preparedTransaction) {
455
+ return sha256(await encodePreparedTransaction(preparedTransaction));
456
+ }
457
+ async function computeSha256CantonHash(purpose, bytes) {
458
+ const encodedPurpose = await encodeInt32(purpose);
459
+ const hashInput = await mkByteArray(encodedPurpose, bytes);
460
+ const hashBytes = await sha256(hashInput);
461
+ const multiprefix = new Uint8Array([18, 32]);
462
+ return mkByteArray(multiprefix, hashBytes);
463
+ }
464
+ async function computeMultiHashForTopology(hashes) {
465
+ const sortedHashes = hashes.slice().sort((a, b) => toHex(a).localeCompare(toHex(b)));
466
+ const numHashesBytes = await encodeInt32(sortedHashes.length);
467
+ const concatenatedHashes = [numHashesBytes];
468
+ for (const h of sortedHashes) {
469
+ const lengthBytes = await encodeInt32(h.length);
470
+ concatenatedHashes.push(lengthBytes, h);
471
+ }
472
+ return mkByteArray(...concatenatedHashes);
473
+ }
474
+
475
+ // src/index.ts
476
+ var decodePreparedTransaction = (preparedTransaction) => {
477
+ const bytes = fromBase64(preparedTransaction);
478
+ return PreparedTransaction.fromBinary(bytes);
39
479
  };
40
- export const validateAuthorizedPartyIds = (preparedTransaction, authorizedPartyIds) => {
41
- let preparedTx;
42
- if (typeof preparedTransaction === 'string') {
43
- preparedTx = decodePreparedTransaction(preparedTransaction);
44
- }
45
- else {
46
- preparedTx = preparedTransaction;
47
- }
48
- const results = {};
49
- preparedTx.metadata?.submitterInfo?.actAs.forEach((party) => {
50
- results[party] = {
51
- isAuthorized: authorizedPartyIds.includes(party),
52
- locations: [
480
+ var hashPreparedTransaction = async (preparedTransaction, format = "base64") => {
481
+ let preparedTx;
482
+ if (typeof preparedTransaction === "string") {
483
+ preparedTx = decodePreparedTransaction(preparedTransaction);
484
+ } else {
485
+ preparedTx = preparedTransaction;
486
+ }
487
+ const hash = await computePreparedTransaction(preparedTx);
488
+ switch (format) {
489
+ case "base64":
490
+ return toBase64(hash);
491
+ case "hex":
492
+ return toHex(hash);
493
+ }
494
+ };
495
+ var validateAuthorizedPartyIds = (preparedTransaction, authorizedPartyIds) => {
496
+ let preparedTx;
497
+ if (typeof preparedTransaction === "string") {
498
+ preparedTx = decodePreparedTransaction(preparedTransaction);
499
+ } else {
500
+ preparedTx = preparedTransaction;
501
+ }
502
+ const results = {};
503
+ preparedTx.metadata?.submitterInfo?.actAs.forEach((party) => {
504
+ results[party] = {
505
+ isAuthorized: authorizedPartyIds.includes(party),
506
+ locations: [
507
+ ...results[party].locations,
508
+ "metadata.submitterInfo.actAs"
509
+ ]
510
+ };
511
+ });
512
+ preparedTx.transaction?.nodes.forEach((node) => {
513
+ if (node.versionedNode.oneofKind === "v1") {
514
+ if (node.versionedNode.v1.nodeType.oneofKind === "create") {
515
+ node.versionedNode.v1.nodeType.create.signatories.forEach(
516
+ (party) => {
517
+ results[party] = {
518
+ isAuthorized: authorizedPartyIds.includes(party),
519
+ locations: [
520
+ ...results[party].locations,
521
+ `transaction.nodes.${node.nodeId}.create.signatories`
522
+ ]
523
+ };
524
+ }
525
+ );
526
+ node.versionedNode.v1.nodeType.create.stakeholders.forEach(
527
+ (party) => {
528
+ results[party] = {
529
+ isAuthorized: authorizedPartyIds.includes(party),
530
+ locations: [
53
531
  ...results[party].locations,
54
- 'metadata.submitterInfo.actAs',
55
- ],
56
- };
57
- });
58
- // then check transaction nodes
59
- preparedTx.transaction?.nodes.forEach((node) => {
60
- if (node.versionedNode.oneofKind === 'v1') {
61
- if (node.versionedNode.v1.nodeType.oneofKind === 'create') {
62
- node.versionedNode.v1.nodeType.create.signatories.forEach((party) => {
63
- results[party] = {
64
- isAuthorized: authorizedPartyIds.includes(party),
65
- locations: [
66
- ...results[party].locations,
67
- `transaction.nodes.${node.nodeId}.create.signatories`,
68
- ],
69
- };
70
- });
71
- node.versionedNode.v1.nodeType.create.stakeholders.forEach((party) => {
72
- results[party] = {
73
- isAuthorized: authorizedPartyIds.includes(party),
74
- locations: [
75
- ...results[party].locations,
76
- `transaction.nodes.${node.nodeId}.create.stakeholders`,
77
- ],
78
- };
79
- });
80
- }
81
- if (node.versionedNode.v1.nodeType.oneofKind === 'exercise') {
82
- throw new Error('Unsupported');
83
- }
84
- if (node.versionedNode.v1.nodeType.oneofKind === 'fetch') {
85
- throw new Error('Unsupported');
86
- }
87
- if (node.versionedNode.v1.nodeType.oneofKind === 'rollback') {
88
- // do we need to check these nodes?
89
- }
90
- }
91
- });
92
- return results;
532
+ `transaction.nodes.${node.nodeId}.create.stakeholders`
533
+ ]
534
+ };
535
+ }
536
+ );
537
+ }
538
+ if (node.versionedNode.v1.nodeType.oneofKind === "exercise") {
539
+ throw new Error("Unsupported");
540
+ }
541
+ if (node.versionedNode.v1.nodeType.oneofKind === "fetch") {
542
+ throw new Error("Unsupported");
543
+ }
544
+ if (node.versionedNode.v1.nodeType.oneofKind === "rollback") ;
545
+ }
546
+ });
547
+ return results;
93
548
  };
549
+
550
+ export { computeMultiHashForTopology, computeSha256CantonHash, decodePreparedTransaction, hashPreparedTransaction, validateAuthorizedPartyIds };
551
+ //# sourceMappingURL=index.js.map
552
+ //# sourceMappingURL=index.js.map