Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@marlowe.io/runtime-rest-client

Package Overview
Dependencies
Maintainers
3
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@marlowe.io/runtime-rest-client

Client of Runtime REST API

latest
Source
npmnpm
Version
0.4.0-beta
Version published
Maintainers
3
Created
Source

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 {@link index | module} exposes the {@link index.mkRestClient} function, which returns an instance of a {@link index.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>

FAQs

Package last updated on 11 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts