@marlowe.io/language-core-v1
TypeScript icon, indicating that this package has built-in type declarations

0.4.0-beta • Public • Published

Description

This package contains code to work with the version 1 of Marlowe Core. It exports 5 modules:

  • @{@link index | marlowe.io/language-core-v1} - Exports static types (TypeScript only) for the JSON schema as specified in the Appendix E of the {@link https://github.com/input-output-hk/marlowe/releases/download/v3/Marlowe.pdf | Marlowe specification}
  • @{@link guards | marlowe.io/language-core-v1/guards} - Exports {@link !io-ts-usage | Dynamic type guards} (both JavaScript and TypeScript) for the same schema. These are used to validate the JSON objects at runtime.
  • @{@link playground-v1 | marlowe.io/language-core-v1/playground-v1} - Exports constructors compatible with the Playground's marlowe-js internal library.
  • @{@link semantics | marlowe.io/language-core-v1/semantics} - Exports the semantics of the Core language as specified in the {@link https://github.com/input-output-hk/marlowe/releases/download/v3/Marlowe.pdf | Marlowe specification}. This can be used to simulate or unit test a contract.

Getting started

This package is released as an ESM module and can be used with a modern bundler or imported directly in the browser (without any bundler) as long as you use an import map.

Browser

<html>
  <body>
    <script src="https://cdn.jsdelivr.net/gh/input-output-hk/marlowe-ts-sdk@0.4.0-beta/jsdelivr-npm-importmap.js"></script>
    <script type="module">
      import { Contract } from "@marlowe.io/language-core-v1/guards";
      const jsonObject = JSON.parse(httpResponse);

      if (Contract.is(jsonObject)) {
        // The jsonObject respects the JSON schema for Contract
      } else {
        // The jsonObject does not respect the JSON schema for Contract
      }
    </script>
  </body>
</html>

Readme

Keywords

none

Package Sidebar

Install

npm i @marlowe.io/language-core-v1

Weekly Downloads

2

Version

0.4.0-beta

License

Apache-2.0

Unpacked Size

1.42 MB

Total Files

127

Last publish

Collaborators

  • hrajchert
  • nhenin
  • inputoutput