From 9abbdad99188aa60997ea3b44e636b11011f34c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Kihlberg?= Date: Fri, 26 Jan 2024 16:10:30 +0100 Subject: [PATCH] lets go --- .../client/rest/src/contract/endpoints/singleton.ts | 4 ++++ .../client/rest/src/contract/endpoints/sources.ts | 4 ++++ packages/runtime/client/rest/src/contract/index.ts | 11 +++++++++++ .../src/contract/transaction/endpoints/collection.ts | 4 ++++ .../src/contract/transaction/endpoints/singleton.ts | 8 ++++++++ packages/runtime/client/rest/src/index.ts | 2 -- .../client/rest/src/withdrawal/endpoints/singleton.ts | 8 ++++++++ 7 files changed, 39 insertions(+), 2 deletions(-) diff --git a/packages/runtime/client/rest/src/contract/endpoints/singleton.ts b/packages/runtime/client/rest/src/contract/endpoints/singleton.ts index b5f4046d..782e8bc5 100644 --- a/packages/runtime/client/rest/src/contract/endpoints/singleton.ts +++ b/packages/runtime/client/rest/src/contract/endpoints/singleton.ts @@ -67,6 +67,10 @@ export type PUT = ( hexTransactionWitnessSet: HexTransactionWitnessSet ) => TE.TaskEither; +/** + * Request options for the {@link index.RestClient#submitContract | Submit contract } endpoint + * @category Endpoint : Submit contract + */ export interface SubmitContractRequest { contractId: ContractId; txEnvelope: TextEnvelope; diff --git a/packages/runtime/client/rest/src/contract/endpoints/sources.ts b/packages/runtime/client/rest/src/contract/endpoints/sources.ts index 6b53e120..4bce4d65 100644 --- a/packages/runtime/client/rest/src/contract/endpoints/sources.ts +++ b/packages/runtime/client/rest/src/contract/endpoints/sources.ts @@ -16,6 +16,10 @@ import { AxiosInstance } from "axios"; import { ContractBundleGuard } from "@marlowe.io/marlowe-object/object"; import { assertGuardEqual, proxy } from "@marlowe.io/adapter/io-ts"; +/** + * Request options for the {@link index.RestClient#createContractSources | Create contract sources } endpoint + * @category Endpoint : Create contract sources + */ export interface CreateContractSourcesRequest { bundle: ContractBundle; } diff --git a/packages/runtime/client/rest/src/contract/index.ts b/packages/runtime/client/rest/src/contract/index.ts index 59c6b0e1..fb248c45 100644 --- a/packages/runtime/client/rest/src/contract/index.ts +++ b/packages/runtime/client/rest/src/contract/index.ts @@ -31,6 +31,7 @@ export { RoleTokenConfigurations, RolesConfiguration, } from "./rolesConfigurations.js"; + export { GetContractsResponse, GetContractsRequest, @@ -41,13 +42,23 @@ export { BuildCreateContractTxRequestOptions, BuildCreateContractTxResponse, } from "./endpoints/collection.js"; + +export { SubmitContractRequest } from "./endpoints/singleton.js"; export { TxHeader } from "./transaction/header.js"; +export { + GetContractTransactionByIdRequest, + SubmitContractTransactionRequest, +} from "./transaction/endpoints/singleton.js"; + export { GetTransactionsForContractResponse, ApplyInputsToContractRequest, + GetTransactionsForContractRequest, } from "./transaction/endpoints/collection.js"; + export { + CreateContractSourcesRequest, CreateContractSourcesResponse, GetContractSourceAdjacencyResponse, GetContractSourceClosureResponse, diff --git a/packages/runtime/client/rest/src/contract/transaction/endpoints/collection.ts b/packages/runtime/client/rest/src/contract/transaction/endpoints/collection.ts index 53bfb351..9b59243e 100644 --- a/packages/runtime/client/rest/src/contract/transaction/endpoints/collection.ts +++ b/packages/runtime/client/rest/src/contract/transaction/endpoints/collection.ts @@ -81,6 +81,10 @@ const GetContractsRawResponse = t.type({ page: PageGuard, }); +/** + * Request options for the {@link index.RestClient#getTransactionsForContract | Get transactions for contract } endpoint + * @category Endpoint : Get transactions for contract + */ export interface GetTransactionsForContractRequest { contractId: ContractId; range?: ItemRange; diff --git a/packages/runtime/client/rest/src/contract/transaction/endpoints/singleton.ts b/packages/runtime/client/rest/src/contract/transaction/endpoints/singleton.ts index f68b1615..7f3e6b45 100644 --- a/packages/runtime/client/rest/src/contract/transaction/endpoints/singleton.ts +++ b/packages/runtime/client/rest/src/contract/transaction/endpoints/singleton.ts @@ -32,6 +32,10 @@ const GETPayload = t.type({ resource: TransactionDetailsGuard, }); +/** + * Request options for the {@link index.RestClient#getContractTransactionById | Get contract transaction by ID } endpoint + * @category Endpoint : Get contract transaction by ID + */ export interface GetContractTransactionByIdRequest { contractId: ContractId; txId: TxId; @@ -62,6 +66,10 @@ export const getViaAxios: (axiosInstance: AxiosInstance) => GET = TE.map((payload) => payload.resource) ); +/** + * Request options for the {@link index.RestClient#submitContractTransaction | Submit contract transaction } endpoint + * @category Endpoint : Submit contract transaction + */ export interface SubmitContractTransactionRequest { contractId: ContractId; transactionId: TxId; diff --git a/packages/runtime/client/rest/src/index.ts b/packages/runtime/client/rest/src/index.ts index 9da2a798..c71345ee 100644 --- a/packages/runtime/client/rest/src/index.ts +++ b/packages/runtime/client/rest/src/index.ts @@ -223,7 +223,6 @@ export interface RestClient { ): Promise; // createWithdrawal: Withdrawals.POST; // - https://docs.marlowe.iohk.io/api/create-withdrawals - // getWithdrawalById: Withdrawal.GET; // - https://docs.marlowe.iohk.io/api/get-withdrawal-by-id /** * Get published withdrawal transaction by ID. * @see {@link https://docs.marlowe.iohk.io/api/get-withdrawal-by-id | The backend documentation} @@ -231,7 +230,6 @@ export interface RestClient { getWithdrawalById( request: Withdrawal.GetWithdrawalByIdRequest ): Promise; - // submitWithdrawal: Withdrawal.PUT; - is it this one? https://docs.marlowe.iohk.io/api/create-withdrawal? or the one for createWithdrawal? /** * Submit a signed transaction (generated with {@link @marlowe.io/runtime-rest-client!index.RestClient#withdrawPayouts} and signed with the {@link @marlowe.io/wallet!api.WalletAPI#signTx} procedure) that withdraws available payouts from a contract. * @see {@link https://docs.marlowe.iohk.io/api/submit-payout-withdrawal | The backend documentation} diff --git a/packages/runtime/client/rest/src/withdrawal/endpoints/singleton.ts b/packages/runtime/client/rest/src/withdrawal/endpoints/singleton.ts index 01d1b8a8..b79dd9be 100644 --- a/packages/runtime/client/rest/src/withdrawal/endpoints/singleton.ts +++ b/packages/runtime/client/rest/src/withdrawal/endpoints/singleton.ts @@ -27,6 +27,10 @@ export type GET = ( withdrawalId: WithdrawalId ) => TE.TaskEither; +/** + * Request options for the {@link index.RestClient#getWithdrawalById | Get withdrawal by ID } endpoint + * @category Endpoint : Get withdrawal by ID + */ export interface GetWithdrawalByIdRequest { withdrawalId: WithdrawalId; } @@ -36,6 +40,10 @@ export const GetWithdrawalByIdRequestGuard = assertGuardEqual( t.type({ withdrawalId: WithdrawalId }) ); +/** + * Request options for the {@link index.RestClient#submitWithdrawal | Submit withdrawal } endpoint + * @category Endpoint : Submit withdrawal + */ export interface SubmitWithdrawalRequest { withdrawalId: WithdrawalId; hexTransactionWitnessSet: HexTransactionWitnessSet;