How have the codegen'd clients changed to support the SCU feature?
App Development2 posts53 views2 likesLast activity Apr 2025
WA
WallaceKellyOP
Apr 2025The Smart Contract Upgrades feature means that I can interact with the ledger using “package names” instead of “package ids.” What does that look like in the codegen’d client code?
WA
WallaceKelly
Apr 2025The codegen’d client code defaults to using the package name instead of the package id.
The easiest way to see this is as follows:
- Create a new project.
DAML_SDK_VERSION=2.10.0 daml new codegend
cd codegend
git init
- Edit the
daml.yamlfile to usedaml-script-lts:
sdk-version: 2.10.0
name: codegend
source: daml
init-script: Main:setup
version: 0.0.1
dependencies:
- daml-prim
- daml-stdlib
- daml-script-lts
- Build, codegen, and commit with
--target=1.15:
daml build --target=1.15
daml codegen js -o js/ .daml/dist/codegend-0.0.1.dar
daml codegen java -o java/ .daml/dist/codegend-0.0.1.dar
git add .
git commit -m "for target 1.15"
- Build, codegen, and diff with
--target=1.17:
rm -rf js
rm -rf java
daml build --target=1.17
daml codegen js -o js/ .daml/dist/codegend-0.0.1.dar
daml codegen java -o java/ .daml/dist/codegend-0.0.1.dar
git diff
You will see that with --target=1.17, the codegen client code defaults to using the package name instead of the package id.
TypeScript example:
Java example:

