How do you construct an Enum using the Canton command line?

Hi all,

Looking to write up a bootstrap script for our testing canton environment, and one of the contracts I’d like the script to create contains an Enum, unfortunately I’m not currently able to get the command formatted in the right way. Here’s what I tried:

val pkgData = sandbox.packages.find("Main.Data").head
val enumId = Map("packageId" -> pkgData.packageId, "moduleName" -> "Main.Data", "entityName" -> "MyEnum")
val enum = Map("enumId" -> enumId, "constructor" -> "VALUE")

But then when I create the command providing that in the args, I get “unknown record” error for that enum.

Any help would be greatly appreciated!

Hi @lashenhurst,

I believe you do not have to create the enumId, could you please try to use the following?

import com.daml.ledger.api.v1.value.Value
import com.daml.ledger.api.v1.value.Enum
val enum = Value.Sum.Enum(Enum(constructor="VALUE"))
1 Like