Skip to content

Commit

Permalink
Renamed deprecatedContractsAPI back to its original name
Browse files Browse the repository at this point in the history
  • Loading branch information
hrajchert authored and nhenin committed Apr 18, 2024
1 parent 134be9c commit f177b82
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 24 deletions.
15 changes: 6 additions & 9 deletions examples/nodejs/src/escrow-flow.ts
Expand Up @@ -88,17 +88,14 @@ async function main(action: "buy" | "sell", otherAddress: string, amount: number
console.log("Mediator: " + Mediator);
console.log("Amount: " + amount);

const [contractId, txId] = await runtime.deprecatedContractAPI.createContract(
{
contract: escrow,
roles: { Buyer, Seller, Mediator },
}
);
const contractInstance = await runtime.newContractAPI.createContract({
contract: escrow,
roles: { Buyer, Seller, Mediator },
});

console.log("Contract ID: " + contractId);
console.log("Transaction ID: " + txId);
console.log("Contract ID: " + contractInstance.contractId);

console.log("Waiting for confirmation...");
await wallet.waitConfirmation(txId);
await contractInstance.waitForConfirmation();
console.log("Contract created successfully!");
}
4 changes: 2 additions & 2 deletions packages/runtime/lifecycle/src/api.ts
Expand Up @@ -33,7 +33,7 @@ import {
import {
ContractsAPI,
CreateContractRequestBase,
} from "./generic/deprecated-contracts.js";
} from "./generic/contracts.js";
export {
ApplicableActionsAPI,
ApplicableAction,
Expand Down Expand Up @@ -74,7 +74,7 @@ export interface RuntimeLifecycle {
/**
* The contracts API is a high level API that lets you create and interact with Marlowe contracts.
*/
deprecatedContractAPI: ContractsAPI;
contracts: ContractsAPI;
payouts: PayoutsAPI;
applicableActions: ApplicableActionsAPI;
}
Expand Down
6 changes: 1 addition & 5 deletions packages/runtime/lifecycle/src/generic/applicable-actions.ts
@@ -1,8 +1,4 @@
import {
ApplyInputsRequest,
ContractsAPI,
applyInputs,
} from "./deprecated-contracts.js";
import { ApplyInputsRequest, ContractsAPI, applyInputs } from "./contracts.js";

import { Monoid } from "fp-ts/lib/Monoid.js";
import * as R from "fp-ts/lib/Record.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime/lifecycle/src/generic/new-contract-api.ts
Expand Up @@ -10,7 +10,7 @@ import {
createContract,
applyInputs,
getInputHistory,
} from "./deprecated-contracts.js";
} from "./contracts.js";
import {
SingleInputTx,
TransactionSuccess,
Expand Down
10 changes: 3 additions & 7 deletions packages/runtime/lifecycle/src/generic/runtime.ts
Expand Up @@ -4,7 +4,7 @@ import { WalletAPI } from "@marlowe.io/wallet/api";
import { FPTSRestAPI, RestClient } from "@marlowe.io/runtime-rest-client";

import { mkPayoutLifecycle } from "./payouts.js";
import { mkContractLifecycle } from "./deprecated-contracts.js";
import { mkContractLifecycle } from "./contracts.js";
import { mkApplicableActionsAPI } from "./applicable-actions.js";
import * as NewContract from "./new-contract-api.js";

Expand All @@ -13,15 +13,11 @@ export function mkRuntimeLifecycle(
restClient: RestClient,
wallet: WalletAPI
): RuntimeLifecycle {
const deprecatedContractAPI = mkContractLifecycle(
wallet,
deprecatedRestAPI,
restClient
);
const contracts = mkContractLifecycle(wallet, deprecatedRestAPI, restClient);
return {
wallet: wallet,
restClient,
deprecatedContractAPI,
contracts,
newContractAPI: NewContract.mkContractsAPI({ wallet, restClient }),
payouts: mkPayoutLifecycle(wallet, deprecatedRestAPI, restClient),
applicableActions: mkApplicableActionsAPI({ restClient, wallet }),
Expand Down

0 comments on commit f177b82

Please sign in to comment.