cryptonomic / tezos-micheline-to-michelson-conversion   0.1.0

GNU General Public License v3.0 only GitHub

Scala and NodeJS code to covert from Micheline to Michelson

Scala versions: 2.13 2.12
Scala.js versions: 1.x


Scala library to covert Tezos Micheline representation into Michelson.

Cross-compiled to Javascript and published to NPM as tezos-micheline-to-michelson-conversion package.

How to use (Scala)

Add the dependency into your build.sbt:

libraryDependencies += "tech.cryptonomic" %% "tezos-micheline-to-michelson-conversion" % "0.1.0"

And then you can run the conversion the following way:

import tech.cryptonomic.tezos.translator.michelson.MichelineToMichelson
import tech.cryptonomic.tezos.translator.michelson.ast.Schema

val micheline: String = "..."

val michelson: Either[Throwable, String] = MichelineToMichelson.convert[Schema](micheline)

If you want to have access to parsed Micheline AST before emitting Michelson, use Parser:

import tech.cryptonomic.tezos.translator.michelson.parser.Parser
import tech.cryptonomic.tezos.translator.michelson.ast.Schema
import tech.cryptonomic.tezos.translator.michelson.emitter.MichelsonEmitter._

val micheline: String = "..."

val ast: Either[Throwable, Schema] = Parser.parse[Schema](micheline)
// produces Michelson code string

How to use (NPM)

npm install tezos-micheline-to-michelson-conversion
var translator = require("tezos-micheline-to-michelson-conversion").Translator
var input = "..."

Publishing (for maintainers)

To be able to publish a new version, you need

  • to be logged in under NPM account, that has maintainer access to the repo (npm login)
  • to have sonatype credentials specified in ~/.sbt/1.0/sonatype.sbt, for example:
credentials += Credentials(
  "Sonatype Nexus Repository Manager",

When these are setup, you can launch interactive release process with sbt release, which will prompt you for a release version number and eventually publish both maven jars and npm package.