@layerzerolabs/common-canton 0.2.100 → 0.2.102

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.
@@ -9,11 +9,72 @@
9
9
  ✅ dpm-3.4.8-openapi-generator-7.21.0
10
10
  🔧 openapi-generator version: 7.21.0
11
11
  $ docker image inspect --format {{.Id}} 438003944538.dkr.ecr.us-east-1.amazonaws.com/layerzerolabs/canton-openapi-tooling:openapi-generator-7.21.0-patch-1
12
- (node:121901) [MODULE_TYPELESS_PACKAGE_JSON] Warning: Module type of file:///home/runner/work/monorepo-internal/monorepo-internal/configs/vm-tooling/values/docker-image-repo.ts is not specified and it doesn't parse as CommonJS.
12
+ (node:77726) [MODULE_TYPELESS_PACKAGE_JSON] Warning: Module type of file:///home/runner/work/monorepo-internal/monorepo-internal/configs/vm-tooling/values/docker-image-repo.ts is not specified and it doesn't parse as CommonJS.
13
13
  Reparsing as ES module because module syntax was detected. This incurs a performance overhead.
14
14
  To eliminate this warning, add "type": "module" to /home/runner/work/monorepo-internal/monorepo-internal/package.json.
15
15
  (Use `node --trace-warnings ...` to show where the warning was created)
16
- ✅ Using cached Docker image: 438003944538.dkr.ecr.us-east-1.amazonaws.com/layerzerolabs/canton-openapi-tooling:openapi-generator-7.21.0-patch-1
16
+ Error response from daemon: No such image: 438003944538.dkr.ecr.us-east-1.amazonaws.com/layerzerolabs/canton-openapi-tooling:openapi-generator-7.21.0-patch-1
17
+ 📥 Pulling Docker image from: 438003944538.dkr.ecr.us-east-1.amazonaws.com/layerzerolabs/canton-openapi-tooling:openapi-generator-7.21.0-patch-1
18
+ $ docker pull 438003944538.dkr.ecr.us-east-1.amazonaws.com/layerzerolabs/canton-openapi-tooling:openapi-generator-7.21.0-patch-1
19
+ openapi-generator-7.21.0-patch-1: Pulling from layerzerolabs/canton-openapi-tooling
20
+ 6ad39880009f: Pulling fs layer
21
+ de90d86cd9e8: Pulling fs layer
22
+ 320d9614051d: Pulling fs layer
23
+ 2105e5edb107: Pulling fs layer
24
+ d7fa639f53de: Pulling fs layer
25
+ ca7063794723: Pulling fs layer
26
+ 89b1ff25a2ba: Pulling fs layer
27
+ 24574a3c3b7e: Pulling fs layer
28
+ 72df4dc3c67b: Pulling fs layer
29
+ 66fb6c894d14: Pulling fs layer
30
+ f49710e34058: Pulling fs layer
31
+ 2c1ce468d9f3: Pulling fs layer
32
+ 72df4dc3c67b: Waiting
33
+ d7fa639f53de: Waiting
34
+ 66fb6c894d14: Waiting
35
+ 2c1ce468d9f3: Waiting
36
+ ca7063794723: Waiting
37
+ 89b1ff25a2ba: Waiting
38
+ f49710e34058: Waiting
39
+ 24574a3c3b7e: Waiting
40
+ 2105e5edb107: Waiting
41
+ de90d86cd9e8: Verifying Checksum
42
+ de90d86cd9e8: Download complete
43
+ 6ad39880009f: Verifying Checksum
44
+ 6ad39880009f: Download complete
45
+ 2105e5edb107: Download complete
46
+ d7fa639f53de: Verifying Checksum
47
+ d7fa639f53de: Download complete
48
+ 89b1ff25a2ba: Verifying Checksum
49
+ 89b1ff25a2ba: Download complete
50
+ 24574a3c3b7e: Download complete
51
+ 320d9614051d: Verifying Checksum
52
+ 320d9614051d: Download complete
53
+ ca7063794723: Verifying Checksum
54
+ ca7063794723: Download complete
55
+ 72df4dc3c67b: Verifying Checksum
56
+ 72df4dc3c67b: Download complete
57
+ 66fb6c894d14: Download complete
58
+ f49710e34058: Verifying Checksum
59
+ f49710e34058: Download complete
60
+ 2c1ce468d9f3: Verifying Checksum
61
+ 2c1ce468d9f3: Download complete
62
+ 6ad39880009f: Pull complete
63
+ de90d86cd9e8: Pull complete
64
+ 320d9614051d: Pull complete
65
+ 2105e5edb107: Pull complete
66
+ d7fa639f53de: Pull complete
67
+ ca7063794723: Pull complete
68
+ 89b1ff25a2ba: Pull complete
69
+ 24574a3c3b7e: Pull complete
70
+ 72df4dc3c67b: Pull complete
71
+ 66fb6c894d14: Pull complete
72
+ f49710e34058: Pull complete
73
+ 2c1ce468d9f3: Pull complete
74
+ Digest: sha256:4ef893994ed509c7de16aec1dc796d5065f53b415bd34f9c6801c2b7beb4b8a9
75
+ Status: Downloaded newer image for 438003944538.dkr.ecr.us-east-1.amazonaws.com/layerzerolabs/canton-openapi-tooling:openapi-generator-7.21.0-patch-1
76
+ 438003944538.dkr.ecr.us-east-1.amazonaws.com/layerzerolabs/canton-openapi-tooling:openapi-generator-7.21.0-patch-1
77
+ ✅ Successfully pulled: 438003944538.dkr.ecr.us-east-1.amazonaws.com/layerzerolabs/canton-openapi-tooling:openapi-generator-7.21.0-patch-1
17
78
  👤 Running container as UID:GID 1001:1001
18
79
  📜 Executing custom script: set -euo pipefail && rm -rf "src/open-api" && java -jar "$OPENAPI_GENERATOR_JAR" generate -i "$CANTON_OPENAPI_YAML" -g typescript-fetch -o "src/open-api" --additional-properties=importFileExtension=.js
19
80
  $ docker run --rm --add-host=host.docker.internal:host-gateway -e LOCAL_UID=1001 -e LOCAL_GID=1001 -v /home/runner/work/monorepo-internal/monorepo-internal:/workspace -w /workspace/packages/vms/canton/common-canton 438003944538.dkr.ecr.us-east-1.amazonaws.com/layerzerolabs/canton-openapi-tooling:openapi-generator-7.21.0-patch-1 bash -c $'set -euo pipefail && rm -rf "src/open-api" && java -jar "$OPENAPI_GENERATOR_JAR" generate -i "$CANTON_OPENAPI_YAML" -g typescript-fetch -o "src/open-api" --additional-properties=importFileExtension=.js'
@@ -695,21 +756,21 @@ $ docker run --rm --add-host=host.docker.internal:host-gateway -e LOCAL_UID=1001
695
756
  # We appreciate your support! Please consider donation to help us maintain this project. #
696
757
  # https://opencollective.com/openapi_generator/donate #
697
758
  ############################################################################################
698
- ⏳ bash -c set -euo pipefail && rm -rf "src/open-api" && java -jar "$OPENAPI_GENERATOR_JAR" generate -i "$CANTON_OPENAPI_YAML" -g typescript-fetch -o "src/open-api" --additional-properties=importFileExtension=.js: 4.954s
759
+ ⏳ bash -c set -euo pipefail && rm -rf "src/open-api" && java -jar "$OPENAPI_GENERATOR_JAR" generate -i "$CANTON_OPENAPI_YAML" -g typescript-fetch -o "src/open-api" --additional-properties=importFileExtension=.js: 4.746s
699
760
  Testing types with tsc and vue-tsc is an experimental feature.
700
761
  Breaking changes might not follow SemVer, please pin Vitest's version when using it.
701
762
 
702
763
   RUN  v3.2.4 /home/runner/work/monorepo-internal/monorepo-internal/packages/vms/canton/common-canton
703
764
 
704
- ✓ test/auth/client-credentials-token-provider.test.ts (7 tests) 18ms
705
- ✓ test/auth/local-token-provider.test.ts (5 tests) 14ms
765
+ ✓ test/auth/client-credentials-token-provider.test.ts (7 tests) 16ms
766
+ ✓ test/auth/local-token-provider.test.ts (5 tests) 11ms
706
767
  stderr | test/sdk.test.ts > Error Handling (Unhappy Paths) > should handle double archive error
707
768
  Mock miss: GET /v2/state/connected-synchronizers
708
769
 
709
770
  stderr | test/sdk.test.ts > Error Handling (Unhappy Paths) > should handle unauthorized party error
710
771
  Mock miss: GET /v2/state/connected-synchronizers
711
772
 
712
- ✓ test/sdk.test.ts (18 tests) 37ms
773
+ ✓ test/sdk.test.ts (18 tests) 35ms
713
774
  ✓  TS  test/sdk.test.ts (18 tests)
714
775
  ✓  TS  test/auth/client-credentials-token-provider.test.ts (7 tests)
715
776
  ✓  TS  test/auth/local-token-provider.test.ts (5 tests)
@@ -717,6 +778,6 @@ Breaking changes might not follow SemVer, please pin Vitest's version when using
717
778
   Test Files  6 passed (6)
718
779
   Tests  60 passed (60)
719
780
  Type Errors  no errors
720
-  Start at  16:50:07
721
-  Duration  4.06s (transform 1.25s, setup 0ms, collect 1.82s, tests 68ms, environment 1ms, prepare 611ms, typecheck 3.66s)
781
+  Start at  23:11:12
782
+  Duration  4.18s (transform 1.35s, setup 0ms, collect 2.20s, tests 61ms, environment 1ms, prepare 488ms, typecheck 3.80s)
722
783
 
@@ -44,18 +44,6 @@ var cantonDisclosedContractSchema = z.object({
44
44
  createdEventBlob: z.string(),
45
45
  synchronizerId: z.string()
46
46
  });
47
- var cantonTransactionSchema = transactionSchema.extend({
48
- populatedTransaction: z.object({
49
- /** Parties submitting the command (actAs) */
50
- actAs: z.array(z.string()),
51
- /** Daml commands to send to prepareForSigning */
52
- commands: z.array(cantonCommandSchema),
53
- /** Disclosed contracts for contract/key lookups */
54
- disclosedContracts: z.array(cantonDisclosedContractSchema),
55
- /** Maps each actAs party ID → senderEntityName that controls its signing key */
56
- partyToSenderEntity: z.record(z.string(), z.string())
57
- })
58
- });
59
47
  var _cantonInflightTransactionSchema = z.object({
60
48
  /** The prepared transaction blob */
61
49
  preparedTransaction: z.string(),
@@ -69,6 +57,18 @@ var _cantonInflightTransactionSchema = z.object({
69
57
  /** Command ID for tracking */
70
58
  commandId: z.string()
71
59
  });
60
+ var cantonTransactionSchema = transactionSchema.extend({
61
+ populatedTransaction: z.object({
62
+ /** Parties submitting the command (actAs) */
63
+ actAs: z.array(z.string()),
64
+ /** Daml commands to send to prepareForSigning */
65
+ commands: z.array(cantonCommandSchema),
66
+ /** Disclosed contracts for contract/key lookups */
67
+ disclosedContracts: z.array(cantonDisclosedContractSchema),
68
+ /** Maps each actAs party ID → senderEntityName that controls its signing key */
69
+ partyToSenderEntity: z.record(z.string(), z.string())
70
+ })
71
+ });
72
72
  var cantonAssignedTransactionSchema = assignedTransactionSchema.extend({
73
73
  ...cantonTransactionSchema.shape,
74
74
  inflightTransaction: _cantonInflightTransactionSchema.optional()
@@ -103,5 +103,5 @@ var buildCantonTransaction = /* @__PURE__ */ __name(async (chainName, tx) => {
103
103
  }, "buildCantonTransaction");
104
104
 
105
105
  export { buildCantonTransaction, cantonAssignedTransactionSchema, cantonCommandSchema, cantonDisclosedContractSchema, cantonMinedTransactionSchema, cantonSignedTransactionSchema, cantonTransactionSchema };
106
- //# sourceMappingURL=VK2IDAJ5.js.map
107
- //# sourceMappingURL=VK2IDAJ5.js.map
106
+ //# sourceMappingURL=CJEDJ6BA.js.map
107
+ //# sourceMappingURL=CJEDJ6BA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/transaction.ts"],"names":["createCommandSchema","z","object","templateId","string","createArguments","any","exerciseCommandSchema","contractId","choice","choiceArgument","createAndExerciseCommandSchema","exerciseByKeyCommandSchema","contractKey","cantonCommandSchema","union","createCommand","exerciseCommand","createAndExerciseCommand","exerciseByKeyCommand","cantonDisclosedContractSchema","optional","createdEventBlob","synchronizerId","_cantonInflightTransactionSchema","preparedTransaction","preparedTransactionHash","hashingSchemeVersion","enum","commandId","cantonTransactionSchema","transactionSchema","extend","populatedTransaction","actAs","array","commands","disclosedContracts","partyToSenderEntity","record","cantonAssignedTransactionSchema","assignedTransactionSchema","shape","inflightTransaction","cantonSignedTransactionSchema","signedTransactionSchema","signedTransaction","signatures","party","format","signature","signedBy","signingAlgorithmSpec","cantonMinedTransactionSchema","minedTransactionSchema","buildCantonTransaction","chainName","tx","timestamps","created","Date","now"],"mappings":";;;;AAgBA,IAAMA,mBAAAA,GAAsBC,EAAEC,MAAAA,CAAO;AACjCC,EAAAA,UAAAA,EAAYF,EAAEG,MAAAA,EAAM;AACpBC,EAAAA,eAAAA,EAAiBJ,EAAEK,GAAAA;AACvB,CAAA,CAAA;AAEA,IAAMC,qBAAAA,GAAwBN,EAAEC,MAAAA,CAAO;AACnCC,EAAAA,UAAAA,EAAYF,EAAEG,MAAAA,EAAM;AACpBI,EAAAA,UAAAA,EAAYP,EAAEG,MAAAA,EAAM;AACpBK,EAAAA,MAAAA,EAAQR,EAAEG,MAAAA,EAAM;AAChBM,EAAAA,cAAAA,EAAgBT,EAAEK,GAAAA;AACtB,CAAA,CAAA;AAEA,IAAMK,8BAAAA,GAAiCV,EAAEC,MAAAA,CAAO;AAC5CC,EAAAA,UAAAA,EAAYF,EAAEG,MAAAA,EAAM;AACpBC,EAAAA,eAAAA,EAAiBJ,EAAEK,GAAAA,EAAG;AACtBG,EAAAA,MAAAA,EAAQR,EAAEG,MAAAA,EAAM;AAChBM,EAAAA,cAAAA,EAAgBT,EAAEK,GAAAA;AACtB,CAAA,CAAA;AA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,OAAA,CAAA;AAER,KAAA,CAAA;GAER;AACJ,CAAA;AAKO,IAAMiD,4BAAAA,GAA+BC,uBAAuBtB,MAAAA,CAAO;AACtE,EAAA,GAAGY,6BAAAA,CAA8BF,KAAAA;EACjCC,mBAAAA,EAAqBnB;AACzB,CAAA;AAaO,IAAM+B,sBAAAA,mBAAyB,MAAA,CAAA,OAClCC,SAAAA,EACAC,EAAAA,KAAAA;AAEA,EAAA,OAAO;IACH,GAAGA,EAAAA;AACHD,IAAAA,SAAAA;IACAE,UAAAA,EAAY;AACRC,MAAAA,OAAAA,EAASF,EAAAA,CAAGC,UAAAA,EAAYC,OAAAA,IAAWC,IAAAA,CAAKC,GAAAA;AAC5C;AACJ,GAAA;AACJ,CAAA,EAXsC,wBAAA","file":"CJEDJ6BA.js","sourcesContent":["import { z } from 'zod';\n\nimport {\n assignedTransactionSchema,\n minedTransactionSchema,\n signedTransactionSchema,\n transactionSchema,\n} from '@layerzerolabs/common-chain-model';\nimport type { PartialBy } from '@layerzerolabs/typescript-utils';\n\n// === Component schemas ===\n\n// Daml command schemas mirror the OpenAPI-generated Command union (Command = CommandOneOf | ... | CommandOneOf3).\n// Payload fields (createArguments, choiceArgument, contractKey) are z.any() because\n// they carry arbitrary Daml values whose shape depends on the template.\n\nconst createCommandSchema = z.object({\n templateId: z.string(),\n createArguments: z.any(),\n});\n\nconst exerciseCommandSchema = z.object({\n templateId: z.string(),\n contractId: z.string(),\n choice: z.string(),\n choiceArgument: z.any(),\n});\n\nconst createAndExerciseCommandSchema = z.object({\n templateId: z.string(),\n createArguments: z.any(),\n choice: z.string(),\n choiceArgument: z.any(),\n});\n\nconst exerciseByKeyCommandSchema = z.object({\n templateId: z.string(),\n contractKey: z.any(),\n choice: z.string(),\n choiceArgument: z.any(),\n});\n\nexport const cantonCommandSchema = z.union([\n z.object({ createCommand: createCommandSchema }),\n z.object({ exerciseCommand: exerciseCommandSchema }),\n z.object({ createAndExerciseCommand: createAndExerciseCommandSchema }),\n z.object({ exerciseByKeyCommand: exerciseByKeyCommandSchema }),\n]);\n\nexport const cantonDisclosedContractSchema = z.object({\n templateId: z.string().optional(),\n contractId: z.string(),\n createdEventBlob: z.string(),\n synchronizerId: z.string(),\n});\n\n/** Output of prepareForSigning — needed by submitSigned to execute the transaction. */\nconst _cantonInflightTransactionSchema = z.object({\n /** The prepared transaction blob */\n preparedTransaction: z.string(),\n /** Hash of the prepared transaction (what was signed) */\n preparedTransactionHash: z.string(),\n /** Hashing scheme version used */\n hashingSchemeVersion: z.enum([\n 'HASHING_SCHEME_VERSION_UNSPECIFIED',\n 'HASHING_SCHEME_VERSION_V2',\n ]),\n /** Command ID for tracking */\n commandId: z.string(),\n});\n\n// === Lifecycle schemas ===\n\n/**\n * Canton transaction schema for Daml Ledger API commands.\n *\n * Canton uses an interactive submission (prepare-sign-submit) flow for external party signing.\n * The populatedTransaction contains the commands to send to prepareForSigning.\n */\nexport const cantonTransactionSchema = transactionSchema.extend({\n populatedTransaction: z.object({\n /** Parties submitting the command (actAs) */\n actAs: z.array(z.string()),\n /** Daml commands to send to prepareForSigning */\n commands: z.array(cantonCommandSchema),\n /** Disclosed contracts for contract/key lookups */\n disclosedContracts: z.array(cantonDisclosedContractSchema),\n /** Maps each actAs party ID → senderEntityName that controls its signing key */\n partyToSenderEntity: z.record(z.string(), z.string()),\n }),\n});\n\n/**\n * Assigned transaction includes the inflight transaction data.\n */\nexport const cantonAssignedTransactionSchema = assignedTransactionSchema.extend({\n ...cantonTransactionSchema.shape,\n inflightTransaction: _cantonInflightTransactionSchema.optional(),\n});\n\n/**\n * Signed transaction includes the DER-encoded ECDSA signature.\n */\nexport const cantonSignedTransactionSchema = signedTransactionSchema.extend({\n ...cantonAssignedTransactionSchema.shape,\n signedTransaction: z.object({\n /** Per-party signatures in the format expected by Canton's submitSigned */\n signatures: z.array(\n z.object({\n party: z.string(),\n signatures: z.array(\n z.object({\n format: z.string(),\n signature: z.string(),\n signedBy: z.string(),\n signingAlgorithmSpec: z.string(),\n }),\n ),\n }),\n ),\n }),\n});\n\n/**\n * Mined transaction with confirmation result.\n */\nexport const cantonMinedTransactionSchema = minedTransactionSchema.extend({\n ...cantonSignedTransactionSchema.shape,\n inflightTransaction: _cantonInflightTransactionSchema,\n});\n\n// === Types ===\n\nexport type CantonTx = z.infer<typeof cantonTransactionSchema>;\nexport type CantonAssignedTx = z.infer<typeof cantonAssignedTransactionSchema>;\nexport type CantonSignedTx = z.infer<typeof cantonSignedTransactionSchema>;\nexport type CantonMinedTx = z.infer<typeof cantonMinedTransactionSchema>;\n\n// === Builder ===\n\nexport type BuildCantonTransactionInput = PartialBy<CantonTx, 'chainName' | 'timestamps'>;\n\nexport const buildCantonTransaction = async (\n chainName: string,\n tx: BuildCantonTransactionInput,\n): Promise<CantonTx> => {\n return {\n ...tx,\n chainName,\n timestamps: {\n created: tx.timestamps?.created ?? Date.now(),\n },\n };\n};\n"]}
@@ -1,4 +1,4 @@
1
- import { cantonTransactionSchema } from './VK2IDAJ5.js';
1
+ import { cantonTransactionSchema } from './CJEDJ6BA.js';
2
2
  import { __name } from './VUOMXK5T.js';
3
3
  import { buildTransactionWithResultSchema } from '@layerzerolabs/common-chain-model';
4
4
 
@@ -33,5 +33,5 @@ var cantonDeploymentSucceeded = /* @__PURE__ */ __name(async (client, txWithResu
33
33
  }, "cantonDeploymentSucceeded");
34
34
 
35
35
  export { cantonDeploymentSucceeded, fetchCreatedEvents, findMatchingCreatedEvent, findMatchingCreatedEventFromTx };
36
- //# sourceMappingURL=6JQFQ75D.js.map
37
- //# sourceMappingURL=6JQFQ75D.js.map
36
+ //# sourceMappingURL=T5NCFR3W.js.map
37
+ //# sourceMappingURL=T5NCFR3W.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/events.ts"],"names":["cantonTxWithResultSchema","buildTransactionWithResultSchema","cantonTransactionSchema","fetchCreatedEvents","client","updateId","parties","cantonTx","fetchTransactionByUpdateId","events","filter","event","map","CreatedEvent","findMatchingCreatedEvent","createdEvents","expectedTemplateId","expectedSignatories","expectedSet","Set","find","templateId","signatories","length","every","s","has","findMatchingCreatedEventFromTx","tx","parsed","safeParse","success","data","result","type","commands","actAs","populatedTransaction","minedTxHash","createCommand","cantonDeploymentSucceeded","txWithResult"],"mappings":";;;;AAMA,IAAMA,wBAAAA,GAA2BC,iCAAiCC,uBAAAA,CAAAA;AAK3D,IAAMC,kBAAAA,mBAAqB,MAAA,CAAA,OAC9BC,MAAAA,EACAC,QAAAA,EACAC,OAAAA,KAAAA;AAEA,EAAA,MAAMC,QAAAA,GAAW,MAAMH,MAAAA,CAAOI,0BAAAA,CAA2BH,UAAUC,OAAAA,CAAAA;AACnE,EAAA,OACIC,QAAAA,CAASE,MAAAA,EACHC,MAAAA,CAAO,CAACC,UAAmD,cAAA,IAAkBA,KAAAA,CAAAA,CAC9EC,GAAAA,CAAI,CAACD,KAAAA,KAAUA,KAAAA,CAAME,YAAY,KAAK,EAAA;AAEnD,CAAA,EAXkC,oBAAA;AAiB3B,IAAMC,wBAAAA,mBAA2B,MAAA,CAAA,CACpCC,aAAAA,EACAC,kBAAAA,EACAC,mBAAAA,KAAAA;AAEA,EAAA,MAAMC,WAAAA,GAAc,IAAIC,GAAAA,CAAIF,mBAAAA,CAAAA;AAC5B,EAAA,OAAOF,aAAAA,CAAcK,IAAAA,CAAK,CAACT,KAAAA,KAAAA;AACvB,IAAA,IAAIA,KAAAA,CAAMU,UAAAA,KAAeL,kBAAAA,EAAoB,OAAO,KAAA;AACpD,IAAA,MAAMM,WAAAA,GAAcX,KAAAA,CAAMW,WAAAA,IAAe,EAAA;AACzC,IAAA,OAAOA,WAAAA,CAAYC,MAAAA,GAAS,CAAA,IAAKD,WAAAA,CAAYE,KAAAA,CAAM,CAACC,CAAAA,KAAMP,WAAAA,CAAYQ,GAAAA,CAAID,CAAAA,CAAAA,CAAAA;EAC9E,CAAA,CAAA;AACJ,CAAA,EAXwC,0BAAA;AAkBjC,IAAME,8BAAAA,mBAAiC,MAAA,CA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ICantonClient } from './client';\nimport type { CreatedEvent } from './open-api/models';\nimport { cantonTransactionSchema } from './transaction';\n\nconst cantonTxWithResultSchema = buildTransactionWithResultSchema(cantonTransactionSchema);\n\n/**\n * Fetches a transaction by updateId and returns all CreatedEvents.\n */\nexport const fetchCreatedEvents = async (\n client: ICantonClient,\n updateId: string,\n parties: string[],\n): Promise<CreatedEvent[]> => {\n const cantonTx = await client.fetchTransactionByUpdateId(updateId, parties);\n return (\n cantonTx.events\n ?.filter((event): event is { CreatedEvent: CreatedEvent } => 'CreatedEvent' in event)\n .map((event) => event.CreatedEvent) ?? []\n );\n};\n\n/**\n * Finds a CreatedEvent matching the expected templateId whose signatories\n * are a subset of the provided actAs parties.\n */\nexport const findMatchingCreatedEvent = (\n createdEvents: CreatedEvent[],\n expectedTemplateId: string,\n expectedSignatories: string[],\n): CreatedEvent | undefined => {\n const expectedSet = new Set(expectedSignatories);\n return createdEvents.find((event) => {\n if (event.templateId !== expectedTemplateId) return false;\n const signatories = event.signatories ?? [];\n return signatories.length > 0 && signatories.every((s) => expectedSet.has(s));\n });\n};\n\n/**\n * Parses a Canton transaction-with-result, fetches the created events from the ledger,\n * and returns the first CreatedEvent matching the submitted command's templateId and actAs\n * signatories. Returns null if the transaction is falsy, not successful, or has no match.\n */\nexport const findMatchingCreatedEventFromTx = async (\n client: ICantonClient,\n tx: unknown,\n): Promise<CreatedEvent | null> => {\n if (!tx) return null;\n\n const parsed = cantonTxWithResultSchema.safeParse(tx);\n if (!parsed.success) return null;\n if (parsed.data.result.type !== 'success') return null;\n\n const { commands, actAs } = parsed.data.populatedTransaction;\n const updateId = parsed.data.result.minedTxHash;\n\n if (!updateId || !actAs.length) return null;\n\n const createCommand = commands[0];\n if (!createCommand || !('createCommand' in createCommand)) return null;\n\n const createdEvents = await fetchCreatedEvents(client, updateId, actAs);\n return (\n findMatchingCreatedEvent(createdEvents, createCommand.createCommand.templateId, actAs) ??\n null\n );\n};\n\n/**\n * Checks that a Canton deploy transaction resulted in a CreatedEvent\n * matching the submitted command's templateId and actAs signatories.\n */\nexport const cantonDeploymentSucceeded = async (\n client: ICantonClient,\n txWithResult: unknown,\n): Promise<boolean> => {\n return (await findMatchingCreatedEventFromTx(client, txWithResult)) != null;\n};\n"]}
1
+ {"version":3,"sources":["../src/events.ts"],"names":["cantonTxWithResultSchema","buildTransactionWithResultSchema","cantonTransactionSchema","fetchCreatedEvents","client","updateId","parties","cantonTx","fetchTransactionByUpdateId","events","filter","event","map","CreatedEvent","findMatchingCreatedEvent","createdEvents","expectedTemplateId","expectedSignatories","expectedSet","Set","find","templateId","signatories","length","every","s","has","findMatchingCreatedEventFromTx","tx","parsed","safeParse","success","data","result","type","commands","actAs","populatedTransaction","minedTxHash","createCommand","cantonDeploymentSucceeded","txWithResult"],"mappings":";;;;AAMA,IAAMA,wBAAAA,GAA2BC,iCAAiCC,uBAAAA,CAAAA;AAK3D,IAAMC,kBAAAA,mBAAqB,MAAA,CAAA,OAC9BC,MAAAA,EACAC,QAAAA,EACAC,OAAAA,KAAAA;AAEA,EAAA,MAAMC,QAAAA,GAAW,MAAMH,MAAAA,CAAOI,0BAAAA,CAA2BH,UAAUC,OAAAA,CAAAA;AACnE,EAAA,OACIC,QAAAA,CAASE,MAAAA,EACHC,MAAAA,CAAO,CAACC,UAAmD,cAAA,IAAkBA,KAAAA,CAAAA,CAC9EC,GAAAA,CAAI,CAACD,KAAAA,KAAUA,KAAAA,CAAME,YAAY,KAAK,EAAA;AAEnD,CAAA,EAXkC,oBAAA;AAiB3B,IAAMC,wBAAAA,mBAA2B,MAAA,CAAA,CACpCC,aAAAA,EACAC,kBAAAA,EACAC,mBAAAA,KAAAA;AAEA,EAAA,MAAMC,WAAAA,GAAc,IAAIC,GAAAA,CAAIF,mBAAAA,CAAAA;AAC5B,EAAA,OAAOF,aAAAA,CAAcK,IAAAA,CAAK,CAACT,KAAAA,KAAAA;AACvB,IAAA,IAAIA,KAAAA,CAAMU,UAAAA,KAAeL,kBAAAA,EAAo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AAAA,CAAAA,IAChF,IAAA;AAER,CAAA,EAvB8C,gCAAA;AA6BvC,IAAMI,yBAAAA,mBAA4B,MAAA,CAAA,OACrCpC,MAAAA,EACAqC,YAAAA,KAAAA;AAEA,EAAA,OAAQ,MAAMd,8BAAAA,CAA+BvB,MAAAA,EAAQqC,YAAAA,CAAAA,IAAkB,IAAA;AAC3E,CAAA,EALyC,2BAAA","file":"T5NCFR3W.js","sourcesContent":["import { buildTransactionWithResultSchema } from '@layerzerolabs/common-chain-model';\n\nimport type { ICantonClient } from './client';\nimport type { CreatedEvent } from './open-api/models';\nimport { cantonTransactionSchema } from './transaction';\n\nconst cantonTxWithResultSchema = buildTransactionWithResultSchema(cantonTransactionSchema);\n\n/**\n * Fetches a transaction by updateId and returns all CreatedEvents.\n */\nexport const fetchCreatedEvents = async (\n client: ICantonClient,\n updateId: string,\n parties: string[],\n): Promise<CreatedEvent[]> => {\n const cantonTx = await client.fetchTransactionByUpdateId(updateId, parties);\n return (\n cantonTx.events\n ?.filter((event): event is { CreatedEvent: CreatedEvent } => 'CreatedEvent' in event)\n .map((event) => event.CreatedEvent) ?? []\n );\n};\n\n/**\n * Finds a CreatedEvent matching the expected templateId whose signatories\n * are a subset of the provided actAs parties.\n */\nexport const findMatchingCreatedEvent = (\n createdEvents: CreatedEvent[],\n expectedTemplateId: string,\n expectedSignatories: string[],\n): CreatedEvent | undefined => {\n const expectedSet = new Set(expectedSignatories);\n return createdEvents.find((event) => {\n if (event.templateId !== expectedTemplateId) return false;\n const signatories = event.signatories ?? [];\n return signatories.length > 0 && signatories.every((s) => expectedSet.has(s));\n });\n};\n\n/**\n * Parses a Canton transaction-with-result, fetches the created events from the ledger,\n * and returns the first CreatedEvent matching the submitted command's templateId and actAs\n * signatories. Returns null if the transaction is falsy, not successful, or has no match.\n */\nexport const findMatchingCreatedEventFromTx = async (\n client: ICantonClient,\n tx: unknown,\n): Promise<CreatedEvent | null> => {\n if (!tx) return null;\n\n const parsed = cantonTxWithResultSchema.safeParse(tx);\n if (!parsed.success) return null;\n if (parsed.data.result.type !== 'success') return null;\n\n const { commands, actAs } = parsed.data.populatedTransaction;\n const updateId = parsed.data.result.minedTxHash;\n\n if (!updateId || !actAs.length) return null;\n\n const createCommand = commands[0];\n if (!createCommand || !('createCommand' in createCommand)) return null;\n\n const createdEvents = await fetchCreatedEvents(client, updateId, actAs);\n return (\n findMatchingCreatedEvent(createdEvents, createCommand.createCommand.templateId, actAs) ??\n null\n );\n};\n\n/**\n * Checks that a Canton deploy transaction resulted in a CreatedEvent\n * matching the submitted command's templateId and actAs signatories.\n */\nexport const cantonDeploymentSucceeded = async (\n client: ICantonClient,\n txWithResult: unknown,\n): Promise<boolean> => {\n return (await findMatchingCreatedEventFromTx(client, txWithResult)) != null;\n};\n"]}
package/dist/events.js CHANGED
@@ -1,5 +1,5 @@
1
- export { cantonDeploymentSucceeded, fetchCreatedEvents, findMatchingCreatedEvent, findMatchingCreatedEventFromTx } from './6JQFQ75D.js';
2
- import './VK2IDAJ5.js';
1
+ export { cantonDeploymentSucceeded, fetchCreatedEvents, findMatchingCreatedEvent, findMatchingCreatedEventFromTx } from './T5NCFR3W.js';
2
+ import './CJEDJ6BA.js';
3
3
  import './VUOMXK5T.js';
4
4
  //# sourceMappingURL=events.js.map
5
5
  //# sourceMappingURL=events.js.map
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ export { CantonSdk } from './KEGAENCF.js';
3
3
  import './DYPWWRBK.js';
4
4
  import './IIWYAFUO.js';
5
5
  export { computeCantonFingerprint, extractTransactions } from './QHEXOE3Y.js';
6
- export { cantonDeploymentSucceeded, fetchCreatedEvents, findMatchingCreatedEvent, findMatchingCreatedEventFromTx } from './6JQFQ75D.js';
6
+ export { cantonDeploymentSucceeded, fetchCreatedEvents, findMatchingCreatedEvent, findMatchingCreatedEventFromTx } from './T5NCFR3W.js';
7
7
  export { createCantonProvider, parseCantonUri } from './CTDZ456O.js';
8
8
  export { CantonClient } from './JTRUQM7V.js';
9
9
  export { CantonGrpcClient } from './YHW7AKHX.js';
@@ -292,7 +292,7 @@ import './3PWAEVJM.js';
292
292
  import './FBGPMEXZ.js';
293
293
  import './BHV6BRHZ.js';
294
294
  export { CantonError, CantonProtocolError, CantonTransportError } from './A7Z5O57E.js';
295
- export { buildCantonTransaction, cantonAssignedTransactionSchema, cantonCommandSchema, cantonDisclosedContractSchema, cantonMinedTransactionSchema, cantonSignedTransactionSchema, cantonTransactionSchema } from './VK2IDAJ5.js';
295
+ export { buildCantonTransaction, cantonAssignedTransactionSchema, cantonCommandSchema, cantonDisclosedContractSchema, cantonMinedTransactionSchema, cantonSignedTransactionSchema, cantonTransactionSchema } from './CJEDJ6BA.js';
296
296
  export { CommandStatus, buildTemplateId } from './75QKYROD.js';
297
297
  import './35ELVFTS.js';
298
298
  import './RSV7WS7X.js';
@@ -235,15 +235,17 @@ export declare const cantonMinedTransactionSchema: z.ZodObject<{
235
235
  result: z.ZodDiscriminatedUnion<[z.ZodObject<{
236
236
  type: z.ZodLiteral<"success">;
237
237
  minedTxHash: z.ZodString;
238
- }, z.core.$strip>, z.ZodObject<{
238
+ }, z.core.$strip>, z.ZodObject /** Parties submitting the command (actAs) */<{
239
239
  type: z.ZodLiteral<"error">;
240
240
  error: z.ZodString;
241
- }, z.core.$strip>, z.
242
- /** Output of prepareForSigning — needed by submitSigned to execute the transaction. */
243
- ZodObject<{
241
+ }, z.core.
242
+ /** Daml commands to send to prepareForSigning */
243
+ $strip /** Daml commands to send to prepareForSigning */>, z.ZodObject<{
244
244
  type: z.ZodLiteral<"indeterminate">;
245
245
  meta: z.ZodAny;
246
- }, z.core.$strip>], "type">;
246
+ }, z.core.
247
+ /** Disclosed contracts for contract/key lookups */
248
+ $strip /** Disclosed contracts for contract/key lookups */>], "type">;
247
249
  inflightTransaction: z.ZodObject<{
248
250
  preparedTransaction: z.ZodString;
249
251
  preparedTransactionHash: z.ZodString;
@@ -1 +1 @@
1
- {"version":3,"file":"transaction.d.ts","sourceRoot":"","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A+B,CAAC,CAAC;AAC/E,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAC3E,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAIzE,MAAM,MAAM,2BAA2B,GAAG,SAAS,CAAC,QAAQ,EAAE,WAAW,GAAG,YAAY,CAAC,CAAC;AAE1F,eAAO,MAAM,sBAAsB,GAC/B,WAAW,MAAM,EACjB,IAAI,2BAA2B,KAChC,OAAO,CAAC,QAAQ,CAQlB,CAAC"}
@@ -1,4 +1,4 @@
1
- export { buildCantonTransaction, cantonAssignedTransactionSchema, cantonCommandSchema, cantonDisclosedContractSchema, cantonMinedTransactionSchema, cantonSignedTransactionSchema, cantonTransactionSchema } from './VK2IDAJ5.js';
1
+ export { buildCantonTransaction, cantonAssignedTransactionSchema, cantonCommandSchema, cantonDisclosedContractSchema, cantonMinedTransactionSchema, cantonSignedTransactionSchema, cantonTransactionSchema } from './CJEDJ6BA.js';
2
2
  import './VUOMXK5T.js';
3
3
  //# sourceMappingURL=transaction.js.map
4
4
  //# sourceMappingURL=transaction.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@layerzerolabs/common-canton",
3
- "version": "0.2.100",
3
+ "version": "0.2.102",
4
4
  "private": false,
5
5
  "description": "Canton VM client and utilities",
6
6
  "license": "MIT",
@@ -21,8 +21,8 @@
21
21
  "@protobuf-ts/grpc-transport": "^2.9.4",
22
22
  "es-toolkit": "^1.39.10",
23
23
  "zod": "4.3.5",
24
- "@layerzerolabs/common-chain-model": "0.2.100",
25
- "@layerzerolabs/typescript-utils": "0.2.100"
24
+ "@layerzerolabs/common-chain-model": "0.2.102",
25
+ "@layerzerolabs/typescript-utils": "0.2.102"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/node": "^22.18.6",
@@ -31,12 +31,12 @@
31
31
  "tsup": "^8.4.0",
32
32
  "typescript": "^5.8.2",
33
33
  "vitest": "^3.2.3",
34
- "@layerzerolabs/typescript-configuration": "0.2.100",
35
- "@layerzerolabs/tsup-configuration": "0.2.100",
36
- "@layerzerolabs/eslint-configuration": "^0.2.100",
37
- "@layerzerolabs/ver-signer-adapter": "0.2.100",
38
- "@layerzerolabs/vitest-configuration": "0.2.100",
39
- "@layerzerolabs/vm-tooling-canton": "0.2.100"
34
+ "@layerzerolabs/typescript-configuration": "0.2.102",
35
+ "@layerzerolabs/tsup-configuration": "0.2.102",
36
+ "@layerzerolabs/eslint-configuration": "^0.2.102",
37
+ "@layerzerolabs/ver-signer-adapter": "0.2.102",
38
+ "@layerzerolabs/vm-tooling-canton": "0.2.102",
39
+ "@layerzerolabs/vitest-configuration": "0.2.102"
40
40
  },
41
41
  "publishConfig": {
42
42
  "access": "restricted",
@@ -8,8 +8,9 @@ import {
8
8
  } from '@layerzerolabs/common-chain-model';
9
9
  import type { PartialBy } from '@layerzerolabs/typescript-utils';
10
10
 
11
- // ─── Daml Command Schemas ────────────────────────────────────────────────────
12
- // Mirrors the OpenAPI-generated Command union (Command = CommandOneOf | ... | CommandOneOf3).
11
+ // === Component schemas ===
12
+
13
+ // Daml command schemas mirror the OpenAPI-generated Command union (Command = CommandOneOf | ... | CommandOneOf3).
13
14
  // Payload fields (createArguments, choiceArgument, contractKey) are z.any() because
14
15
  // they carry arbitrary Daml values whose shape depends on the template.
15
16
 
@@ -46,8 +47,6 @@ export const cantonCommandSchema = z.union([
46
47
  z.object({ exerciseByKeyCommand: exerciseByKeyCommandSchema }),
47
48
  ]);
48
49
 
49
- // ─── Disclosed Contract Schema ───────────────────────────────────────────────
50
-
51
50
  export const cantonDisclosedContractSchema = z.object({
52
51
  templateId: z.string().optional(),
53
52
  contractId: z.string(),
@@ -55,7 +54,22 @@ export const cantonDisclosedContractSchema = z.object({
55
54
  synchronizerId: z.string(),
56
55
  });
57
56
 
58
- // ─── Transaction Schemas ─────────────────────────────────────────────────────
57
+ /** Output of prepareForSigning — needed by submitSigned to execute the transaction. */
58
+ const _cantonInflightTransactionSchema = z.object({
59
+ /** The prepared transaction blob */
60
+ preparedTransaction: z.string(),
61
+ /** Hash of the prepared transaction (what was signed) */
62
+ preparedTransactionHash: z.string(),
63
+ /** Hashing scheme version used */
64
+ hashingSchemeVersion: z.enum([
65
+ 'HASHING_SCHEME_VERSION_UNSPECIFIED',
66
+ 'HASHING_SCHEME_VERSION_V2',
67
+ ]),
68
+ /** Command ID for tracking */
69
+ commandId: z.string(),
70
+ });
71
+
72
+ // === Lifecycle schemas ===
59
73
 
60
74
  /**
61
75
  * Canton transaction schema for Daml Ledger API commands.
@@ -76,21 +90,6 @@ export const cantonTransactionSchema = transactionSchema.extend({
76
90
  }),
77
91
  });
78
92
 
79
- /** Output of prepareForSigning — needed by submitSigned to execute the transaction. */
80
- const _cantonInflightTransactionSchema = z.object({
81
- /** The prepared transaction blob */
82
- preparedTransaction: z.string(),
83
- /** Hash of the prepared transaction (what was signed) */
84
- preparedTransactionHash: z.string(),
85
- /** Hashing scheme version used */
86
- hashingSchemeVersion: z.enum([
87
- 'HASHING_SCHEME_VERSION_UNSPECIFIED',
88
- 'HASHING_SCHEME_VERSION_V2',
89
- ]),
90
- /** Command ID for tracking */
91
- commandId: z.string(),
92
- });
93
-
94
93
  /**
95
94
  * Assigned transaction includes the inflight transaction data.
96
95
  */
@@ -130,11 +129,15 @@ export const cantonMinedTransactionSchema = minedTransactionSchema.extend({
130
129
  inflightTransaction: _cantonInflightTransactionSchema,
131
130
  });
132
131
 
132
+ // === Types ===
133
+
133
134
  export type CantonTx = z.infer<typeof cantonTransactionSchema>;
134
135
  export type CantonAssignedTx = z.infer<typeof cantonAssignedTransactionSchema>;
135
136
  export type CantonSignedTx = z.infer<typeof cantonSignedTransactionSchema>;
136
137
  export type CantonMinedTx = z.infer<typeof cantonMinedTransactionSchema>;
137
138
 
139
+ // === Builder ===
140
+
138
141
  export type BuildCantonTransactionInput = PartialBy<CantonTx, 'chainName' | 'timestamps'>;
139
142
 
140
143
  export const buildCantonTransaction = async (
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/transaction.ts"],"names":["createCommandSchema","z","object","templateId","string","createArguments","any","exerciseCommandSchema","contractId","choice","choiceArgument","createAndExerciseCommandSchema","exerciseByKeyCommandSchema","contractKey","cantonCommandSchema","union","createCommand","exerciseCommand","createAndExerciseCommand","exerciseByKeyCommand","cantonDisclosedContractSchema","optional","createdEventBlob","synchronizerId","cantonTransactionSchema","transactionSchema","extend","populatedTransaction","actAs","array","commands","disclosedContracts","partyToSenderEntity","record","_cantonInflightTransactionSchema","preparedTransaction","preparedTransactionHash","hashingSchemeVersion","enum","commandId","cantonAssignedTransactionSchema","assignedTransactionSchema","shape","inflightTransaction","cantonSignedTransactionSchema","signedTransactionSchema","signedTransaction","signatures","party","format","signature","signedBy","signingAlgorithmSpec","cantonMinedTransactionSchema","minedTransactionSchema","buildCantonTransaction","chainName","tx","timestamps","created","Date","now"],"mappings":";;;;AAeA,IAAMA,mBAAAA,GAAsBC,EAAEC,MAAAA,CAAO;AACjCC,EAAAA,UAAAA,EAAYF,EAAEG,MAAAA,EAAM;AACpBC,EAAAA,eAAAA,EAAiBJ,EAAEK,GAAAA;AACvB,CAAA,CAAA;AAEA,IAAMC,qBAAAA,GAAwBN,EAAEC,MAAAA,CAAO;AACnCC,EAAAA,UAAAA,EAAYF,EAAEG,MAAAA,EAAM;AACpBI,EAAAA,UAAAA,EAAYP,EAAEG,MAAAA,EAAM;AACpBK,EAAAA,MAAAA,EAAQR,EAAEG,MAAAA,EAAM;AAChBM,EAAAA,cAAAA,EAAgBT,EAAEK,GAAAA;AACtB,CAAA,CAAA;AAEA,IAAMK,8BAAAA,GAAiCV,EAAEC,MAAAA,CAAO;AAC5CC,EAAAA,UAAAA,EAAYF,EAAEG,MAAAA,EAAM;AACpBC,EAAAA,eAAAA,EAAiBJ,EAAEK,GAAAA,EAAG;AACtBG,EAAAA,MAAAA,EAAQR,E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EAAUlD,EAAEG,MAAAA,EAAM;AAClBgD,QAAAA,oBAAAA,EAAsBnD,EAAEG,MAAAA;AAC5B,OAAA,CAAA;AAER,KAAA,CAAA;GAER;AACJ,CAAA;AAKO,IAAMiD,4BAAAA,GAA+BC,uBAAuB5B,MAAAA,CAAO;AACtE,EAAA,GAAGkB,6BAAAA,CAA8BF,KAAAA;EACjCC,mBAAAA,EAAqBT;AACzB,CAAA;AASO,IAAMqB,sBAAAA,mBAAyB,MAAA,CAAA,OAClCC,SAAAA,EACAC,EAAAA,KAAAA;AAEA,EAAA,OAAO;IACH,GAAGA,EAAAA;AACHD,IAAAA,SAAAA;IACAE,UAAAA,EAAY;AACRC,MAAAA,OAAAA,EAASF,EAAAA,CAAGC,UAAAA,EAAYC,OAAAA,IAAWC,IAAAA,CAAKC,GAAAA;AAC5C;AACJ,GAAA;AACJ,CAAA,EAXsC,wBAAA","file":"VK2IDAJ5.js","sourcesContent":["import { z } from 'zod';\n\nimport {\n assignedTransactionSchema,\n minedTransactionSchema,\n signedTransactionSchema,\n transactionSchema,\n} from '@layerzerolabs/common-chain-model';\nimport type { PartialBy } from '@layerzerolabs/typescript-utils';\n\n// ─── Daml Command Schemas ────────────────────────────────────────────────────\n// Mirrors the OpenAPI-generated Command union (Command = CommandOneOf | ... | CommandOneOf3).\n// Payload fields (createArguments, choiceArgument, contractKey) are z.any() because\n// they carry arbitrary Daml values whose shape depends on the template.\n\nconst createCommandSchema = z.object({\n templateId: z.string(),\n createArguments: z.any(),\n});\n\nconst exerciseCommandSchema = z.object({\n templateId: z.string(),\n contractId: z.string(),\n choice: z.string(),\n choiceArgument: z.any(),\n});\n\nconst createAndExerciseCommandSchema = z.object({\n templateId: z.string(),\n createArguments: z.any(),\n choice: z.string(),\n choiceArgument: z.any(),\n});\n\nconst exerciseByKeyCommandSchema = z.object({\n templateId: z.string(),\n contractKey: z.any(),\n choice: z.string(),\n choiceArgument: z.any(),\n});\n\nexport const cantonCommandSchema = z.union([\n z.object({ createCommand: createCommandSchema }),\n z.object({ exerciseCommand: exerciseCommandSchema }),\n z.object({ createAndExerciseCommand: createAndExerciseCommandSchema }),\n z.object({ exerciseByKeyCommand: exerciseByKeyCommandSchema }),\n]);\n\n// ─── Disclosed Contract Schema ───────────────────────────────────────────────\n\nexport const cantonDisclosedContractSchema = z.object({\n templateId: z.string().optional(),\n contractId: z.string(),\n createdEventBlob: z.string(),\n synchronizerId: z.string(),\n});\n\n// ─── Transaction Schemas ─────────────────────────────────────────────────────\n\n/**\n * Canton transaction schema for Daml Ledger API commands.\n *\n * Canton uses an interactive submission (prepare-sign-submit) flow for external party signing.\n * The populatedTransaction contains the commands to send to prepareForSigning.\n */\nexport const cantonTransactionSchema = transactionSchema.extend({\n populatedTransaction: z.object({\n /** Parties submitting the command (actAs) */\n actAs: z.array(z.string()),\n /** Daml commands to send to prepareForSigning */\n commands: z.array(cantonCommandSchema),\n /** Disclosed contracts for contract/key lookups */\n disclosedContracts: z.array(cantonDisclosedContractSchema),\n /** Maps each actAs party ID → senderEntityName that controls its signing key */\n partyToSenderEntity: z.record(z.string(), z.string()),\n }),\n});\n\n/** Output of prepareForSigning — needed by submitSigned to execute the transaction. */\nconst _cantonInflightTransactionSchema = z.object({\n /** The prepared transaction blob */\n preparedTransaction: z.string(),\n /** Hash of the prepared transaction (what was signed) */\n preparedTransactionHash: z.string(),\n /** Hashing scheme version used */\n hashingSchemeVersion: z.enum([\n 'HASHING_SCHEME_VERSION_UNSPECIFIED',\n 'HASHING_SCHEME_VERSION_V2',\n ]),\n /** Command ID for tracking */\n commandId: z.string(),\n});\n\n/**\n * Assigned transaction includes the inflight transaction data.\n */\nexport const cantonAssignedTransactionSchema = assignedTransactionSchema.extend({\n ...cantonTransactionSchema.shape,\n inflightTransaction: _cantonInflightTransactionSchema.optional(),\n});\n\n/**\n * Signed transaction includes the DER-encoded ECDSA signature.\n */\nexport const cantonSignedTransactionSchema = signedTransactionSchema.extend({\n ...cantonAssignedTransactionSchema.shape,\n signedTransaction: z.object({\n /** Per-party signatures in the format expected by Canton's submitSigned */\n signatures: z.array(\n z.object({\n party: z.string(),\n signatures: z.array(\n z.object({\n format: z.string(),\n signature: z.string(),\n signedBy: z.string(),\n signingAlgorithmSpec: z.string(),\n }),\n ),\n }),\n ),\n }),\n});\n\n/**\n * Mined transaction with confirmation result.\n */\nexport const cantonMinedTransactionSchema = minedTransactionSchema.extend({\n ...cantonSignedTransactionSchema.shape,\n inflightTransaction: _cantonInflightTransactionSchema,\n});\n\nexport type CantonTx = z.infer<typeof cantonTransactionSchema>;\nexport type CantonAssignedTx = z.infer<typeof cantonAssignedTransactionSchema>;\nexport type CantonSignedTx = z.infer<typeof cantonSignedTransactionSchema>;\nexport type CantonMinedTx = z.infer<typeof cantonMinedTransactionSchema>;\n\nexport type BuildCantonTransactionInput = PartialBy<CantonTx, 'chainName' | 'timestamps'>;\n\nexport const buildCantonTransaction = async (\n chainName: string,\n tx: BuildCantonTransactionInput,\n): Promise<CantonTx> => {\n return {\n ...tx,\n chainName,\n timestamps: {\n created: tx.timestamps?.created ?? Date.now(),\n },\n };\n};\n"]}