diff --git a/packages/runtime/client/rest/src/index.ts b/packages/runtime/client/rest/src/index.ts index 3e62ac79..ad3459e2 100644 --- a/packages/runtime/client/rest/src/index.ts +++ b/packages/runtime/client/rest/src/index.ts @@ -647,6 +647,11 @@ export interface ContractsAPI { */ export type RestDI = { restClient: RestClient }; +/** + * + * @description Dependency Injection for the Wallet API + * @hidden + */ export type DeprecatedRestDI = { deprecatedRestAPI: FPTSRestAPI }; /** diff --git a/packages/runtime/lifecycle/src/api.ts b/packages/runtime/lifecycle/src/api.ts index 93ad387a..88b810a0 100644 --- a/packages/runtime/lifecycle/src/api.ts +++ b/packages/runtime/lifecycle/src/api.ts @@ -31,9 +31,20 @@ import { ContractInstanceAPI, } from "./generic/new-contract-api.js"; import { + ApplyInputsRequest, ContractsAPI, + CreateContractRequest, CreateContractRequestBase, + CreateContractRequestFromBundle, + CreateContractRequestFromContract, } from "./generic/contracts.js"; +import { + ContractsAPI as NewContractsAPI, + ApplicableActionsAPI as NewApplicableActionsAPI, + ComputeApplicableActionsRequest, +} from "./generic/new-contract-api.js"; +import * as NewContract from "./generic/new-contract-api.js"; + export { ApplicableActionsAPI, ApplicableAction, @@ -50,8 +61,15 @@ export { ContractDetails, ContractInstanceAPI, CreateContractRequestBase, + ContractsAPI, + ApplyInputsRequest, + CreateContractRequest, + NewContractsAPI, + NewApplicableActionsAPI, + ComputeApplicableActionsRequest, + CreateContractRequestFromContract, + CreateContractRequestFromBundle, }; -import * as NewContract from "./generic/new-contract-api.js"; /** * This is the main entry point of the @marlowe.io/runtime-lifecycle package. It provides a set of APIs to @@ -70,9 +88,15 @@ export interface RuntimeLifecycle { * Access to the low-level REST API as defined in the {@link @marlowe.io/runtime-rest-client! } package. It is re-exported here for convenience. */ restClient: RestClient; + + /** + * The new contract API is a high level API that lets you create and interact with Marlowe contracts. + */ newContractAPI: NewContract.ContractsAPI; + /** * The contracts API is a high level API that lets you create and interact with Marlowe contracts. + * @deprecated Use {@link RuntimeLifecycle.newContractAPI} instead. */ contracts: ContractsAPI; payouts: PayoutsAPI; diff --git a/packages/runtime/lifecycle/src/generic/applicable-actions.ts b/packages/runtime/lifecycle/src/generic/applicable-actions.ts index eb60f13f..2766f21b 100644 --- a/packages/runtime/lifecycle/src/generic/applicable-actions.ts +++ b/packages/runtime/lifecycle/src/generic/applicable-actions.ts @@ -40,7 +40,7 @@ import { Tags, TxId, } from "@marlowe.io/runtime-core"; -import { RestClient, RestDI, Tip } from "@marlowe.io/runtime-rest-client"; +import { RestDI } from "@marlowe.io/runtime-rest-client"; import { WalletAPI, WalletDI } from "@marlowe.io/wallet"; import * as Big from "@marlowe.io/adapter/bigint"; import { ContractSourceId } from "@marlowe.io/marlowe-object"; diff --git a/packages/runtime/lifecycle/src/generic/contracts.ts b/packages/runtime/lifecycle/src/generic/contracts.ts index c4f55dcf..fe437486 100644 --- a/packages/runtime/lifecycle/src/generic/contracts.ts +++ b/packages/runtime/lifecycle/src/generic/contracts.ts @@ -1,5 +1,3 @@ -import * as TE from "fp-ts/lib/TaskEither.js"; -import { pipe } from "fp-ts/lib/function.js"; import { Option } from "fp-ts/lib/Option.js"; import { Contract, @@ -8,7 +6,7 @@ import { Party, RoleName, } from "@marlowe.io/language-core-v1"; -import { tryCatchDefault, unsafeTaskEither } from "@marlowe.io/adapter/fp-ts"; +import { unsafeTaskEither } from "@marlowe.io/adapter/fp-ts"; import { getAddressesAndCollaterals, @@ -20,8 +18,6 @@ import { ContractId, contractIdToTxId, TxId, - AddressesAndCollaterals, - HexTransactionWitnessSet, transactionWitnessSetTextEnvelope, BlockHeader, StakeAddressBech32, @@ -36,14 +32,12 @@ import { ItemRange, DeprecatedRestDI, } from "@marlowe.io/runtime-rest-client"; -import { DecodingError } from "@marlowe.io/adapter/codec"; import { Next, noNext } from "@marlowe.io/language-core-v1/next"; import { BuildCreateContractTxRequest, BuildCreateContractTxRequestOptions, RolesConfiguration, - TransactionTextEnvelope, } from "@marlowe.io/runtime-rest-client/contract"; import { SingleInputTx } from "@marlowe.io/language-core-v1/transaction.js"; import { ISO8601, iso8601ToPosixTime } from "@marlowe.io/adapter/time"; diff --git a/packages/runtime/lifecycle/src/generic/new-contract-api.ts b/packages/runtime/lifecycle/src/generic/new-contract-api.ts index d98ee9a0..a87eaf69 100644 --- a/packages/runtime/lifecycle/src/generic/new-contract-api.ts +++ b/packages/runtime/lifecycle/src/generic/new-contract-api.ts @@ -140,7 +140,7 @@ function mkApplicableActionsAPI( * TODO comment * @category New ContractsAPI */ -type ComputeApplicableActionsRequest = { +export type ComputeApplicableActionsRequest = { environment?: Environment; contractDetails?: ContractDetails; };