The RestClient offers a simple abstraction for the Marlowe Runtime REST API endpoints. You can create an instance of the RestClient using the mkRestClient function.

import { mkRestClient } from "@marlowe.io/runtime-rest-client";
const restClient = mkRestClient("http://localhost:8080");
const isHealthy = await restClient.healthcheck();

Remarks

This version of the RestClient targets version 0.0.5 of the Marlowe Runtime.

Hierarchy

  • RestClient

Methods

  • Get inputs which could be performed on a contract within a time range by the requested parties.

    Parameters

    Returns Promise<{
        applicable_inputs: { notify: Option<{ case_index: bigint; is_merkleized_continuation: boolean; }>; deposits: { case_index: bigint; party: Address | Role; can_deposit: bigint; of_token: Token; into_account: Address | Role; is_merkleized_continuation: boolean; }[]; choices: { ...; }[]; };
        can_reduce: boolean;
    }>

    Throws

    DecodingError - If the response from the server can't be decoded

    See

    The backend documentation

  • Get published withdrawal transactions.

    Parameters

    Returns Promise<{
        page: ({ total: number; }) & {
            current?: Branded<string, ItemRangeBrand>;
        } & {
            next?: Branded<string, ItemRangeBrand>;
        };
        withdrawals: ({ withdrawalId: WithdrawalId; status: "unsigned" | "submitted" | "confirmed"; block: Option<{ slotNo: bigint; blockNo: bigint; blockHeaderHash: string; }>; })[];
    }>