Skip to content

Commit

Permalink
lets go
Browse files Browse the repository at this point in the history
  • Loading branch information
bjornkihlberg committed Jan 25, 2024
1 parent 8ce3a0a commit 08ff777
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
13 changes: 12 additions & 1 deletion packages/runtime/client/rest/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ export function mkRestClient(
if (result._tag === "Left") {
throw new InvalidArgumentError(
result.left,
`Invalid argument to getContractTransactionById(${request})`
`Invalid argument to withdrawPayouts(${request})`
);
} else {
const test: typeof request = result.right;
Expand All @@ -596,6 +596,17 @@ export function mkRestClient(
return { ...response, block: O.toUndefined(block) };
},
getWithdrawals(request) {
if (strict) {
const result = Withdrawals.GetWithdrawalsRequestGuard.decode(request);
if (result._tag === "Left") {
throw new InvalidArgumentError(
result.left,
`Invalid argument to getWithdrawals(${request})`
);
} else {
const test: typeof request = result.right;
}
}
return unsafeTaskEither(
Withdrawals.getHeadersByRangeViaAxios(axiosInstance)(request)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,22 @@ import {

import { WithdrawalHeader } from "../header.js";
import { stringify } from "qs";
import { ItemRange, PageGuard } from "../../pagination.js";
import { ItemRange, ItemRangeGuard, PageGuard } from "../../pagination.js";
import { assertGuardEqual, proxy } from "@marlowe.io/adapter/io-ts";

export type GetWithdrawalsRequest = {
range?: ItemRange;
partyRoles?: AssetId[];
};

export const GetWithdrawalsRequestGuard = assertGuardEqual(
proxy<GetWithdrawalsRequest>(),
t.partial({
range: ItemRangeGuard,
partyRoles: t.array(AssetId),
})
);

export type GETHeadersByRange = (
request?: GetWithdrawalsRequest
) => TE.TaskEither<Error | DecodingError, GetWithdrawalsResponse>;
Expand Down

0 comments on commit 08ff777

Please sign in to comment.