@layerzerolabs/common-canton 0.2.113 → 0.2.114
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/.turbo/turbo-build.log +634 -629
- package/.turbo/turbo-test.log +19 -12
- package/dist/{CXNQT7WY.js → EYZBXTU6.js} +2 -2
- package/dist/EYZBXTU6.js.map +1 -0
- package/dist/{JI3XNGXO.js → F42TZTWJ.js} +4 -3
- package/dist/F42TZTWJ.js.map +1 -0
- package/dist/client/index.js +1 -1
- package/dist/client/utils.d.ts.map +1 -1
- package/dist/client/utils.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/types.d.ts +2 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/package.json +11 -11
- package/src/client/utils.ts +3 -1
- package/src/index.ts +2 -0
- package/src/types.ts +2 -2
- package/dist/CXNQT7WY.js.map +0 -1
- package/dist/JI3XNGXO.js.map +0 -1
package/.turbo/turbo-test.log
CHANGED
|
@@ -8,15 +8,22 @@
|
|
|
8
8
|
|
|
9
9
|
✅ dpm-3.4.8-openapi-generator-7.21.0
|
|
10
10
|
🔧 openapi-generator version: 7.21.0
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
📦 Using mini workspace: /tmp/lz-mini-workspace-seGUgR
|
|
12
|
+
📦 Copied 15 workspace package source(s)
|
|
13
|
+
📦 No mini-workspace pruner configured; using unpruned package-level source copy fallback.
|
|
14
|
+
(node:150097) [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
15
|
Reparsing as ES module because module syntax was detected. This incurs a performance overhead.
|
|
14
16
|
To eliminate this warning, add "type": "module" to /home/runner/work/monorepo-internal/monorepo-internal/package.json.
|
|
15
17
|
(Use `node --trace-warnings ...` to show where the warning was created)
|
|
18
|
+
📦 Docker volumes:
|
|
19
|
+
-v /tmp/lz-mini-workspace-seGUgR:/workspace
|
|
20
|
+
-v /home/runner/work/monorepo-internal/monorepo-internal/packages/vms/canton/common:/workspace/packages/vms/canton/common
|
|
21
|
+
-v /home/runner/work/monorepo-internal/monorepo-internal/node_modules/.pnpm:/workspace/node_modules/.pnpm:ro
|
|
22
|
+
$ docker image inspect --format {{.Architecture}} 438003944538.dkr.ecr.us-east-1.amazonaws.com/layerzerolabs/canton-openapi-tooling:openapi-generator-7.21.0-patch-2
|
|
16
23
|
✅ Using cached Docker image: 438003944538.dkr.ecr.us-east-1.amazonaws.com/layerzerolabs/canton-openapi-tooling:openapi-generator-7.21.0-patch-2 (amd64)
|
|
17
24
|
👤 Running container as UID:GID 1001:1001
|
|
18
25
|
📜 Executing custom script: set -euo pipefail && rm -rf "src/open-api" && canton-openapi-generator generate -g typescript-fetch -o "src/open-api" --additional-properties=importFileExtension=.js
|
|
19
|
-
$ 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 438003944538.dkr.ecr.us-east-1.amazonaws.com/layerzerolabs/canton-openapi-tooling:openapi-generator-7.21.0-patch-2 bash -c $'set -euo pipefail && rm -rf "src/open-api" && canton-openapi-generator generate -g typescript-fetch -o "src/open-api" --additional-properties=importFileExtension=.js'
|
|
26
|
+
$ docker run --rm --add-host=host.docker.internal:host-gateway -e LOCAL_UID=1001 -e LOCAL_GID=1001 -v /tmp/lz-mini-workspace-seGUgR:/workspace -v /home/runner/work/monorepo-internal/monorepo-internal/packages/vms/canton/common:/workspace/packages/vms/canton/common -v /home/runner/work/monorepo-internal/monorepo-internal/node_modules/.pnpm:/workspace/node_modules/.pnpm:ro -w /workspace/packages/vms/canton/common 438003944538.dkr.ecr.us-east-1.amazonaws.com/layerzerolabs/canton-openapi-tooling:openapi-generator-7.21.0-patch-2 bash -c $'set -euo pipefail && rm -rf "src/open-api" && canton-openapi-generator generate -g typescript-fetch -o "src/open-api" --additional-properties=importFileExtension=.js'
|
|
20
27
|
[main] INFO o.o.codegen.DefaultGenerator - Generating with dryRun=false
|
|
21
28
|
[main] INFO o.o.c.ignore.CodegenIgnoreProcessor - Output directory (/workspace/packages/vms/canton/common/src/open-api) does not exist, or is inaccessible. No file (.openapi-generator-ignore) will be evaluated.
|
|
22
29
|
[main] INFO o.o.codegen.DefaultGenerator - OpenAPI Generator: typescript-fetch (client)
|
|
@@ -695,24 +702,24 @@ $ docker run --rm --add-host=host.docker.internal:host-gateway -e LOCAL_UID=1001
|
|
|
695
702
|
# We appreciate your support! Please consider donation to help us maintain this project. #
|
|
696
703
|
# https://opencollective.com/openapi_generator/donate #
|
|
697
704
|
############################################################################################
|
|
698
|
-
⏳ bash -c set -euo pipefail && rm -rf "src/open-api" && canton-openapi-generator generate -g typescript-fetch -o "src/open-api" --additional-properties=importFileExtension=.js:
|
|
705
|
+
⏳ bash -c set -euo pipefail && rm -rf "src/open-api" && canton-openapi-generator generate -g typescript-fetch -o "src/open-api" --additional-properties=importFileExtension=.js: 3.220s
|
|
699
706
|
[33mTesting types with tsc and vue-tsc is an experimental feature.
|
|
700
707
|
Breaking changes might not follow SemVer, please pin Vitest's version when using it.[39m
|
|
701
708
|
|
|
702
709
|
[1m[46m RUN [49m[22m [36mv3.2.6 [39m[90m/home/runner/work/monorepo-internal/monorepo-internal/packages/vms/canton/common[39m
|
|
703
710
|
|
|
704
|
-
[32m✓[39m test/provider.test.ts [2m([22m[2m7 tests[22m[2m)[22m[32m
|
|
705
|
-
[32m✓[39m test/auth/local-token-provider.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m
|
|
706
|
-
[32m✓[39m test/
|
|
707
|
-
[32m✓[39m test/crypto.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m
|
|
708
|
-
[32m✓[39m test/daml-serde.test.ts [2m([22m[2m19 tests[22m[2m)[22m[32m
|
|
711
|
+
[32m✓[39m test/auth/client-credentials-token-provider.test.ts [2m([22m[2m7 tests[22m[2m)[22m[32m 13[2mms[22m[39m
|
|
712
|
+
[32m✓[39m test/auth/local-token-provider.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 10[2mms[22m[39m
|
|
713
|
+
[32m✓[39m test/provider.test.ts [2m([22m[2m7 tests[22m[2m)[22m[32m 49[2mms[22m[39m
|
|
714
|
+
[32m✓[39m test/crypto.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 8[2mms[22m[39m
|
|
715
|
+
[32m✓[39m test/daml-serde.test.ts [2m([22m[2m19 tests[22m[2m)[22m[32m 13[2mms[22m[39m
|
|
709
716
|
[90mstderr[2m | test/sdk.test.ts[2m > [22m[2mError Handling (Unhappy Paths)[2m > [22m[2mshould handle double archive error
|
|
710
717
|
[22m[39mMock miss: GET /v2/state/connected-synchronizers
|
|
711
718
|
|
|
712
719
|
[90mstderr[2m | test/sdk.test.ts[2m > [22m[2mError Handling (Unhappy Paths)[2m > [22m[2mshould handle unauthorized party error
|
|
713
720
|
[22m[39mMock miss: GET /v2/state/connected-synchronizers
|
|
714
721
|
|
|
715
|
-
[32m✓[39m test/sdk.test.ts [2m([22m[2m18 tests[22m[2m)[22m[32m
|
|
722
|
+
[32m✓[39m test/sdk.test.ts [2m([22m[2m18 tests[22m[2m)[22m[32m 42[2mms[22m[39m
|
|
716
723
|
[32m✓[39m [44m[1m TS [22m[49m test/sdk.test.ts [2m([22m[2m18 tests[22m[2m)[22m
|
|
717
724
|
[32m✓[39m [44m[1m TS [22m[49m test/auth/client-credentials-token-provider.test.ts [2m([22m[2m7 tests[22m[2m)[22m
|
|
718
725
|
[32m✓[39m [44m[1m TS [22m[49m test/daml-serde.test.ts [2m([22m[2m19 tests[22m[2m)[22m
|
|
@@ -723,6 +730,6 @@ Breaking changes might not follow SemVer, please pin Vitest's version when using
|
|
|
723
730
|
[2m Test Files [22m [1m[32m12 passed[39m[22m[90m (12)[39m
|
|
724
731
|
[2m Tests [22m [1m[32m124 passed[39m[22m[90m (124)[39m
|
|
725
732
|
[2mType Errors [22m [2mno errors[22m
|
|
726
|
-
[2m Start at [22m
|
|
727
|
-
[2m Duration [22m
|
|
733
|
+
[2m Start at [22m 18:06:20
|
|
734
|
+
[2m Duration [22m 4.79s[2m (transform 1.00s, setup 0ms, collect 1.75s, tests 136ms, environment 1ms, prepare 828ms, typecheck 4.45s)[22m
|
|
728
735
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types.ts"],"names":["buildTemplateId","packageId","modulePath","CommandStatus","Accepted","Rejected","Timeout"],"mappings":";;;AAaO,IAAMA,eAAAA,2BAAmBC,SAAAA,EAAmBC,UAAAA,KAC/C,GAAGD,SAAAA,CAAAA,CAAAA,EAAaC,UAAAA,CAAAA,CAAAA,EADW,iBAAA;AAyBxB,IAAMC,aAAAA,GAAgB;EACzBC,QAAAA,EAAU,UAAA;EACVC,QAAAA,EAAU,UAAA;EACVC,OAAAA,EAAS;AACb","file":"EYZBXTU6.js","sourcesContent":["import type { ContractId, Party } from '@daml/types';\n\n/**\n * Core Types\n */\nexport type TemplateId = string;\n\n/**\n * Build a Canton template ID from a package ID and module path.\n *\n * @example buildTemplateId('abc123', 'RequestFactory:RequestFactory')\n * // => 'abc123:RequestFactory:RequestFactory'\n */\nexport const buildTemplateId = (packageId: string, modulePath: string): TemplateId =>\n `${packageId}:${modulePath}`;\n\nexport type Contract<T extends object> = {\n templateId: TemplateId;\n contractId: ContractId<T>;\n payload: T;\n};\n\n/**\n * Submission Types\n */\nexport type SubmitActors = {\n actAs: Party[];\n readAs?: Party[];\n};\n\nexport type SubmitResult = {\n commandId: string;\n completionOffset: number;\n};\n\n/**\n * Wait / Reconciliation Types\n */\nexport const CommandStatus = {\n Accepted: 'accepted',\n Rejected: 'rejected',\n Timeout: 'timeout',\n} as const;\n\nexport type CommandStatus = (typeof CommandStatus)[keyof typeof CommandStatus];\n\nexport type WaitAccepted = {\n status: typeof CommandStatus.Accepted;\n commandId: string;\n updateId: string;\n offset: number;\n};\nexport type WaitRejected = {\n status: typeof CommandStatus.Rejected;\n commandId: string;\n offset: number;\n error: { code?: number; message: string; details?: unknown };\n};\ntype WaitTimeout = {\n status: typeof CommandStatus.Timeout;\n commandId: string;\n lastCheckedOffset?: number;\n};\n\nexport type WaitResult = WaitAccepted | WaitRejected | WaitTimeout;\n\nexport type WaitOptions = {\n parties: Party[];\n beginExclusive?: number;\n timeoutMs?: number;\n poll?: {\n limit?: number;\n streamIdleTimeoutMs?: number;\n backoffMs?: { initial: number; max: number };\n };\n};\n\n/**\n * External Party / Interactive Submission Types\n */\n\n/**\n * A prepared transaction ready for external signing.\n */\nexport type PreparedTransaction = {\n /** The transaction blob to sign */\n preparedTransaction: string;\n /** Hash of the transaction (sign this) */\n preparedTransactionHash: string;\n /** Hashing scheme version used */\n hashingSchemeVersion: 'HASHING_SCHEME_VERSION_UNSPECIFIED' | 'HASHING_SCHEME_VERSION_V2';\n /** Command ID for tracking */\n commandId: string;\n};\n\nexport type ExternalSignature = {\n /** The party that signed */\n party: Party;\n /** The signature bytes (base64 or hex) */\n signature: string;\n /** Fingerprint/ID of the signing key */\n signedBy: string;\n /** Signature format (e.g., 'Raw') */\n format: string;\n /** Signing algorithm (e.g., 'Ed25519') */\n signingAlgorithmSpec: string;\n};\n\n/**\n * A right granted to a Canton user, as returned by `/v2/users/{userId}/rights`.\n *\n * The `kind` is a discriminated union — only one variant is set per right:\n * - `CanActAs.value.party`: user can submit transactions as that party\n * - `CanReadAs.value.party`: user can read events visible to that party\n * - `ParticipantAdmin`: user has admin rights on the participant\n * - `IdentityProviderAdmin`: user can administer its identity provider\n * - `CanReadAsAnyParty`: user can read as any party\n * - `CanExecuteAsAnyParty`: user can submit as any party\n *\n * Hand-rolled because the OpenAPI generator's `Kind` converter is broken\n * (`instanceOfKindOneOf` checks lowercase `canActAs`, but `KindOneOfFromJSON`\n * reads uppercase `CanActAs`), so the typed client strips all party data.\n *\n * The four nullary variants carry `value: unknown` because Canton's wire\n * format for them is literally `{ \"value\": {} }` (see\n * https://docs.digitalasset.com/build/3.4/explanations/json-api/) and we\n * never read into that payload — only the presence of the variant matters.\n */\nexport type UserRightKind = {\n CanActAs?: { value: { party: string } };\n CanReadAs?: { value: { party: string } };\n ParticipantAdmin?: { value: unknown };\n IdentityProviderAdmin?: { value: unknown };\n CanReadAsAnyParty?: { value: unknown };\n CanExecuteAsAnyParty?: { value: unknown };\n};\n\nexport type UserRight = {\n kind: UserRightKind;\n};\n\n/** Normalized active contract (flat shape derived from JsActiveContract). */\nexport type NormalizedActiveContract = {\n contractId: string;\n templateId: string;\n payload: unknown;\n synchronizerId: string;\n};\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { SECP256K1_SPKI_DER_HEADER } from './CMDFOA7C.js';
|
|
2
2
|
import { __name } from './VUOMXK5T.js';
|
|
3
3
|
import { createHash } from 'crypto';
|
|
4
|
+
import { bytesToHex } from '@layerzerolabs/common-encoding-utils';
|
|
4
5
|
|
|
5
6
|
function extractTransactions(updates) {
|
|
6
7
|
return updates.flatMap((update) => "Transaction" in update ? [
|
|
@@ -23,10 +24,10 @@ function computeCantonFingerprint(uncompressedPublicKey) {
|
|
|
23
24
|
const result = new Uint8Array(MULTIHASH_SHA256_PREFIX.length + hash.length);
|
|
24
25
|
result.set(MULTIHASH_SHA256_PREFIX);
|
|
25
26
|
result.set(hash, MULTIHASH_SHA256_PREFIX.length);
|
|
26
|
-
return
|
|
27
|
+
return bytesToHex(result);
|
|
27
28
|
}
|
|
28
29
|
__name(computeCantonFingerprint, "computeCantonFingerprint");
|
|
29
30
|
|
|
30
31
|
export { computeCantonFingerprint, extractTransactions };
|
|
31
|
-
//# sourceMappingURL=
|
|
32
|
-
//# sourceMappingURL=
|
|
32
|
+
//# sourceMappingURL=F42TZTWJ.js.map
|
|
33
|
+
//# sourceMappingURL=F42TZTWJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/client/utils.ts"],"names":["extractTransactions","updates","flatMap","update","Transaction","value","HASH_PURPOSE_PUBLIC_KEY_FINGERPRINT","MULTIHASH_SHA256_PREFIX","Uint8Array","computeCantonFingerprint","uncompressedPublicKey","publicKeyDer","SECP256K1_SPKI_DER_HEADER","length","set","purposePrefix","DataView","buffer","setUint32","hash","createHash","digest","result","bytesToHex"],"mappings":";;;;;AAWO,SAASA,oBAAoBC,OAAAA,EAAuB;AACvD,EAAA,OAAOA,OAAAA,CAAQC,OAAAA,CAAQ,CAACC,MAAAA,KAAY,iBAAiBA,MAAAA,GAAS;AAACA,IAAAA,MAAAA,CAAOC,WAAAA,CAAYC;AAAS,GAAA,GAAA,EAAE,CAAA;AACjG;AAFgBL,MAAAA,CAAAA,mBAAAA,EAAAA,qBAAAA,CAAAA;AAIhB,IAAMM,mCAAAA,GAAsC,EAAA;AAC5C,IAAMC,uBAAAA,GAA0B,IAAIC,UAAAA,CAAW;AAAC,EAAA,EAAA;AAAM,EAAA;AAAK,CAAA,CAAA;AAMpD,SAASC,yBAAyBC,qBAAAA,EAAiC;AACtE,EAAA,MAAMC,eAAe,IAAIH,UAAAA,CACrBI,yBAAAA,CAA0BC,MAAAA,GAASH,sBAAsBG,MAAM,CAAA;AAEnEF,EAAAA,YAAAA,CAAaG,IAAIF,yBAAAA,CAAAA;AACjBD,EAAAA,YAAAA,CAAaG,GAAAA,CAAIJ,qBAAAA,EAAuBE,yBAAAA,CAA0BC,MAAM,CAAA;AAExE,EAAA,MAAME,aAAAA,GAAgB,IAAIP,UAAAA,CAAW,CAAA,CAAA;AACrC,EAAA,IAAIQ,SAASD,aAAAA,CAAcE,MAAM,CAAA,CAAEC,SAAAA,CAAU,GAAGZ,mCAAAA,CAAAA;AAEhD,EAAA,MAAMa,IAAAA,GAAOC,UAAAA,CAAW,QAAA,CAAA,CAAUjB,MAAAA,CAAOY,aAAAA,CAAAA,CAAeZ,MAAAA,CAAOQ,YAAAA,CAAAA,CAAcU,MAAAA,EAAM;AAEnF,EAAA,MAAMC,SAAS,IAAId,UAAAA,CAAWD,uBAAAA,CAAwBM,MAAAA,GAASM,KAAKN,MAAM,CAAA;AAC1ES,EAAAA,MAAAA,CAAOR,IAAIP,uBAAAA,CAAAA;AACXe,EAAAA,MAAAA,CAAOR,GAAAA,CAAIK,IAAAA,EAAMZ,uBAAAA,CAAwBM,MAAM,CAAA;AAE/C,EAAA,OAAOU,WAAWD,MAAAA,CAAAA;AACtB;AAjBgBb,MAAAA,CAAAA,wBAAAA,EAAAA,0BAAAA,CAAAA","file":"F42TZTWJ.js","sourcesContent":["import { createHash } from 'node:crypto';\n\nimport { bytesToHex } from '@layerzerolabs/common-encoding-utils';\n\nimport { SECP256K1_SPKI_DER_HEADER } from '../crypto';\nimport type { CantonTransaction, CantonUpdate } from './interface';\n\n/**\n * Extract transactions from Canton updates.\n * Filters out checkpoints, reassignments, and topology transactions.\n */\nexport function extractTransactions(updates: CantonUpdate[]): CantonTransaction[] {\n return updates.flatMap((update) => ('Transaction' in update ? [update.Transaction.value] : []));\n}\n\nconst HASH_PURPOSE_PUBLIC_KEY_FINGERPRINT = 12;\nconst MULTIHASH_SHA256_PREFIX = new Uint8Array([0x12, 0x20]);\n\n/**\n * Computes the Canton fingerprint for an uncompressed secp256k1 public key.\n * DER-encodes the key, then computes hex(SHA-256 multihash of purpose=12 || publicKeyDer).\n */\nexport function computeCantonFingerprint(uncompressedPublicKey: Uint8Array): string {\n const publicKeyDer = new Uint8Array(\n SECP256K1_SPKI_DER_HEADER.length + uncompressedPublicKey.length,\n );\n publicKeyDer.set(SECP256K1_SPKI_DER_HEADER);\n publicKeyDer.set(uncompressedPublicKey, SECP256K1_SPKI_DER_HEADER.length);\n\n const purposePrefix = new Uint8Array(4);\n new DataView(purposePrefix.buffer).setUint32(0, HASH_PURPOSE_PUBLIC_KEY_FINGERPRINT);\n\n const hash = createHash('sha256').update(purposePrefix).update(publicKeyDer).digest();\n\n const result = new Uint8Array(MULTIHASH_SHA256_PREFIX.length + hash.length);\n result.set(MULTIHASH_SHA256_PREFIX);\n result.set(hash, MULTIHASH_SHA256_PREFIX.length);\n\n return bytesToHex(result);\n}\n"]}
|
package/dist/client/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../DYPWWRBK.js';
|
|
2
2
|
import '../IIWYAFUO.js';
|
|
3
|
-
export { computeCantonFingerprint, extractTransactions } from '../
|
|
3
|
+
export { computeCantonFingerprint, extractTransactions } from '../F42TZTWJ.js';
|
|
4
4
|
import '../CMDFOA7C.js';
|
|
5
5
|
export { CantonClient } from '../SMLSAWCA.js';
|
|
6
6
|
import '../5HH7PZW3.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/client/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/client/utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEnE;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,iBAAiB,EAAE,CAEhF;AAKD;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,qBAAqB,EAAE,UAAU,GAAG,MAAM,CAiBlF"}
|
package/dist/client/utils.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export * from './deferredValue';
|
|
|
6
6
|
export * from './events';
|
|
7
7
|
export * from './provider';
|
|
8
8
|
export * from './transaction';
|
|
9
|
-
export { buildTemplateId, CommandStatus, type Contract, type ExternalSignature, type PreparedTransaction, type SubmitActors, type SubmitResult, type TemplateId, type UserRight, type UserRightKind, type WaitOptions, type WaitResult, } from './types';
|
|
9
|
+
export { buildTemplateId, CommandStatus, type Contract, type ExternalSignature, type PreparedTransaction, type SubmitActors, type SubmitResult, type TemplateId, type UserRight, type UserRightKind, type WaitAccepted, type WaitOptions, type WaitRejected, type WaitResult, } from './types';
|
|
10
10
|
export { CantonError, CantonProtocolError, CantonTransportError } from './errors';
|
|
11
11
|
export { CantonClient, type CantonEvent, CantonGrpcClient, type CantonGrpcClientOptions, type CantonTransaction, type CantonUpdate, type CantonUpdateResponse, computeCantonFingerprint, extractTransactions, type ICantonClient, type TlsOptions, } from './client';
|
|
12
12
|
export { CantonSdk, type NormalizedActiveContract } from './sdk/index';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAG9B,OAAO,EACH,eAAe,EACf,aAAa,EACb,KAAK,QAAQ,EACb,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,UAAU,GAClB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAGlF,OAAO,EACH,YAAY,EACZ,KAAK,WAAW,EAChB,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,wBAAwB,EACxB,mBAAmB,EACnB,KAAK,aAAa,EAClB,KAAK,UAAU,GAClB,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,SAAS,EAAE,KAAK,wBAAwB,EAAE,MAAM,a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mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import './DYPWWRBK.js';
|
|
2
2
|
import './IIWYAFUO.js';
|
|
3
|
-
export { computeCantonFingerprint, extractTransactions } from './
|
|
3
|
+
export { computeCantonFingerprint, extractTransactions } from './F42TZTWJ.js';
|
|
4
4
|
import './5GUYLHA7.js';
|
|
5
5
|
export { CantonSdk } from './SLTAV2JF.js';
|
|
6
|
-
export { CommandStatus, buildTemplateId } from './
|
|
6
|
+
export { CommandStatus, buildTemplateId } from './EYZBXTU6.js';
|
|
7
7
|
import './35ELVFTS.js';
|
|
8
8
|
import './RSV7WS7X.js';
|
|
9
9
|
export { parseAmuletAmount, parseAmuletDecimal } from './CXTOAS7N.js';
|
package/dist/types.d.ts
CHANGED
|
@@ -35,13 +35,13 @@ export declare const CommandStatus: {
|
|
|
35
35
|
readonly Timeout: "timeout";
|
|
36
36
|
};
|
|
37
37
|
export type CommandStatus = (typeof CommandStatus)[keyof typeof CommandStatus];
|
|
38
|
-
type WaitAccepted = {
|
|
38
|
+
export type WaitAccepted = {
|
|
39
39
|
status: typeof CommandStatus.Accepted;
|
|
40
40
|
commandId: string;
|
|
41
41
|
updateId: string;
|
|
42
42
|
offset: number;
|
|
43
43
|
};
|
|
44
|
-
type WaitRejected = {
|
|
44
|
+
export type WaitRejected = {
|
|
45
45
|
status: typeof CommandStatus.Rejected;
|
|
46
46
|
commandId: string;
|
|
47
47
|
offset: number;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAErD;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAEhC;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vB,CAAC;AAEF,6EAA6E;AAC7E,MAAM,MAAM,wBAAwB,GAAG;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;CAC1B,CAAC"}
|
package/dist/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@layerzerolabs/common-canton",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.114",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Canton VM client and utilities",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"@protobuf-ts/grpc-transport": "^2.9.4",
|
|
24
24
|
"es-toolkit": "^1.39.10",
|
|
25
25
|
"zod": "4.3.5",
|
|
26
|
-
"@layerzerolabs/common-chain-model": "0.2.
|
|
27
|
-
"@layerzerolabs/common-encoding-utils": "0.2.
|
|
28
|
-
"@layerzerolabs/common-error-utils": "0.2.
|
|
29
|
-
"@layerzerolabs/typescript-utils": "0.2.
|
|
26
|
+
"@layerzerolabs/common-chain-model": "0.2.114",
|
|
27
|
+
"@layerzerolabs/common-encoding-utils": "0.2.114",
|
|
28
|
+
"@layerzerolabs/common-error-utils": "0.2.114",
|
|
29
|
+
"@layerzerolabs/typescript-utils": "0.2.114"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/node": "^22.18.6",
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"tsup": "^8.4.0",
|
|
36
36
|
"typescript": "^5.8.2",
|
|
37
37
|
"vitest": "^3.2.6",
|
|
38
|
-
"@layerzerolabs/eslint-configuration": "^0.2.
|
|
39
|
-
"@layerzerolabs/tsup-configuration": "0.2.
|
|
40
|
-
"@layerzerolabs/
|
|
41
|
-
"@layerzerolabs/
|
|
42
|
-
"@layerzerolabs/
|
|
43
|
-
"@layerzerolabs/vm-tooling-canton": "0.2.
|
|
38
|
+
"@layerzerolabs/eslint-configuration": "^0.2.114",
|
|
39
|
+
"@layerzerolabs/tsup-configuration": "0.2.114",
|
|
40
|
+
"@layerzerolabs/typescript-configuration": "0.2.114",
|
|
41
|
+
"@layerzerolabs/ver-signer-adapter": "0.2.114",
|
|
42
|
+
"@layerzerolabs/vitest-configuration": "0.2.114",
|
|
43
|
+
"@layerzerolabs/vm-tooling-canton": "0.2.114"
|
|
44
44
|
},
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "restricted",
|
package/src/client/utils.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
2
|
|
|
3
|
+
import { bytesToHex } from '@layerzerolabs/common-encoding-utils';
|
|
4
|
+
|
|
3
5
|
import { SECP256K1_SPKI_DER_HEADER } from '../crypto';
|
|
4
6
|
import type { CantonTransaction, CantonUpdate } from './interface';
|
|
5
7
|
|
|
@@ -34,5 +36,5 @@ export function computeCantonFingerprint(uncompressedPublicKey: Uint8Array): str
|
|
|
34
36
|
result.set(MULTIHASH_SHA256_PREFIX);
|
|
35
37
|
result.set(hash, MULTIHASH_SHA256_PREFIX.length);
|
|
36
38
|
|
|
37
|
-
return
|
|
39
|
+
return bytesToHex(result);
|
|
38
40
|
}
|
package/src/index.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -44,13 +44,13 @@ export const CommandStatus = {
|
|
|
44
44
|
|
|
45
45
|
export type CommandStatus = (typeof CommandStatus)[keyof typeof CommandStatus];
|
|
46
46
|
|
|
47
|
-
type WaitAccepted = {
|
|
47
|
+
export type WaitAccepted = {
|
|
48
48
|
status: typeof CommandStatus.Accepted;
|
|
49
49
|
commandId: string;
|
|
50
50
|
updateId: string;
|
|
51
51
|
offset: number;
|
|
52
52
|
};
|
|
53
|
-
type WaitRejected = {
|
|
53
|
+
export type WaitRejected = {
|
|
54
54
|
status: typeof CommandStatus.Rejected;
|
|
55
55
|
commandId: string;
|
|
56
56
|
offset: number;
|
package/dist/CXNQT7WY.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types.ts"],"names":["buildTemplateId","packageId","modulePath","CommandStatus","Accepted","Rejected","Timeout"],"mappings":";;;AAaO,IAAMA,eAAAA,2BAAmBC,SAAAA,EAAmBC,UAAAA,KAC/C,GAAGD,SAAAA,CAAAA,CAAAA,EAAaC,UAAAA,CAAAA,CAAAA,EADW,iBAAA;AAyBxB,IAAMC,aAAAA,GAAgB;EACzBC,QAAAA,EAAU,UAAA;EACVC,QAAAA,EAAU,UAAA;EACVC,OAAAA,EAAS;AACb","file":"CXNQT7WY.js","sourcesContent":["import type { ContractId, Party } from '@daml/types';\n\n/**\n * Core Types\n */\nexport type TemplateId = string;\n\n/**\n * Build a Canton template ID from a package ID and module path.\n *\n * @example buildTemplateId('abc123', 'RequestFactory:RequestFactory')\n * // => 'abc123:RequestFactory:RequestFactory'\n */\nexport const buildTemplateId = (packageId: string, modulePath: string): TemplateId =>\n `${packageId}:${modulePath}`;\n\nexport type Contract<T extends object> = {\n templateId: TemplateId;\n contractId: ContractId<T>;\n payload: T;\n};\n\n/**\n * Submission Types\n */\nexport type SubmitActors = {\n actAs: Party[];\n readAs?: Party[];\n};\n\nexport type SubmitResult = {\n commandId: string;\n completionOffset: number;\n};\n\n/**\n * Wait / Reconciliation Types\n */\nexport const CommandStatus = {\n Accepted: 'accepted',\n Rejected: 'rejected',\n Timeout: 'timeout',\n} as const;\n\nexport type CommandStatus = (typeof CommandStatus)[keyof typeof CommandStatus];\n\ntype WaitAccepted = {\n status: typeof CommandStatus.Accepted;\n commandId: string;\n updateId: string;\n offset: number;\n};\ntype WaitRejected = {\n status: typeof CommandStatus.Rejected;\n commandId: string;\n offset: number;\n error: { code?: number; message: string; details?: unknown };\n};\ntype WaitTimeout = {\n status: typeof CommandStatus.Timeout;\n commandId: string;\n lastCheckedOffset?: number;\n};\n\nexport type WaitResult = WaitAccepted | WaitRejected | WaitTimeout;\n\nexport type WaitOptions = {\n parties: Party[];\n beginExclusive?: number;\n timeoutMs?: number;\n poll?: {\n limit?: number;\n streamIdleTimeoutMs?: number;\n backoffMs?: { initial: number; max: number };\n };\n};\n\n/**\n * External Party / Interactive Submission Types\n */\n\n/**\n * A prepared transaction ready for external signing.\n */\nexport type PreparedTransaction = {\n /** The transaction blob to sign */\n preparedTransaction: string;\n /** Hash of the transaction (sign this) */\n preparedTransactionHash: string;\n /** Hashing scheme version used */\n hashingSchemeVersion: 'HASHING_SCHEME_VERSION_UNSPECIFIED' | 'HASHING_SCHEME_VERSION_V2';\n /** Command ID for tracking */\n commandId: string;\n};\n\nexport type ExternalSignature = {\n /** The party that signed */\n party: Party;\n /** The signature bytes (base64 or hex) */\n signature: string;\n /** Fingerprint/ID of the signing key */\n signedBy: string;\n /** Signature format (e.g., 'Raw') */\n format: string;\n /** Signing algorithm (e.g., 'Ed25519') */\n signingAlgorithmSpec: string;\n};\n\n/**\n * A right granted to a Canton user, as returned by `/v2/users/{userId}/rights`.\n *\n * The `kind` is a discriminated union — only one variant is set per right:\n * - `CanActAs.value.party`: user can submit transactions as that party\n * - `CanReadAs.value.party`: user can read events visible to that party\n * - `ParticipantAdmin`: user has admin rights on the participant\n * - `IdentityProviderAdmin`: user can administer its identity provider\n * - `CanReadAsAnyParty`: user can read as any party\n * - `CanExecuteAsAnyParty`: user can submit as any party\n *\n * Hand-rolled because the OpenAPI generator's `Kind` converter is broken\n * (`instanceOfKindOneOf` checks lowercase `canActAs`, but `KindOneOfFromJSON`\n * reads uppercase `CanActAs`), so the typed client strips all party data.\n *\n * The four nullary variants carry `value: unknown` because Canton's wire\n * format for them is literally `{ \"value\": {} }` (see\n * https://docs.digitalasset.com/build/3.4/explanations/json-api/) and we\n * never read into that payload — only the presence of the variant matters.\n */\nexport type UserRightKind = {\n CanActAs?: { value: { party: string } };\n CanReadAs?: { value: { party: string } };\n ParticipantAdmin?: { value: unknown };\n IdentityProviderAdmin?: { value: unknown };\n CanReadAsAnyParty?: { value: unknown };\n CanExecuteAsAnyParty?: { value: unknown };\n};\n\nexport type UserRight = {\n kind: UserRightKind;\n};\n\n/** Normalized active contract (flat shape derived from JsActiveContract). */\nexport type NormalizedActiveContract = {\n contractId: string;\n templateId: string;\n payload: unknown;\n synchronizerId: string;\n};\n"]}
|
package/dist/JI3XNGXO.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/client/utils.ts"],"names":["extractTransactions","updates","flatMap","update","Transaction","value","HASH_PURPOSE_PUBLIC_KEY_FINGERPRINT","MULTIHASH_SHA256_PREFIX","Uint8Array","computeCantonFingerprint","uncompressedPublicKey","publicKeyDer","SECP256K1_SPKI_DER_HEADER","length","set","purposePrefix","DataView","buffer","setUint32","hash","createHash","digest","result","Buffer","from","toString"],"mappings":";;;;AASO,SAASA,oBAAoBC,OAAAA,EAAuB;AACvD,EAAA,OAAOA,OAAAA,CAAQC,OAAAA,CAAQ,CAACC,MAAAA,KAAY,iBAAiBA,MAAAA,GAAS;AAACA,IAAAA,MAAAA,CAAOC,WAAAA,CAAYC;AAAS,GAAA,GAAA,EAAE,CAAA;AACjG;AAFgBL,MAAAA,CAAAA,mBAAAA,EAAAA,qBAAAA,CAAAA;AAIhB,IAAMM,mCAAAA,GAAsC,EAAA;AAC5C,IAAMC,uBAAAA,GAA0B,IAAIC,UAAAA,CAAW;AAAC,EAAA,EAAA;AAAM,EAAA;AAAK,CAAA,CAAA;AAMpD,SAASC,yBAAyBC,qBAAAA,EAAiC;AACtE,EAAA,MAAMC,eAAe,IAAIH,UAAAA,CACrBI,yBAAAA,CAA0BC,MAAAA,GAASH,sBAAsBG,MAAM,CAAA;AAEnEF,EAAAA,YAAAA,CAAaG,IAAIF,yBAAAA,CAAAA;AACjBD,EAAAA,YAAAA,CAAaG,GAAAA,CAAIJ,qBAAAA,EAAuBE,yBAAAA,CAA0BC,MAAM,CAAA;AAExE,EAAA,MAAME,aAAAA,GAAgB,IAAIP,UAAAA,CAAW,CAAA,CAAA;AACrC,EAAA,IAAIQ,SAASD,aAAAA,CAAcE,MAAM,CAAA,CAAEC,SAAAA,CAAU,GAAGZ,mCAAAA,CAAAA;AAEhD,EAAA,MAAMa,IAAAA,GAAOC,UAAAA,CAAW,QAAA,CAAA,CAAUjB,MAAAA,CAAOY,aAAAA,CAAAA,CAAeZ,MAAAA,CAAOQ,YAAAA,CAAAA,CAAcU,MAAAA,EAAM;AAEnF,EAAA,MAAMC,SAAS,IAAId,UAAAA,CAAWD,uBAAAA,CAAwBM,MAAAA,GAASM,KAAKN,MAAM,CAAA;AAC1ES,EAAAA,MAAAA,CAAOR,IAAIP,uBAAAA,CAAAA;AACXe,EAAAA,MAAAA,CAAOR,GAAAA,CAAIK,IAAAA,EAAMZ,uBAAAA,CAAwBM,MAAM,CAAA;AAE/C,EAAA,OAAOU,MAAAA,CAAOC,IAAAA,CAAKF,MAAAA,CAAAA,CAAQG,SAAS,KAAA,CAAA;AACxC;AAjBgBhB,MAAAA,CAAAA,wBAAAA,EAAAA,0BAAAA,CAAAA","file":"JI3XNGXO.js","sourcesContent":["import { createHash } from 'node:crypto';\n\nimport { SECP256K1_SPKI_DER_HEADER } from '../crypto';\nimport type { CantonTransaction, CantonUpdate } from './interface';\n\n/**\n * Extract transactions from Canton updates.\n * Filters out checkpoints, reassignments, and topology transactions.\n */\nexport function extractTransactions(updates: CantonUpdate[]): CantonTransaction[] {\n return updates.flatMap((update) => ('Transaction' in update ? [update.Transaction.value] : []));\n}\n\nconst HASH_PURPOSE_PUBLIC_KEY_FINGERPRINT = 12;\nconst MULTIHASH_SHA256_PREFIX = new Uint8Array([0x12, 0x20]);\n\n/**\n * Computes the Canton fingerprint for an uncompressed secp256k1 public key.\n * DER-encodes the key, then computes hex(SHA-256 multihash of purpose=12 || publicKeyDer).\n */\nexport function computeCantonFingerprint(uncompressedPublicKey: Uint8Array): string {\n const publicKeyDer = new Uint8Array(\n SECP256K1_SPKI_DER_HEADER.length + uncompressedPublicKey.length,\n );\n publicKeyDer.set(SECP256K1_SPKI_DER_HEADER);\n publicKeyDer.set(uncompressedPublicKey, SECP256K1_SPKI_DER_HEADER.length);\n\n const purposePrefix = new Uint8Array(4);\n new DataView(purposePrefix.buffer).setUint32(0, HASH_PURPOSE_PUBLIC_KEY_FINGERPRINT);\n\n const hash = createHash('sha256').update(purposePrefix).update(publicKeyDer).digest();\n\n const result = new Uint8Array(MULTIHASH_SHA256_PREFIX.length + hash.length);\n result.set(MULTIHASH_SHA256_PREFIX);\n result.set(hash, MULTIHASH_SHA256_PREFIX.length);\n\n return Buffer.from(result).toString('hex');\n}\n"]}
|