Skip to content

Add `parse` and `base58encode` commands to morley-repl

Sandeep.C.R requested to merge sras/repl-parse-command into master

This change adds a couple of commands to the Morley REPL that might be helpful when working in Tezos related projects. The new commands are,

The :parse command:

Sometimes we encounter strings while working in Michelson and Tezos, of an unknown type. It might be nice to have a tool that tries to parse the string using some of the known formats, and output the successful parse results.

Example use:

:parse 12312312313
Michelson Timestamp
-------------------
VTimestamp (Timestamp {unTimestamp = 12312312313s})

Michelson Int
-------------
VInt 12312312313

Michelson Nat
-------------
VNat 12312312313

Michelson Mutez
---------------
VMutez (UnsafeMutez {unMutez = 12312312313})

Michelson Bls12381Fr
--------------------
VBls12381Fr (Bls12381Fr {unBls12381Fr = P (12312312313 `modulo` 52435875175126190479447740508185965837690552500527637822603658699938581184513)})

Base58 Encoded Bytes
--------------------
0x001b4c65c10161f2

The :base58encode command

This command accept a hexcoded bytestring, and prints the base58encoded and the base58encodeCheck encoded values.

Edited by Sandeep.C.R

Merge request reports