Can't build create-daml-app in 1.7
- anthonyOP
Steps to reproduce:
-- Edit daml.yaml so sdk-version: 1.7.0 daml build daml codegen js .daml/dist/my-app-0.1.0.dar -o ui/daml.js daml deploy --host localhost --port 6865 daml json-api --ledger-host localhost --ledger-port 6865 --http-port 7575 --address 0.0.0.0 --allow-insecure-tokens cd ui/ export REACT_APP_LEDGER_ID=fabric-ledger npm install npm startAll building works up until
npm startwhere I get the following error which I believe may be related to the recent api change infetchByKeyand similar functions:/Users/anthonylusardi/software/my-app/ui/src/components/LoginScreen.tsx TypeScript error in /Users/anthonylusardi/software/my-app/ui/src/components/LoginScreen.tsx(25,50): Argument of type 'Template<User, string, "b5b1f86483ff42ebfdea3ef260a6407140906dcb8b3b7f4b0f8ca0b99c7ac5ce:User:User"> & { Archive: Choice<User, Archive, {}, string>; Follow: Choice<...>; }' is not assignable to parameter of type 'Template<object, string, string>'. Type 'Template<User, string, "b5b1f86483ff42ebfdea3ef260a6407140906dcb8b3b7f4b0f8ca0b99c7ac5ce:User:User"> & { Archive: Choice<User, Archive, {}, string>; Follow: Choice<...>; }' is missing the following properties from type 'Template<object, string, string>': sdkVersion, keyEncode, encode TS2345 23 | try { 24 | const ledger = new Ledger({token: credentials.token, httpBaseUrl}); > 25 | let userContract = await ledger.fetchByKey(User.User, credentials.party); | ^ 26 | if (userContract === null) { 27 | const user = {username: credentials.party, following: []}; 28 | userContract = await ledger.create(User.User, user); - anthony 1
Answered my own question, this issue can be resolved by manually setting your
DAML_SDK_VERSIONprior to runningdaml create-daml-app my-app. So in my example I would do:DAML_SDK_VERSION=1.7.0 daml create-daml-app my-appThis post shows how to specify it: Using old SDK version
- cocreature 1
You need to adjust both
daml.yamlandpackage.json.