canton-language-bindings
Installation
SKILL.md
Canton Language Bindings (Codegen)
Overview
Code generation produces type-safe client bindings from your Daml model: each template becomes a class/type with methods to create contracts and exercise choices. Instead of hand-building raw gRPC messages or JSON payloads, you work with generated objects that mirror your templates and choices.
Java vs TypeScript
| Target | Command | Typical use |
|---|---|---|
| Java | dpm codegen-java |
gRPC Ledger API backends (e.g. cn-quickstart's Java backend) |
| TypeScript/JS | dpm codegen-js |
Node backends, or frontends submitting directly to the Ledger/JSON API |
Workflow
dpm build # produce the DAR first
dpm codegen-java # → typed Java classes per template/choice
# or
dpm codegen-js # → typed TS modules (one subfolder per Daml module)
The generated types integrate with the Ledger API client: build a CreateCommand from a typed template record, or an ExerciseCommand from a typed choice argument, then submit via the gRPC or JSON API.