Module @marlowe.io/runtime-rest-client

Description

The runtime-rest-client package provides a JS API to interact with the runtime REST API. It is intended to work with version 0.0.5 of the API.

The main module exposes the mkRestClient function, which returns an instance of a RestClient.

Getting started

The @marlowe.io/runtime-rest-client 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

Instantiating a client requires a runtime URL to the desired network which can either be self hosted with instructions in Marlowe starter kit or through a service such as Demeter.

The caller should run a healthcheck to ensure the runtime service is healthy throughout the lifecycle of the client.

<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 { mkRestClient } from "@marlowe.io/runtime-rest-client";

let runtimeURL = process.env.MARLOWE_RUNTIME_URL;

const client = mkRestClient(runtimeURL);
const hasValidRuntime = await client.healthcheck();

if (!hasValidRuntime) throw new Error("Invalid Marlowe Runtime instance");
</script>
</body>
</html>

Index

Modules