Scala codegen and ExerciseByKey

If I run Scala Codegen on a template that has a key, how do I create an ExerciseByKeyCommand, i.e., of the form:
https://docs.daml.com/app-dev/grpc/proto-docs.html#com-daml-ledger-api-v1-exercisebykeycommand

Is this possible? I didn’t find anything in the codegen guide. A pointer to an example would be appreciated.

1 Like

In the Java codegen you can create it via static methods. For example:

MyTypeWithAKey.exerciseByKeyExampleChoice("Example argument");

Is this helpful or is the Scala codegen that different?

The Scala code generation unfortunately does not generate a method to exercise by key, as of 1.2.x.

Thanks, @Tamas_Kalcza and @stefanobaghino-da. Setting Java codegen up in addition to Scala is too much work for what I’m trying to do currently, so I’ll just convert the resulting gRPC ExerciseCommand into an ExerciseByKeyCommand by hand.

Probably the best choice. I’ve added a GitHub issue as well.

1 Like

We’ve added this to Scala codegen, so it should appear in the next release.

3 Likes

Note that this is not part of the current 1.3RC, so “next release” here probably means 1.4.

1 Like