Catalyst milestone 2: Javascript/Typescript support
While the milestone technically requires Javascript support, we implemented Typescript support which is a typed superset of Javascript. This was done to better interpolate with existing Javascript/Typescript libraries on Cardano such as lucid, cardano-js-sdk, cardano-serialization-lib, etc. With Typescript support, we get Javascript support for free as the compilation from Typescript to Javascript is a well established practise.
Outputs
-
A LambdaBuffers code generation module that outputs type constructors and derived implementations in the Javascript programming language given a LambdaBuffers schema.
- The module implementation is in lambda-buffers-codegen/src/LambdaBuffers/Codegen/Typescript.
-
A Javascript library that implements the LambdaBuffers Prelude runtime. This module would include standardised JSON encoding and equality implementations for all declared type class instances in the schema.
- A standalone Prelude library for Typescript was implemented together with its runtime for LambdaBuffers. These can be found here:
-
A Javascript test suite that assures the manually implemented and automatically generated implementations are consistent with the predefined LambdaBuffers Prelude golden data set of JSON files and perform correct implementation derivation.
- A test suite ensuring that the manually implemented and automatically generated implementations can be found here: testsuites/lbt-prelude/lbt-prelude-typescript.
-
A Javascript library that implements the LambdaBuffers Plutus runtime. This module would include standardised PlutusData encoding implementations for all declared type class instances in the Plutus schema.
- A standalone Plutus library for Typescript was implemented together with its runtime for LambdaBuffers. These can be found here:
-
A Javascript test suite that assures the manually implemented and automatically generated implementations are consistent with the predefined LambdaBuffers Plutus golden data set of PlutusData encoded files and perform correct implementation derivation.
- A test suite ensuring that the manually implemented and automatically generated implementations can be found here: testsuites/lbt-plutus/lbt-plutus-typescript
-
Nix devops modules (Nix API) for streamlining the LambdaBuffers code generation pipeline to Javascript.
- New flake modules were implemented to easily generate NPM packages from LambdaBuffers
-
Documentation on LambdaBuffers usage patterns for Javascript.
Acceptance Criteria
-
LambdaBuffers schemas that are based on the LambdaBuffers Prelude module can be used in Javascript projects to specify application types.
- Test libraries for Prelude demonstrate how TypeScript code for the LambdaBuffers Prelude is generated to TypeScript and used in a library: testsuites/lbt-prelude/lbt-prelude-typescript
- Moreover, there is a docs/typescript-prelude sample project which also demonstrates this.
-
LambdaBuffers schemas that are based on the LambdaBuffers Plutus module can be used in Javascript projects to specify application types.
- Test libraries for Plutus demonstrate how TypeScript code for the LambdaBuffers Prelude is generated to TypeScript and used in a library: testsuites/lbt-plutus/lbt-plutus-typescript
- Moreover, there is a docs/typescript-plutus sample project which also demonstrates this.
-
The documentation and devops tooling is available to facilitate easy adoption.
- Similarly to other languages supported by LambdaBuffers, a TypeScript flake is implemented along with its documentation. The testing libraries also serve as an example to understand how to use the Nix utilities: testsuites/lbt-plutus/lbt-plutus-typescript/build.nix.
Evidence of Milestone Completion
- The completed and reviewed LambdaBuffers Prelude runtime library is available for the Javascript programming language.
- The completed and reviewed LambdaBuffers Plutus runtime library is available for the Javascript programming language.
- The completed and reviewed LambdaBuffers Prelude test suite is available and is passing in CI for the Javascript programming language.
- The completed and reviewed LambdaBuffers Plutus test suite is available and is passing in CI for the Javascript programming language.
- The completed and reviewed Nix API for LambdaBuffers Javascript support is available.
- The completed and reviewed LambdaBuffers for Javascript documentation is available.
Demo files
- Demo project: lambda-buffers-for-cardano