diff --git a/packages/runtime/lifecycle/src/nodejs/index.ts b/packages/runtime/lifecycle/src/nodejs/index.ts index 4624eeff..224fd89e 100644 --- a/packages/runtime/lifecycle/src/nodejs/index.ts +++ b/packages/runtime/lifecycle/src/nodejs/index.ts @@ -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 => { +): Promise; +export async function mkRuntimeLifecycle( + runtimeURL: string, + lucid: Lucid, + strict: boolean +): Promise; +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); -}; +}