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 7e6517b commit 9abbdad
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ export type PUT = (
hexTransactionWitnessSet: HexTransactionWitnessSet
) => TE.TaskEither<Error, void>;

/**
* Request options for the {@link index.RestClient#submitContract | Submit contract } endpoint
* @category Endpoint : Submit contract
*/
export interface SubmitContractRequest {
contractId: ContractId;
txEnvelope: TextEnvelope;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
11 changes: 11 additions & 0 deletions packages/runtime/client/rest/src/contract/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export {
RoleTokenConfigurations,
RolesConfiguration,
} from "./rolesConfigurations.js";

export {
GetContractsResponse,
GetContractsRequest,
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions packages/runtime/client/rest/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,15 +223,13 @@ export interface RestClient {
): Promise<Withdrawals.GetWithdrawalsResponse>;

// 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}
*/
getWithdrawalById(
request: Withdrawal.GetWithdrawalByIdRequest
): Promise<Withdrawal.GetWithdrawalByIdResponse>;
// 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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ export type GET = (
withdrawalId: WithdrawalId
) => TE.TaskEither<Error | DecodingError, WithdrawalDetails>;

/**
* Request options for the {@link index.RestClient#getWithdrawalById | Get withdrawal by ID } endpoint
* @category Endpoint : Get withdrawal by ID
*/
export interface GetWithdrawalByIdRequest {
withdrawalId: WithdrawalId;
}
Expand All @@ -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;
Expand Down

0 comments on commit 9abbdad

Please sign in to comment.