cantonjs 0.3.0 → 0.4.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/README.md +46 -31
- package/package.json +8 -7
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
|
-
TypeScript
|
|
6
|
+
Application-side TypeScript SDK for Canton participant Ledger API V2
|
|
7
7
|
</p>
|
|
8
8
|
|
|
9
9
|
<p align="center">
|
|
@@ -16,22 +16,29 @@
|
|
|
16
16
|
|
|
17
17
|
---
|
|
18
18
|
|
|
19
|
-
cantonjs is
|
|
19
|
+
cantonjs is the application-side TypeScript SDK for teams building directly against a Canton participant's Ledger API V2.
|
|
20
|
+
It provides tree-shakeable Ledger, Admin, and Test clients; injected transports; real-time streaming; structured errors; and first-class testing support for participant-connected app code.
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
The repo is aimed first at backend or full-stack participant services, participant-private React apps, and integration or data teams with participant access.
|
|
23
|
+
Public Scan consumers and advanced stable/public Splice integrators are secondary users.
|
|
24
|
+
It starts after Daml lifecycle, full-stack onboarding, and wallet connection are already handled by the official upstream tools.
|
|
25
|
+
|
|
26
|
+
Start with [docs/positioning.md](./docs/positioning.md), the [target users guide](./docs/guide/target-users.md), and the [ecosystem-fit guide](./docs/guide/ecosystem-fit.md) for the detailed scope and boundary story.
|
|
27
|
+
|
|
28
|
+
Existing users: the current positioning reset changes the repo mental model and package boundaries, and it removes the legacy wallet and validator-overlap surfaces from the current package set.
|
|
29
|
+
See [CHANGELOG.md](./CHANGELOG.md) and the [migration notes](./docs/MIGRATING_TO_SPLICE_SUPPORT.md).
|
|
22
30
|
|
|
23
31
|
Development policy: the included runtime surface is gated at 100% statements, branches, functions, and lines, and every coverage exclusion or inline `v8 ignore` must be justified in [`EXCLUSIONS.md`](./EXCLUSIONS.md).
|
|
24
32
|
|
|
25
33
|
## Features
|
|
26
34
|
|
|
27
|
-
- **
|
|
28
|
-
- **
|
|
35
|
+
- **Participant-side clients** — Ledger, Admin, and Test client factories for direct application work
|
|
36
|
+
- **Injected transports** — JSON API V2, gRPC, and fallback transport layers without hidden I/O
|
|
29
37
|
- **Real-time streaming** — AsyncIterator WebSocket streams with auto-reconnect
|
|
30
|
-
- **
|
|
31
|
-
- **
|
|
32
|
-
- **
|
|
33
|
-
- **
|
|
34
|
-
- **Zero runtime dependencies** — transports are injected, not bundled
|
|
38
|
+
- **Structured errors and testing** — CJ-coded errors, recovery hints, mock transports, and sandbox fixtures
|
|
39
|
+
- **Optional codegen** — generate TypeScript from existing Daml DAR artifacts when app code needs it
|
|
40
|
+
- **Participant-private React hooks** — TanStack Query-powered hooks via [cantonjs-react](#cantonjs-react)
|
|
41
|
+
- **Focused add-ons** — public Scan, validator, token-standard, and interface packages around the participant-runtime core
|
|
35
42
|
|
|
36
43
|
## Install
|
|
37
44
|
|
|
@@ -41,23 +48,25 @@ npm install cantonjs
|
|
|
41
48
|
|
|
42
49
|
## Package Map
|
|
43
50
|
|
|
44
|
-
The repo
|
|
51
|
+
The repo centers on an app-side Ledger API V2 core plus focused add-ons around that boundary.
|
|
45
52
|
|
|
46
|
-
| Package | Stability | Purpose |
|
|
47
|
-
| ------- | --------- | ------- |
|
|
48
|
-
| `cantonjs` | GA |
|
|
49
|
-
| `cantonjs-
|
|
50
|
-
| `cantonjs-
|
|
51
|
-
| `cantonjs-splice-scan` | GA | Public Scan reads for DSO metadata, update history, and public ANS lookups |
|
|
52
|
-
| `cantonjs-splice-validator` | GA
|
|
53
|
-
| `cantonjs-splice-interfaces` | GA | Stable Splice
|
|
54
|
-
| `cantonjs-splice-token-standard` | GA |
|
|
55
|
-
|
|
53
|
+
| Tier | Package | Stability | Purpose |
|
|
54
|
+
| ---- | ------- | --------- | ------- |
|
|
55
|
+
| Core | `cantonjs` | GA | Application-side Ledger, Admin, and Test clients; transports; streaming; errors; chains; and runtime typing helpers |
|
|
56
|
+
| Optional Convenience | `cantonjs-react` | GA | Participant-private React hooks for application code |
|
|
57
|
+
| Optional Convenience | `cantonjs-codegen` | GA | Optional DAR-to-TypeScript convenience from existing Daml artifacts |
|
|
58
|
+
| Add-On | `cantonjs-splice-scan` | GA | Public Scan reads for DSO metadata, update history, and public ANS lookups |
|
|
59
|
+
| Add-On | `cantonjs-splice-validator` | GA | Selected stable external validator support: ANS and filtered Scan Proxy reads |
|
|
60
|
+
| Add-On | `cantonjs-splice-interfaces` | GA | Stable published Splice interface descriptors and generated types |
|
|
61
|
+
| Add-On | `cantonjs-splice-token-standard` | GA | Participant-first CIP-0056 helpers for new token transfer and allocation flows |
|
|
62
|
+
|
|
63
|
+
For the canonical scope note that drives this package map, see [docs/positioning.md](./docs/positioning.md).
|
|
64
|
+
For a tool-by-tool "when to use what" guide, see [docs/guide/ecosystem-fit.md](./docs/guide/ecosystem-fit.md).
|
|
65
|
+
For the persona and anti-pitch version of that same story, see [docs/guide/target-users.md](./docs/guide/target-users.md).
|
|
56
66
|
|
|
57
67
|
## Stability Tiers
|
|
58
68
|
|
|
59
69
|
- **GA**: Covered by the normal semver promise for the pinned release line.
|
|
60
|
-
- **Legacy compatibility**: Still supported for existing integrations, but not the recommended starting point for new work.
|
|
61
70
|
- **Experimental**: May break in minor releases while the upstream surface is still moving.
|
|
62
71
|
|
|
63
72
|
Current compatibility target:
|
|
@@ -65,7 +74,7 @@ Current compatibility target:
|
|
|
65
74
|
- **Canton GA line:** `3.4.x`
|
|
66
75
|
- **Splice GA line:** `0.5.x`
|
|
67
76
|
- **Vendored Splice artifacts:** `0.5.17`
|
|
68
|
-
- **
|
|
77
|
+
- **Last pre-prune legacy line:** `0.3.1`
|
|
69
78
|
|
|
70
79
|
See [compatibility policy](./docs/compatibility.md) and [migration notes](./docs/MIGRATING_TO_SPLICE_SUPPORT.md).
|
|
71
80
|
|
|
@@ -225,7 +234,9 @@ try {
|
|
|
225
234
|
|
|
226
235
|
### cantonjs-codegen
|
|
227
236
|
|
|
228
|
-
|
|
237
|
+
`cantonjs-codegen` is an optional DAR-to-TypeScript convenience for application code built from existing Daml artifacts. DPM remains canonical for Daml build, test, and codegen workflows.
|
|
238
|
+
|
|
239
|
+
Generate TypeScript types from a DAR you already have:
|
|
229
240
|
|
|
230
241
|
```bash
|
|
231
242
|
npm install --save-dev cantonjs-codegen
|
|
@@ -237,7 +248,7 @@ Records become type aliases, variants become discriminated unions, templates bec
|
|
|
237
248
|
|
|
238
249
|
### cantonjs-react
|
|
239
250
|
|
|
240
|
-
React hooks for
|
|
251
|
+
React hooks for participant-private ledger application state, powered by TanStack Query:
|
|
241
252
|
|
|
242
253
|
```bash
|
|
243
254
|
npm install cantonjs-react @tanstack/react-query
|
|
@@ -288,14 +299,18 @@ function AssetList() {
|
|
|
288
299
|
|
|
289
300
|
See [packages/cantonjs-react](./packages/cantonjs-react/).
|
|
290
301
|
|
|
291
|
-
`cantonjs-react` stays focused on participant-private ledger state.
|
|
302
|
+
`cantonjs-react` stays focused on participant-private ledger state.
|
|
303
|
+
For public Splice data, use TanStack Query directly with `cantonjs-splice-scan`; see [docs/examples/react.md](./docs/examples/react.md) and [docs/examples/public-scan-dashboard.md](./docs/examples/public-scan-dashboard.md).
|
|
292
304
|
|
|
293
305
|
### Splice Packages
|
|
294
306
|
|
|
295
|
-
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
-
|
|
307
|
+
- **`cantonjs-splice-scan`** — GA public Scan reads for DSO metadata, updates, and public ANS lookups.
|
|
308
|
+
Experimental Scan routes stay behind `cantonjs-splice-scan/experimental`.
|
|
309
|
+
See [docs/guide/scan.md](./docs/guide/scan.md).
|
|
310
|
+
- **`cantonjs-splice-validator`** — selected stable external validator support for ANS and the filtered GA Scan Proxy subset.
|
|
311
|
+
See [docs/guide/validator-ans.md](./docs/guide/validator-ans.md).
|
|
312
|
+
- **`cantonjs-splice-token-standard`** and **`cantonjs-splice-interfaces`** — GA stable CIP-0056 descriptors and ledger-centric helpers for new transfer and allocation flows.
|
|
313
|
+
See [docs/guide/token-standard.md](./docs/guide/token-standard.md).
|
|
299
314
|
|
|
300
315
|
## Testing
|
|
301
316
|
|
|
@@ -386,7 +401,7 @@ Design decisions are documented as Architecture Decision Records (ADRs):
|
|
|
386
401
|
|
|
387
402
|
## Related
|
|
388
403
|
|
|
389
|
-
- [cantonctl](https://github.com/merged-one/cantonctl) — CLI
|
|
404
|
+
- [cantonctl](https://github.com/merged-one/cantonctl) — CLI companion for sandbox, admin, and test workflows
|
|
390
405
|
- [Canton Network](https://www.canton.network/) — The Canton Network
|
|
391
406
|
- [Canton Docs](https://docs.digitalasset.com/) — Official Canton documentation
|
|
392
407
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cantonjs",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "TypeScript
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "Application-side TypeScript SDK for Canton participant Ledger API V2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"main": "./dist/cjs/index.js",
|
|
@@ -82,8 +82,9 @@
|
|
|
82
82
|
"test:coverage:all": "npm run test:coverage && npm run test:packages:coverage && npm --prefix packages/cantonjs-codegen run test:coverage && npm --prefix packages/cantonjs-react run test:coverage",
|
|
83
83
|
"test:packages": "node scripts/test-all.mjs packages",
|
|
84
84
|
"test:live:splice": "node scripts/test-all.mjs live",
|
|
85
|
-
"verify:ci:pr": "node scripts/test-all.mjs ci-pr",
|
|
85
|
+
"verify:ci:pr": "npm run verify:positioning && npm run docs:build && node scripts/test-all.mjs ci-pr",
|
|
86
86
|
"verify:coverage-exclusions": "node scripts/verify-coverage-exclusions.mjs",
|
|
87
|
+
"verify:positioning": "node scripts/verify-positioning.mjs",
|
|
87
88
|
"size": "size-limit",
|
|
88
89
|
"sync:splice-specs": "node scripts/sync-splice-specs.mjs",
|
|
89
90
|
"verify:splice-artifacts": "node scripts/verify-splice-artifacts.mjs",
|
|
@@ -100,11 +101,11 @@
|
|
|
100
101
|
"keywords": [
|
|
101
102
|
"canton",
|
|
102
103
|
"canton-network",
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
"ledger-api",
|
|
104
|
+
"participant",
|
|
105
|
+
"ledger-api-v2",
|
|
106
106
|
"typescript",
|
|
107
|
-
"
|
|
107
|
+
"sdk",
|
|
108
|
+
"streaming"
|
|
108
109
|
],
|
|
109
110
|
"author": "Charles Dusek",
|
|
110
111
|
"license": "Apache-2.0",
|