protobuf-specs

Protobuf specification and definitions representing blockchain data types and communication channels.

Plasma logo Code of Conduct License @PlasmaFDN on Twitter @PlasmaFDN release

When testing changes, it helps to verify their behavior in the libraries that consume these protobuf specs. You can publish the compiled protobuf as a "local" library and consume it in a different project.

Target Languages

Protobuf specs is built using Protobuf and uses different protocol buffer compiler tools to target specific languages, Scala, Dart, TS.

Scala

These are the step to update the specs

  1. cd build/scala
  2. sbt +publishLocal
  3. Check out target folder if you need to inspect generated code.
    • plasma-protobuf-specs/build/scala/protobuf-fs2/target/scala-2.13/src_managed/main
    • plasma-protobuf-specs/build/scala/protobuf-fs2/target/scala-3.4.1/src_managed/main

Build process generates Scala 2.x and Scala 3.x artifacts

  • Each time a tag is pushed: releases: releases
  • Each time a branch commit is pushed: snapshots

Both of them are published on Maven Central repository.

  resolvers ++= Seq(
    "Sonatype Staging" at "https://s01.oss.sonatype.org/content/repositories/staging",
    "Sonatype Snapshots" at "https://s01.oss.sonatype.org/content/repositories/snapshots/",
    "Sonatype Releases" at "https://s01.oss.sonatype.org/content/repositories/releases/"
  )

 libraryDependencies +=  "org.plasmalabs" %% "protobuf-fs2" % "x.z.y"

Dart

  1. Install Dart protoc_plugin
  2. cd build/dart
  3. sh compile_protos.sh
  4. dart run tool/generate_export_files.dart
  5. Reference the protobuf-specs/build/dart directory as a pubspec file dependency
    dependencies:
      topl_protobuf:
        path: /path/to/protobuf-specs/build/dart
    

Typescript

We use Protobuf-es V1 for generation as it's the most compliant protobuf compiler available for ts

  1. cd build/ts
  2. sh build.sh

Usages

See related projects