diff --git a/Readme.md b/Readme.md index f45f3d74..7f222a80 100644 --- a/Readme.md +++ b/Readme.md @@ -79,8 +79,3 @@ Prototypes have been also built on top of this sdk: To report a bug or request a new feature, please look through existing [Github Issues](https://github.com/input-output-hk/marlowe-ts-sdk/issues) before opening a new one. To help in the development of this SDK, please refer to [this document](./doc/howToDevelop.md). - - - - - diff --git a/changelog.d/20240511_113958_nicolas.henin_runtime_lifecycle_refactor.md b/changelog.d/20240511_113958_nicolas.henin_runtime_lifecycle_refactor.md index 1d41d845..80c0f2a7 100644 --- a/changelog.d/20240511_113958_nicolas.henin_runtime_lifecycle_refactor.md +++ b/changelog.d/20240511_113958_nicolas.henin_runtime_lifecycle_refactor.md @@ -11,7 +11,7 @@ ### @marlowe.io/runtime-rest-client -- Feat: `initial account deposits` (runtime v1.0.0) for Contract Creation (`BuildCreateContractTxRequest` via `buildCreateContractTx`)([PR-188](https://github.com/input-output-hk/marlowe-ts-sdk/pull/188)) +- Feat: `initial account deposits` (runtime v1.0.0) for Contract Creation (`BuildCreateContractTxRequest` via `buildCreateContractTx`):([PR-188](https://github.com/input-output-hk/marlowe-ts-sdk/pull/188)) ### @marlowe.io/runtime-core @@ -24,10 +24,10 @@ - Generic `waitConfirmation()` : same for contract creation and apply inputs - Seamless Integration of Applicable Actions API - simplfied interface (`create` and `load` with a concept of `ContractInstance` object) - - see end to end tests for examples (e.g : `swap.ada.token.e2e.spec.ts`) + - see end-to-end tests for examples (e.g : `swap.ada.token.e2e.spec.ts`) - Feat: `initial account deposits` feature (runtime v1.0.0) for Contract Creation ([PR-188](https://github.com/input-output-hk/marlowe-ts-sdk/pull/188)): - new parameter field `accountDeposits` in - - e.g + - e.g. ```ts const sellerContractInstance = await sellerLifecycle.newContractAPI.create({ @@ -40,4 +40,4 @@ const sellerContractInstance = await sellerLifecycle.newContractAPI.create({ ### @marlowe.io/language-examples - Feat: `Atomic swap v2` : Simplified version using the new runtime `v1.0.0` feature (`initial account deposits`) - - see end to end tests for examples (e.g : `swap.ada.token.e2e.spec.ts`) + - see end-to-end tests for examples (e.g : `swap.ada.token.e2e.spec.ts`) diff --git a/examples/rest-client-flow/index.html b/examples/rest-client-flow/index.html index ced4ce46..bafe4be2 100644 --- a/examples/rest-client-flow/index.html +++ b/examples/rest-client-flow/index.html @@ -25,13 +25,7 @@

Request

This should be filled with a JSON object that starts with an array, where each element is a numbered parameter.

- +
diff --git a/jsdelivr-npm-importmap.js b/jsdelivr-npm-importmap.js index 137f2635..a357d258 100644 --- a/jsdelivr-npm-importmap.js +++ b/jsdelivr-npm-importmap.js @@ -42,10 +42,8 @@ const importMap = { "https://cdn.jsdelivr.net/npm/@marlowe.io/language-specification-client@0.4.0-beta-rc1/dist/bundled/esm/language-specification-client.js", "@marlowe.io/token-metadata-client": "https://cdn.jsdelivr.net/npm/@marlowe.io/token-metadata-client@0.4.0-beta-rc1/dist/bundled/esm/token-metadata-client.js", - "@marlowe.io/wallet": - "https://cdn.jsdelivr.net/npm/@marlowe.io/wallet@0.4.0-beta-rc1/dist/bundled/esm/wallet.js", - "@marlowe.io/wallet/api": - "https://cdn.jsdelivr.net/npm/@marlowe.io/wallet@0.4.0-beta-rc1/dist/bundled/esm/api.js", + "@marlowe.io/wallet": "https://cdn.jsdelivr.net/npm/@marlowe.io/wallet@0.4.0-beta-rc1/dist/bundled/esm/wallet.js", + "@marlowe.io/wallet/api": "https://cdn.jsdelivr.net/npm/@marlowe.io/wallet@0.4.0-beta-rc1/dist/bundled/esm/api.js", "@marlowe.io/wallet/browser": "https://cdn.jsdelivr.net/npm/@marlowe.io/wallet@0.4.0-beta-rc1/dist/bundled/esm/browser.js", "@marlowe.io/wallet/lucid": diff --git a/packages/adapter/src/io-ts.ts b/packages/adapter/src/io-ts.ts index 5d1344bc..04399a5b 100644 --- a/packages/adapter/src/io-ts.ts +++ b/packages/adapter/src/io-ts.ts @@ -100,11 +100,7 @@ export function formatValidationErrors(errors: Errors): string { }).join("\n"); } -export function dynamicAssertType( - guard: G, - value: unknown, - message?: string -): t.TypeOf { +export function dynamicAssertType(guard: G, value: unknown, message?: string): t.TypeOf { const result = guard.decode(value); if (Either.isLeft(result)) { throw new InvalidTypeError(guard, value, result.left, message); @@ -123,9 +119,7 @@ export class InvalidTypeError extends Error { public readonly errors: Errors, message?: string ) { - const msg = - message ?? - `Unexpected type for value:\n${formatValidationErrors(errors)}`; + const msg = message ?? `Unexpected type for value:\n${formatValidationErrors(errors)}`; super(msg); } } diff --git a/packages/runtime/core/src/contract/accountDeposits.ts b/packages/runtime/core/src/contract/accountDeposits.ts index f539d6cf..fa5b37bb 100644 --- a/packages/runtime/core/src/contract/accountDeposits.ts +++ b/packages/runtime/core/src/contract/accountDeposits.ts @@ -6,6 +6,7 @@ export type AddressOrRole = string; export const AddressOrRoleGuard = t.string; /** * A map of tags to their content. The key is a string, the value can be anything. + * New feature from runtime v1.0.0 (initial account deposits)) */ export type AccountDeposits = { [key in AddressOrRole]: AssetsMap }; /** diff --git a/packages/runtime/lifecycle/src/browser/index.ts b/packages/runtime/lifecycle/src/browser/index.ts index 457abc68..5889e5c0 100644 --- a/packages/runtime/lifecycle/src/browser/index.ts +++ b/packages/runtime/lifecycle/src/browser/index.ts @@ -80,11 +80,7 @@ export async function mkRuntimeLifecycle( strict = true ): Promise { dynamicAssertType(BrowserRuntimeLifecycleOptionsGuard, options); - dynamicAssertType( - t.boolean, - strict, - "Invalid type for argument 'strict', expected boolean" - ); + dynamicAssertType(t.boolean, strict, "Invalid type for argument 'strict', expected boolean"); const { runtimeURL, walletName } = options; const wallet = await mkBrowserWallet(walletName); diff --git a/packages/runtime/lifecycle/src/index.ts b/packages/runtime/lifecycle/src/index.ts index 276741a8..5e765b65 100644 --- a/packages/runtime/lifecycle/src/index.ts +++ b/packages/runtime/lifecycle/src/index.ts @@ -42,12 +42,11 @@ export interface RuntimeLifecycleOptions { /** * @hidden */ -export const RuntimeLifecycleOptionsGuard: t.Type = - t.type({ - runtimeURL: t.string, - // TODO: Create a shallow guard for the wallet that checks that all methods are present as t.function. - wallet: t.any, - }); +export const RuntimeLifecycleOptionsGuard: t.Type = t.type({ + runtimeURL: t.string, + // TODO: Create a shallow guard for the wallet that checks that all methods are present as t.function. + wallet: t.any, +}); /** * Creates an instance of RuntimeLifecycle. @@ -55,16 +54,9 @@ export const RuntimeLifecycleOptionsGuard: t.Type = * @param strict Whether to perform runtime checking to provide helpful error messages. May have a slight negative performance impact. Default value is `true`. * @category RuntimeLifecycle */ -export function mkRuntimeLifecycle( - options: RuntimeLifecycleOptions, - strict = true -): RuntimeLifecycle { +export function mkRuntimeLifecycle(options: RuntimeLifecycleOptions, strict = true): RuntimeLifecycle { dynamicAssertType(RuntimeLifecycleOptionsGuard, options); - dynamicAssertType( - t.boolean, - strict, - "Invalid type for argument 'strict', expected boolean" - ); + dynamicAssertType(t.boolean, strict, "Invalid type for argument 'strict', expected boolean"); const { runtimeURL, wallet } = options; const deprecatedRestAPI = mkFPTSRestClient(runtimeURL); const restClient = mkRestClient(runtimeURL, strict); diff --git a/packages/runtime/lifecycle/src/nodejs/index.ts b/packages/runtime/lifecycle/src/nodejs/index.ts index 40c4fb23..cbc4a8cb 100644 --- a/packages/runtime/lifecycle/src/nodejs/index.ts +++ b/packages/runtime/lifecycle/src/nodejs/index.ts @@ -6,16 +6,8 @@ import { Lucid } from "lucid-cardano"; import * as t from "io-ts/lib/index.js"; import { dynamicAssertType } from "@marlowe.io/adapter/io-ts"; -export async function mkRuntimeLifecycle( - runtimeURL: string, - lucid: Lucid, - strict = true -): Promise { - dynamicAssertType( - t.boolean, - strict, - "Invalid type for argument 'strict', expected boolean" - ); +export async function mkRuntimeLifecycle(runtimeURL: string, lucid: Lucid, strict = true): Promise { + dynamicAssertType(t.boolean, strict, "Invalid type for argument 'strict', expected boolean"); const wallet = await Wallet.mkLucidWallet(lucid); const deprecatedRestAPI = mkFPTSRestClient(runtimeURL); const restClient = mkRestClient(runtimeURL, strict);