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 9abbdad commit 4844746
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export async function getApplicableActions(
contractId: ContractId,
environment?: Environment
): Promise<ApplicableAction[]> {
const contractDetails = await restClient.getContractById(contractId);
const contractDetails = await restClient.getContractById({ contractId });
const currentContract = contractDetails.currentContract
? contractDetails.currentContract
: contractDetails.initialContract;
Expand Down
10 changes: 6 additions & 4 deletions examples/nodejs/src/marlowe-object-flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -588,8 +588,9 @@ async function validateExistingContract(
contractId: ContractId
): Promise<ValidationResults> {
// First we try to fetch the contract details and the required tags
const contractDetails =
await lifecycle.restClient.getContractById(contractId);
const contractDetails = await lifecycle.restClient.getContractById({
contractId,
});

const scheme = extractSchemeFromTags(contractDetails.tags);

Expand All @@ -609,8 +610,9 @@ async function validateExistingContract(
// Or this option which doesn't require runtime to runtime communication, and just requires
// the dapp to be able to recreate the same sources.
const contractBundle = mkDelayPayment(scheme);
const { contractSourceId } =
await lifecycle.restClient.createContractSources(contractBundle);
const { contractSourceId } = await lifecycle.restClient.createContractSources(
{ bundle: contractBundle }
);
const initialContract = await lifecycle.restClient.getContractSourceById({
contractSourceId,
});
Expand Down
10 changes: 6 additions & 4 deletions examples/survey-workshop/custodian/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ async function loadContract() {
log("Loading contract");
const contractId = document.getElementById("contract-id").value;
const restClient = await H.getRestClient();
const paginatedTxs = await restClient.getTransactionsForContract(contractId);
const paginatedTxs = await restClient.getTransactionsForContract({
contractId,
});
if (paginatedTxs.transactions.length !== 1) {
log(
"Expected 1 transaction for contract, got " +
Expand All @@ -33,10 +35,10 @@ async function loadContract() {
}
logJSON("txId", paginatedTxs.transactions[0].transactionId);
const txId = paginatedTxs.transactions[0].transactionId;
const answerTx = await restClient.getContractTransactionById(
const answerTx = await restClient.getContractTransactionById({
contractId,
txId
);
txId,
});

const answers = await getAnswers(answerTx);
logJSON("answers", answers);
Expand Down
10 changes: 5 additions & 5 deletions examples/vesting-flow/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -140,21 +140,21 @@ <h2>Console</h2>
const contractIdsAndDetails = await Promise.all(
contractIds.map((contractId) =>
restClient
.getContractById(contractId)
.getContractById({ contractId })
.then((details) => [contractId, details])
)
);
const contractIdsAndDetailsAndInputHistory = await Promise.all(
contractIdsAndDetails.map(([contractId, details]) =>
restClient
.getTransactionsForContract(contractId)
.getTransactionsForContract({ contractId })
.then((result) =>
Promise.all(
result.transactions.map((transaction) =>
restClient.getContractTransactionById(
restClient.getContractTransactionById({
contractId,
transaction.transactionId
)
txId: transaction.transactionId,
})
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ const shouldBeAClosedContract = async (
contractId: ContractId
): Promise<void> => {
const state = await restClient
.getContractById(contractId)
.getContractById({ contractId })
.then((contractDetails) => contractDetails.state);
if (state) {
throw new Error("Contract retrieved is not Closed");
Expand All @@ -268,5 +268,5 @@ const getMarloweStatefromAnActiveContract = (
contractId: ContractId
): Promise<MarloweState> =>
restClient
.getContractById(contractId)
.getContractById({ contractId })
.then((contractDetails) => shouldBeAnActiveContract(contractDetails.state));

0 comments on commit 4844746

Please sign in to comment.