Allow "Open in try-michelson" use-case
We want to add a feature in ide.ligolang.org that allows a user to open the Michelson code produced by the ligo compiler (in the webide) in the try-michelson ide.
This would allow the user to further explore/typecheck the Michelson that is produced from their ligo smart contract.
This feature could equally be useful for IDE features that allow the user to "Share this Michelson on the try-michelson IDE".
What we would need from try-michelson is a way to get our Michelson loaded into the try-micelson website.
Two ways to achieve this come to mind;
- base64 encode the Michelson, and stuff it in a get param
https://try-michelson.tzalpha.net/?source=eyBwYXJhbWV0ZXIgKG9yIChpbnQgJWRlY3JlbWVudCkgKGludCAlaW5jcmVtZW50KSkgOwogIHN0b3JhZ2UgaW50IDsKICBjb2RlIHsgRFVQIDsKICAgICAgICAgRFVQIDsKICAgICAgICAgQ0RSIDsKICAgICAgICAgRElQIHsgRFVQIH0gOwogICAgICAgICBTV0FQIDsKICAgICAgICAgQ0FSIDsKICAgICAgICAgSUZfTEVGVAogICAgICAgICAgIHsgRElQIHsgRFVQIH0gOwogICAgICAgICAgICAgU1dBUCA7CiAgICAgICAgICAgICBESVAgeyBEVVAgfSA7CiAgICAgICAgICAgICBQQUlSIDsKICAgICAgICAgICAgIERVUCA7CiAgICAgICAgICAgICBDQVIgOwogICAgICAgICAgICAgRElQIHsgRFVQIDsgQ0RSIH0gOwogICAgICAgICAgICAgU1VCIDsKICAgICAgICAgICAgIERJUCB7IERST1AgMiB9IH0KICAgICAgICAgICB7IERJUCB7IERVUCB9IDsKICAgICAgICAgICAgIFNXQVAgOwogICAgICAgICAgICAgRElQIHsgRFVQIH0gOwogICAgICAgICAgICAgUEFJUiA7CiAgICAgICAgICAgICBEVVAgOwogICAgICAgICAgICAgQ0FSIDsKICAgICAgICAgICAgIERJUCB7IERVUCA7IENEUiB9IDsKICAgICAgICAgICAgIEFERCA7CiAgICAgICAgICAgICBESVAgeyBEUk9QIDIgfSB9IDsKICAgICAgICAgRFVQIDsKICAgICAgICAgTklMIG9wZXJhdGlvbiA7CiAgICAgICAgIFBBSVIgOwogICAgICAgICBESVAgeyBEUk9QIDQgfSB9IH0K
This solution is simple, but will run into problems if the michelson code is too big.
- Offer an endpoint that we can HTTP POST our Michelson source code to, and get a unique "share" url back. We would take the share url and present it to the user. An example of such a URL in the ligo web-ide looks like this: https://ide.ligolang.org/p/sWjf7_hrTZs4XcmVd8Gi7g