Add a way to get the Michelson representation of a type
When implementing a TZIP-16 Michelson storage view with Ligo requires us to also specify the parameter and return types of a function (as JSON-formatted Michelson), alongside with the actual code.
However, currently there is no easy way to compile a single type with ligo
. I found a workaround as compiling the expression fun (i: bytes) -> (Bytes.unpack i: myType option)
with --michelson-format json
, and extracting the type parameter to the UNPACK
primitive. A less hacky solution would be ideal, eg ligo compile-type cameligo --init-file ... --michelson-format json 'myType'
.