The 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?
The 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.yaml
file 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:
2 Likes