Skip to content

Commit

Permalink
lets go
Browse files Browse the repository at this point in the history
  • Loading branch information
bjornkihlberg committed Jan 26, 2024
1 parent 328e6ba commit 7e6517b
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions packages/runtime/lifecycle/src/nodejs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,33 @@ import * as Wallet from "@marlowe.io/wallet/lucid";
import * as Generic from "../generic/runtime.js";
import { RuntimeLifecycle } from "../api.js";
import { Lucid } from "lucid-cardano";
import {
InvalidTypeError,
strictDynamicTypeCheck,
} from "@marlowe.io/adapter/io-ts";

export const mkRuntimeLifecycle = async (
export async function mkRuntimeLifecycle(
runtimeURL: string,
lucid: Lucid
): Promise<RuntimeLifecycle> => {
): Promise<RuntimeLifecycle>;
export async function mkRuntimeLifecycle(
runtimeURL: string,
lucid: Lucid,
strict: boolean
): Promise<RuntimeLifecycle>;
export async function mkRuntimeLifecycle(
runtimeURL: string,
lucid: Lucid,
strict: unknown = true
) {
if (!strictDynamicTypeCheck(strict)) {
throw new InvalidTypeError(
[],
`Invalid type for argument 'strict', expected boolean but got ${strict}`
);
}
const wallet = await Wallet.mkLucidWallet(lucid);
const deprecatedRestAPI = mkFPTSRestClient(runtimeURL);
const restClient = mkRestClient(runtimeURL);
const restClient = mkRestClient(runtimeURL, strict);
return Generic.mkRuntimeLifecycle(deprecatedRestAPI, restClient, wallet);
};
}

0 comments on commit 7e6517b

Please sign in to comment.