TezosTaqueria / taqueria

*BETA* Taqueria provides a seamless development workflow to easily build, test and deploy your Tezos applications.
https://taqueria.io
Apache License 2.0
64 stars 20 forks source link

Test for valid JSON representations of high priority michelson types #892

Closed mweichert closed 2 years ago

mweichert commented 2 years ago

Describe the feature you would like

Taquito should be able to support JSON representations for any michelson types. Taqueria requires this given that our contract storage values are specified in JSON format. There's other use cases too that make having JSON representations desirable.

This epic contains the list of high priority michelson types we need JSON representations for: https://github.com/ecadlabs/taqueria/issues/235

@houston - we should document how each type can be represented by JSON.

The scope of this issue is to create a unit test in Taquito for each michelson type, and try using a JSON representation for the data and see if Taquito handles it appropriately. If it doen't, we should create another issue in Taquito and work on that separately.

Is this feature solving a problem?

JSON representations are widely useful - for instance, non-JS/TS tools can create storage representations and then pass those to Taquito via some downstream mechanism.

However, the biggest thing right now is that Taqueria has storage specified in JSON format.

Please share any additional details you have?

Some suggestions:

These should accept string representations with regex pattern matches: https://tezos.gitlab.io/michelson-reference/#type-signature https://tezos.gitlab.io/michelson-reference/#type-key https://tezos.gitlab.io/michelson-reference/#type-key_hash

These should use array representations: https://tezos.gitlab.io/michelson-reference/#type-list

These should use object literal representations: https://tezos.gitlab.io/michelson-reference/#type-map

This should be representable using null or empty string https://tezos.gitlab.io/michelson-reference/#type-unit https://tezos.gitlab.io/michelson-reference/#type-never

For the option type, Some x should be represented as any value other than null. None should be represented as null.

For the timestamp type, we should support a string that matches the regex expected, or an integer that represents a unix timestamp.

Type Priorities

High priority types:

Medium priority types:

Low priority types:

Code of Conduct

hu3man commented 2 years ago

We should ensure that we can provide initial storage for all the contracts in the LIGO repo: https://gitlab.com/ligolang/contract-catalogue/

jchenche commented 2 years ago

CHECKED all 30 types from https://tezos.gitlab.io/michelson-reference plus chest and chest_key types. Every Michelson type now has unit tests in Taquito to make sure that Taquito can handle their plain JSON representation and convert them to Michelson encoded JSON, except for Michelson Lambda types where users will have to specify their values directly in Michelson encoded JSON. PR for this: https://github.com/ecadlabs/taquito/pull/1722