|
1 | | -# Catalyst milestone 2: Javascript support |
| 1 | +# Catalyst milestone 2: Javascript/Typescript support |
| 2 | + |
| 3 | +While the milestone technically requires Javascript support, we implemented [Typescript](https://www.typescriptlang.org/) support which is a [typed superset of Javascript](https://www.typescriptlang.org/docs/handbook/typescript-from-scratch.html#a-typed-superset-of-javascript). This was done to better interpolate with existing Javascript/Typescript libraries on Cardano such as [lucid](https://github.com/spacebudz/lucid), [cardano-js-sdk](https://github.com/input-output-hk/cardano-js-sdk), [cardano-serialization-lib](https://www.npmjs.com/package/@emurgo/cardano-serialization-lib-nodejs), etc. With Typescript support, we get Javascript support for free as the compilation from Typescript to Javascript is a well established practise. |
2 | 4 |
|
3 | 5 | ## Outputs |
4 | 6 |
|
5 | | -- [ ] A LambdaBuffers code generation module that outputs type constructors and derived implementations in the Javascript programming language given a LambdaBuffers schema. |
6 | | -- [ ] 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. |
7 | | -- [ ] 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. |
8 | | -- [ ] 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. |
9 | | -- [ ] 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. |
10 | | -- [ ] Nix devops modules (Nix API) for streamlining the LambdaBuffers code generation pipeline to Javascript. |
11 | | -- [ ] Documentation on LambdaBuffers usage patterns for Javascript. |
| 7 | +- [x] A LambdaBuffers code generation module that outputs type constructors and derived implementations in the Javascript programming language given a LambdaBuffers schema. |
| 8 | + - The module implementation is in [lambda-buffers-codegen/src/LambdaBuffers/Codegen/Typescript](https://github.com/mlabs-haskell/lambda-buffers/tree/2e2ed98f4df7f207ec3cf131adf5b47b202e248f/lambda-buffers-codegen/src/LambdaBuffers/Codegen/Typescript). |
12 | 9 |
|
13 | | -## Acceptance Criteria |
| 10 | +- [x] A Javascript library that implements the LambdaBuffers Prelude runtime. |
| 11 | + This module would include standardised JSON encoding and equality |
| 12 | + implementations for all declared type class instances in the schema. |
| 13 | + - A standalone Prelude library for Typescript was implemented together with |
| 14 | + its runtime for LambdaBuffers. These can be found here: |
| 15 | + - [prelude-typescript](https://github.com/mlabs-haskell/prelude-typescript) |
| 16 | + - [runtimes/typescript/lbr-prelude](https://github.com/mlabs-haskell/lambda-buffers/tree/343a1a900f42dcf5b1c1a7e330eafb07c280908b/runtimes/typescript/lbr-prelude) |
14 | 17 |
|
15 | | -- [ ] LambdaBuffers schemas that are based on the LambdaBuffers Prelude module can be used in Javascript projects to specify application types. |
16 | | -- [ ] LambdaBuffers schemas that are based on the LambdaBuffers Plutus module can be used in Javascript projects to specify application types. |
17 | | -- [ ] The documentation and devops tooling is available to facilitate easy adoption. |
| 18 | +- [x] 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. |
| 19 | + - A test suite ensuring that the manually implemented and automatically generated implementations can be found here: [testsuites/lbt-prelude/lbt-prelude-typescript](https://github.com/mlabs-haskell/lambda-buffers/tree/50bfbc4a182275d42be978b5a251530bab84f4aa/testsuites/lbt-prelude/lbt-prelude-typescript). |
| 20 | +- [x] 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. |
| 21 | + - A standalone Plutus library for Typescript was implemented together with |
| 22 | + its runtime for LambdaBuffers. These can be found here: |
18 | 23 |
|
19 | | -## Evidence of Milestone Completion |
| 24 | + - [plutus-ledger-api-typescript](https://github.com/mlabs-haskell/plutus-ledger-api-typescript) |
20 | 25 |
|
21 | | -- [ ] The completed and reviewed LambdaBuffers Prelude runtime library is available for the Javascript programming language. |
22 | | -- [ ] The completed and reviewed LambdaBuffers Plutus runtime library is available for the Javascript programming language. |
23 | | -- [ ] The completed and reviewed LambdaBuffers Prelude test suite is available and is passing in CI for the Javascript programming language. |
24 | | -- [ ] The completed and reviewed LambdaBuffers Plutus test suite is available and is passing in CI for the Javascript programming language. |
25 | | -- [ ] The completed and reviewed Nix API for LambdaBuffers Javascript support is available. |
26 | | -- [ ] The completed and reviewed LambdaBuffers for Javascript documentation is available. |
| 26 | + - [runtimes/typescript/lbr-plutus](https://github.com/mlabs-haskell/lambda-buffers/tree/dc5ee6797d1230661d6bb3dfa658eddeadd7cb60/runtimes/typescript/lbr-plutus) |
27 | 27 |
|
28 | | -## Demo recordings |
| 28 | +- [x] 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. |
| 29 | + - A test suite ensuring that the manually implemented and automatically generated implementations can be found here: [testsuites/lbf-plutus/lbf-plutus-typescript](https://github.com/mlabs-haskell/lambda-buffers/tree/50bfbc4a182275d42be978b5a251530bab84f4aa/testsuites/lbt-plutus/lbt-plutus-typescript) |
| 30 | +- [x] Nix devops modules (Nix API) for streamlining the LambdaBuffers code generation pipeline to Javascript. |
| 31 | + - New flake modules were implemented to easily generate NPM packages from LambdaBuffers |
| 32 | + - [lbf-typescript](https://github.com/mlabs-haskell/lambda-buffers/blob/f59bdb78d06fa677567d053eddb3d1fe46250fd8/extras/lbf-nix/lbf-typescript.nix) |
| 33 | + - [lbf-prelude-typescript](https://github.com/mlabs-haskell/lambda-buffers/blob/f59bdb78d06fa677567d053eddb3d1fe46250fd8/extras/lbf-nix/lbf-prelude-typescript.nix) |
| 34 | + - [lbf-plutus-typescript](https://github.com/mlabs-haskell/lambda-buffers/blob/f59bdb78d06fa677567d053eddb3d1fe46250fd8/extras/lbf-nix/lbf-plutus-typescript.nix) |
| 35 | +- [x] Documentation on LambdaBuffers usage patterns for Javascript. |
| 36 | + - [A new page was created for the TypeScript use case](https://mlabs-haskell.github.io/lambda-buffers/typescript.html) |
29 | 37 |
|
30 | | -- [ ] |
| 38 | +## Acceptance Criteria |
| 39 | + |
| 40 | +- [x] LambdaBuffers schemas that are based on the LambdaBuffers Prelude module can be used in Javascript projects to specify application types. |
| 41 | + - 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](https://github.com/mlabs-haskell/lambda-buffers/tree/50bfbc4a182275d42be978b5a251530bab84f4aa/testsuites/lbt-prelude/lbt-prelude-typescript) |
| 42 | + - Moreover, there is a [docs/typescript-prelude](https://github.com/mlabs-haskell/lambda-buffers/tree/1d806a1710aab625ea520c596a72338c5bde578d/docs/typescript-prelude) sample project which also demonstrates this. |
| 43 | +- [x] LambdaBuffers schemas that are based on the LambdaBuffers Plutus module can be used in Javascript projects to specify application types. |
| 44 | + - 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](https://github.com/mlabs-haskell/lambda-buffers/tree/50bfbc4a182275d42be978b5a251530bab84f4aa/testsuites/lbt-plutus/lbt-plutus-typescript) |
| 45 | + - Moreover, there is a [docs/typescript-plutus](https://github.com/mlabs-haskell/lambda-buffers/tree/1d806a1710aab625ea520c596a72338c5bde578d/docs/typescript-plutus) sample project which also demonstrates this. |
| 46 | +- [x] The documentation and devops tooling is available to facilitate easy adoption. |
| 47 | + - Similarly to other languages supported by LambdaBuffers, a [TypeScript flake](https://github.com/mlabs-haskell/flake-lang.nix/tree/5bb4fdf556a2f2f23717c654c186f13f28b9c277/flake-lang/typescript) is implemented along with its documentation. |
| 48 | + The testing libraries also serve as an example, to understand how to use these Nix utilities: |
| 49 | + [testsuites/lbt-plutus/lbt-plutus-typescript/build.nix](https://github.com/mlabs-haskell/lambda-buffers/blob/4c6304cf3a3a0c08bbb46e94532a293fdea513e9/testsuites/lbt-plutus/lbt-plutus-typescript/build.nix). |
31 | 50 |
|
32 | | -Demo files: |
| 51 | +## Evidence of Milestone Completion |
33 | 52 |
|
34 | | -- [ ] |
| 53 | +- [x] The completed and reviewed LambdaBuffers Prelude runtime library is available for the Javascript programming language. |
| 54 | + - [runtimes/typescript/lbr-prelude](https://github.com/mlabs-haskell/lambda-buffers/tree/343a1a900f42dcf5b1c1a7e330eafb07c280908b/runtimes/typescript/lbr-prelude) |
| 55 | + - [prelude-typescript](https://github.com/mlabs-haskell/prelude-typescript) |
| 56 | +- [x] The completed and reviewed LambdaBuffers Plutus runtime library is available for the Javascript programming language. |
| 57 | + - [runtimes/typescript/lbr-plutus](https://github.com/mlabs-haskell/lambda-buffers/tree/dc5ee6797d1230661d6bb3dfa658eddeadd7cb60/runtimes/typescript/lbr-plutus) |
| 58 | + - [plutus-ledger-api-typescript](https://github.com/mlabs-haskell/plutus-ledger-api-typescript) |
| 59 | +- [x] The completed and reviewed LambdaBuffers Prelude test suite is available and is passing in CI for the Javascript programming language. |
| 60 | + - [testsuites/lbt-prelude/lbt-prelude-typescript](https://github.com/mlabs-haskell/lambda-buffers/tree/50bfbc4a182275d42be978b5a251530bab84f4aa/testsuites/lbt-prelude/lbt-prelude-typescript) |
| 61 | +- [x] The completed and reviewed LambdaBuffers Plutus test suite is available and is passing in CI for the Javascript programming language. |
| 62 | + - [testsuites/lbf-plutus/lbt-plutus-typescript](https://github.com/mlabs-haskell/lambda-buffers/tree/50bfbc4a182275d42be978b5a251530bab84f4aa/testsuites/lbt-plutus/lbt-plutus-typescript) |
| 63 | +- [x] The completed and reviewed Nix API for LambdaBuffers Javascript support is available. |
| 64 | + - [lbf-typescript](https://github.com/mlabs-haskell/lambda-buffers/blob/f59bdb78d06fa677567d053eddb3d1fe46250fd8/extras/lbf-nix/lbf-typescript.nix) |
| 65 | + - [lbf-prelude-typescript](https://github.com/mlabs-haskell/lambda-buffers/blob/f59bdb78d06fa677567d053eddb3d1fe46250fd8/extras/lbf-nix/lbf-prelude-typescript.nix) |
| 66 | + - [lbf-plutus-typescript](https://github.com/mlabs-haskell/lambda-buffers/blob/f59bdb78d06fa677567d053eddb3d1fe46250fd8/extras/lbf-nix/lbf-plutus-typescript.nix) |
| 67 | +- [x] The completed and reviewed LambdaBuffers for Javascript documentation is available. |
| 68 | + - [TypeScript documentation](google.com) TODO(jaredponn) put the commit here just before this when this is reviewed |
35 | 69 |
|
36 | | -## References |
| 70 | +## Demo files |
37 | 71 |
|
38 | | -- [ ] |
| 72 | +- Demo project: [lambda-buffers-for-cardano](https://github.com/mlabs-haskell/lambda-buffers-for-cardano/tree/main/transactions/demo-typescript) |
0 commit comments