@polygonlabs/staker-pool-allocations-client 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MIGRATION.md +5 -0
- package/dist/generated/@tanstack/react-query.gen.d.ts +796 -0
- package/dist/generated/@tanstack/react-query.gen.d.ts.map +1 -0
- package/dist/generated/@tanstack/react-query.gen.js +283 -0
- package/dist/generated/@tanstack/react-query.gen.js.map +1 -0
- package/dist/generated/client/client.gen.d.ts +3 -0
- package/dist/generated/client/client.gen.d.ts.map +1 -0
- package/dist/generated/client/client.gen.js +236 -0
- package/dist/generated/client/client.gen.js.map +1 -0
- package/dist/generated/client/index.d.ts +9 -0
- package/dist/generated/client/index.d.ts.map +1 -0
- package/dist/generated/client/index.js +7 -0
- package/dist/generated/client/index.js.map +1 -0
- package/dist/generated/client/types.gen.d.ts +118 -0
- package/dist/generated/client/types.gen.d.ts.map +1 -0
- package/dist/generated/client/types.gen.js +3 -0
- package/dist/generated/client/types.gen.js.map +1 -0
- package/dist/generated/client/utils.gen.d.ts +34 -0
- package/dist/generated/client/utils.gen.d.ts.map +1 -0
- package/dist/generated/client/utils.gen.js +229 -0
- package/dist/generated/client/utils.gen.js.map +1 -0
- package/dist/generated/client.gen.d.ts +13 -0
- package/dist/generated/client.gen.d.ts.map +1 -0
- package/dist/generated/client.gen.js +4 -0
- package/dist/generated/client.gen.js.map +1 -0
- package/dist/generated/core/auth.gen.d.ts +19 -0
- package/dist/generated/core/auth.gen.d.ts.map +1 -0
- package/dist/generated/core/auth.gen.js +15 -0
- package/dist/generated/core/auth.gen.js.map +1 -0
- package/dist/generated/core/bodySerializer.gen.d.ts +26 -0
- package/dist/generated/core/bodySerializer.gen.d.ts.map +1 -0
- package/dist/generated/core/bodySerializer.gen.js +58 -0
- package/dist/generated/core/bodySerializer.gen.js.map +1 -0
- package/dist/generated/core/params.gen.d.ts +44 -0
- package/dist/generated/core/params.gen.d.ts.map +1 -0
- package/dist/generated/core/params.gen.js +101 -0
- package/dist/generated/core/params.gen.js.map +1 -0
- package/dist/generated/core/pathSerializer.gen.d.ts +34 -0
- package/dist/generated/core/pathSerializer.gen.d.ts.map +1 -0
- package/dist/generated/core/pathSerializer.gen.js +107 -0
- package/dist/generated/core/pathSerializer.gen.js.map +1 -0
- package/dist/generated/core/queryKeySerializer.gen.d.ts +19 -0
- package/dist/generated/core/queryKeySerializer.gen.d.ts.map +1 -0
- package/dist/generated/core/queryKeySerializer.gen.js +93 -0
- package/dist/generated/core/queryKeySerializer.gen.js.map +1 -0
- package/dist/generated/core/serverSentEvents.gen.d.ts +72 -0
- package/dist/generated/core/serverSentEvents.gen.d.ts.map +1 -0
- package/dist/generated/core/serverSentEvents.gen.js +134 -0
- package/dist/generated/core/serverSentEvents.gen.js.map +1 -0
- package/dist/generated/core/types.gen.d.ts +79 -0
- package/dist/generated/core/types.gen.d.ts.map +1 -0
- package/dist/generated/core/types.gen.js +3 -0
- package/dist/generated/core/types.gen.js.map +1 -0
- package/dist/generated/core/utils.gen.d.ts +20 -0
- package/dist/generated/core/utils.gen.d.ts.map +1 -0
- package/dist/generated/core/utils.gen.js +88 -0
- package/dist/generated/core/utils.gen.js.map +1 -0
- package/dist/generated/index.d.ts +4 -0
- package/dist/generated/index.d.ts.map +1 -0
- package/dist/generated/index.js +5 -0
- package/dist/generated/index.js.map +1 -0
- package/dist/generated/registry-validator.gen.d.ts +168 -0
- package/dist/generated/registry-validator.gen.d.ts.map +1 -0
- package/dist/generated/registry-validator.gen.js +402 -0
- package/dist/generated/registry-validator.gen.js.map +1 -0
- package/dist/generated/sdk.gen.d.ts +71 -0
- package/dist/generated/sdk.gen.d.ts.map +1 -0
- package/dist/generated/sdk.gen.js +98 -0
- package/dist/generated/sdk.gen.js.map +1 -0
- package/dist/generated/types.gen.d.ts +435 -0
- package/dist/generated/types.gen.d.ts.map +1 -0
- package/dist/generated/types.gen.js +3 -0
- package/dist/generated/types.gen.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/dist/react.d.ts +2 -0
- package/dist/react.d.ts.map +1 -0
- package/dist/react.js +18 -0
- package/dist/react.js.map +1 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -0
- package/package.json +68 -0
- package/src/generated/@tanstack/react-query.gen.ts +322 -0
- package/src/generated/client/client.gen.ts +298 -0
- package/src/generated/client/index.ts +25 -0
- package/src/generated/client/types.gen.ts +214 -0
- package/src/generated/client/utils.gen.ts +316 -0
- package/src/generated/client.gen.ts +16 -0
- package/src/generated/core/auth.gen.ts +41 -0
- package/src/generated/core/bodySerializer.gen.ts +82 -0
- package/src/generated/core/params.gen.ts +169 -0
- package/src/generated/core/pathSerializer.gen.ts +171 -0
- package/src/generated/core/queryKeySerializer.gen.ts +117 -0
- package/src/generated/core/serverSentEvents.gen.ts +243 -0
- package/src/generated/core/types.gen.ts +104 -0
- package/src/generated/core/utils.gen.ts +140 -0
- package/src/generated/index.ts +5 -0
- package/src/generated/registry-validator.gen.ts +607 -0
- package/src/generated/sdk.gen.ts +124 -0
- package/src/generated/types.gen.ts +503 -0
- package/src/index.ts +68 -0
- package/src/react.ts +42 -0
|
@@ -0,0 +1,607 @@
|
|
|
1
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
+
|
|
3
|
+
import { AllocationHistoryResponse, AllocationListResponse, AllocationRow, DistributionDetail, DistributionListResponse, ErrorResponse, ExcludedAllocationsResponse, OperationalStatus, ProofResponse, UnclaimedProofsResponse, ValidationErrorResponse } from '@polygonlabs/staker-pool-allocations-schemas/codegen';
|
|
4
|
+
import { z, type ZodError } from 'zod';
|
|
5
|
+
|
|
6
|
+
import { getAddressAllocationHistory as getAddressAllocationHistory2, getAllocation as getAllocation2, getDistribution as getDistribution2, getHealthCheck as getHealthCheck2, getProof as getProof2, getReadiness as getReadiness2, getUnclaimedProofs as getUnclaimedProofs2, listAllocations as listAllocations2, listDistributions as listDistributions2, listExcludedAllocations as listExcludedAllocations2, type Options } from './sdk.gen.js';
|
|
7
|
+
import type { GetAddressAllocationHistoryData, GetAllocationData, GetDistributionData, GetHealthCheckData, GetProofData, GetReadinessData, GetUnclaimedProofsData, ListAllocationsData, ListDistributionsData, ListExcludedAllocationsData } from './types.gen.js';
|
|
8
|
+
|
|
9
|
+
export type GetHealthCheckResponses = {
|
|
10
|
+
200: z.output<typeof OperationalStatus>;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type GetHealthCheckResponse = GetHealthCheckResponses[keyof GetHealthCheckResponses];
|
|
14
|
+
|
|
15
|
+
export type GetHealthCheckErrors = {
|
|
16
|
+
500: z.output<typeof ErrorResponse>;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type GetHealthCheckError = GetHealthCheckErrors[keyof GetHealthCheckErrors];
|
|
20
|
+
|
|
21
|
+
export const getHealthCheckTransformer = async (data: unknown): Promise<z.output<typeof OperationalStatus>> => await OperationalStatus.parseAsync(data);
|
|
22
|
+
|
|
23
|
+
export const getHealthCheckErrorTransformer = async (data: unknown): Promise<z.output<typeof ErrorResponse>> => await ErrorResponse.parseAsync(data);
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @internal — emitted by `@polygonlabs/zod-to-openapi-heyapi`. Do not
|
|
27
|
+
* instantiate from consumer code; the wrapper constructs these in
|
|
28
|
+
* response to fetch transport rejections (DNS / abort / `ECONNRESET`).
|
|
29
|
+
* Narrow via the emitted `isTransportError` type-predicate guard.
|
|
30
|
+
*/
|
|
31
|
+
export class TransportError extends Error {
|
|
32
|
+
readonly cause: Error;
|
|
33
|
+
constructor(cause: Error) {
|
|
34
|
+
super('Request failed before producing an HTTP response');
|
|
35
|
+
(this as Record<symbol, unknown>)[Symbol.for("@polygonlabs/zod-to-openapi-heyapi/is-transport-error")] = true;
|
|
36
|
+
this.cause = cause;
|
|
37
|
+
this.name = 'TransportError';
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @internal — emitted by `@polygonlabs/zod-to-openapi-heyapi`. Do not
|
|
43
|
+
* instantiate from consumer code; the wrapper constructs these when
|
|
44
|
+
* `parseAsync` rejects an HTTP error body that did not match any
|
|
45
|
+
* registered error schema. `cause` carries the `ZodError` issues;
|
|
46
|
+
* `body` is the original wire body for debugging schema drift.
|
|
47
|
+
* Narrow via the emitted `isResponseValidationError` type-predicate guard.
|
|
48
|
+
*/
|
|
49
|
+
export class ResponseValidationError extends Error {
|
|
50
|
+
readonly cause: ZodError;
|
|
51
|
+
readonly body: unknown;
|
|
52
|
+
constructor(cause: ZodError, body: unknown) {
|
|
53
|
+
super('API response did not match the registered schema');
|
|
54
|
+
(this as Record<symbol, unknown>)[Symbol.for("@polygonlabs/zod-to-openapi-heyapi/is-response-validation-error")] = true;
|
|
55
|
+
this.cause = cause;
|
|
56
|
+
this.name = 'ResponseValidationError';
|
|
57
|
+
this.body = body;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export const isTransportError = (value: unknown): value is TransportError => typeof value === "object" && value !== null && (value as Record<symbol, unknown>)[Symbol.for("@polygonlabs/zod-to-openapi-heyapi/is-transport-error")] === true;
|
|
62
|
+
|
|
63
|
+
export const isResponseValidationError = (value: unknown): value is ResponseValidationError => typeof value === "object" && value !== null && (value as Record<symbol, unknown>)[Symbol.for("@polygonlabs/zod-to-openapi-heyapi/is-response-validation-error")] === true;
|
|
64
|
+
|
|
65
|
+
export const isWrapperError = (value: unknown): value is TransportError | ResponseValidationError => typeof value === "object" && value !== null && ((value as Record<symbol, unknown>)[Symbol.for("@polygonlabs/zod-to-openapi-heyapi/is-transport-error")] === true || (value as Record<symbol, unknown>)[Symbol.for("@polygonlabs/zod-to-openapi-heyapi/is-response-validation-error")] === true);
|
|
66
|
+
|
|
67
|
+
export type WrapErrors<TData, TError, ThrowOnError extends boolean, TResponseStyle extends "fields" | "data" = 'fields'> = Promise<ThrowOnError extends true ? TResponseStyle extends "data" ? TData extends Record<string, unknown> ? TData[keyof TData] : TData : {
|
|
68
|
+
data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
|
|
69
|
+
request: Request;
|
|
70
|
+
response: Response;
|
|
71
|
+
} : TResponseStyle extends "data" ? (TData extends Record<string, unknown> ? TData[keyof TData] : TData) | undefined : ({
|
|
72
|
+
data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
|
|
73
|
+
error: undefined;
|
|
74
|
+
} | {
|
|
75
|
+
data: undefined;
|
|
76
|
+
error: (TError extends Record<string, unknown> ? TError[keyof TError] : TError) | TransportError | ResponseValidationError;
|
|
77
|
+
}) & {
|
|
78
|
+
request: Request;
|
|
79
|
+
response: Response;
|
|
80
|
+
}>;
|
|
81
|
+
|
|
82
|
+
export const getHealthCheck = async <ThrowOnError extends boolean = false, TResponseStyle extends 'fields' | 'data' = 'fields'>(options?: Options<GetHealthCheckData, ThrowOnError>): WrapErrors<GetHealthCheckResponses, GetHealthCheckErrors, ThrowOnError, TResponseStyle> => {
|
|
83
|
+
let result;
|
|
84
|
+
try {
|
|
85
|
+
result = await getHealthCheck2(options);
|
|
86
|
+
}
|
|
87
|
+
catch (err) {
|
|
88
|
+
if (err instanceof Error) {
|
|
89
|
+
throw new TransportError(err as Error);
|
|
90
|
+
}
|
|
91
|
+
let typedErr;
|
|
92
|
+
try {
|
|
93
|
+
typedErr = await getHealthCheckErrorTransformer(err);
|
|
94
|
+
}
|
|
95
|
+
catch (validationError) {
|
|
96
|
+
throw new ResponseValidationError(validationError as ZodError, err);
|
|
97
|
+
}
|
|
98
|
+
throw typedErr;
|
|
99
|
+
}
|
|
100
|
+
const errorBearing = result as {
|
|
101
|
+
error?: unknown;
|
|
102
|
+
};
|
|
103
|
+
if (typeof result === "object" && result !== null && "request" in result && "response" in result && (typeof errorBearing.error === "object" && errorBearing.error !== null)) {
|
|
104
|
+
if (errorBearing.error instanceof Error) {
|
|
105
|
+
errorBearing.error = new TransportError(errorBearing.error as Error);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
try {
|
|
109
|
+
errorBearing.error = await getHealthCheckErrorTransformer(errorBearing.error);
|
|
110
|
+
}
|
|
111
|
+
catch (validationError) {
|
|
112
|
+
errorBearing.error = new ResponseValidationError(validationError as ZodError, errorBearing.error);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return result as unknown as Awaited<WrapErrors<GetHealthCheckResponses, GetHealthCheckErrors, ThrowOnError, TResponseStyle>>;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export type GetReadinessResponses = {
|
|
120
|
+
200: z.output<typeof OperationalStatus>;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export type GetReadinessResponse = GetReadinessResponses[keyof GetReadinessResponses];
|
|
124
|
+
|
|
125
|
+
export type GetReadinessErrors = {
|
|
126
|
+
500: z.output<typeof ErrorResponse>;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export type GetReadinessError = GetReadinessErrors[keyof GetReadinessErrors];
|
|
130
|
+
|
|
131
|
+
export const getReadinessTransformer = async (data: unknown): Promise<z.output<typeof OperationalStatus>> => await OperationalStatus.parseAsync(data);
|
|
132
|
+
|
|
133
|
+
export const getReadinessErrorTransformer = async (data: unknown): Promise<z.output<typeof ErrorResponse>> => await ErrorResponse.parseAsync(data);
|
|
134
|
+
|
|
135
|
+
export const getReadiness = async <ThrowOnError extends boolean = false, TResponseStyle extends 'fields' | 'data' = 'fields'>(options?: Options<GetReadinessData, ThrowOnError>): WrapErrors<GetReadinessResponses, GetReadinessErrors, ThrowOnError, TResponseStyle> => {
|
|
136
|
+
let result;
|
|
137
|
+
try {
|
|
138
|
+
result = await getReadiness2(options);
|
|
139
|
+
}
|
|
140
|
+
catch (err) {
|
|
141
|
+
if (err instanceof Error) {
|
|
142
|
+
throw new TransportError(err as Error);
|
|
143
|
+
}
|
|
144
|
+
let typedErr;
|
|
145
|
+
try {
|
|
146
|
+
typedErr = await getReadinessErrorTransformer(err);
|
|
147
|
+
}
|
|
148
|
+
catch (validationError) {
|
|
149
|
+
throw new ResponseValidationError(validationError as ZodError, err);
|
|
150
|
+
}
|
|
151
|
+
throw typedErr;
|
|
152
|
+
}
|
|
153
|
+
const errorBearing = result as {
|
|
154
|
+
error?: unknown;
|
|
155
|
+
};
|
|
156
|
+
if (typeof result === "object" && result !== null && "request" in result && "response" in result && (typeof errorBearing.error === "object" && errorBearing.error !== null)) {
|
|
157
|
+
if (errorBearing.error instanceof Error) {
|
|
158
|
+
errorBearing.error = new TransportError(errorBearing.error as Error);
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
try {
|
|
162
|
+
errorBearing.error = await getReadinessErrorTransformer(errorBearing.error);
|
|
163
|
+
}
|
|
164
|
+
catch (validationError) {
|
|
165
|
+
errorBearing.error = new ResponseValidationError(validationError as ZodError, errorBearing.error);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return result as unknown as Awaited<WrapErrors<GetReadinessResponses, GetReadinessErrors, ThrowOnError, TResponseStyle>>;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
export type ListDistributionsResponses = {
|
|
173
|
+
200: z.output<typeof DistributionListResponse>;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
export type ListDistributionsResponse = ListDistributionsResponses[keyof ListDistributionsResponses];
|
|
177
|
+
|
|
178
|
+
export type ListDistributionsErrors = {
|
|
179
|
+
400: z.output<typeof ErrorResponse>;
|
|
180
|
+
500: z.output<typeof ErrorResponse>;
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
export type ListDistributionsError = ListDistributionsErrors[keyof ListDistributionsErrors];
|
|
184
|
+
|
|
185
|
+
export const listDistributionsTransformer = async (data: unknown): Promise<z.output<typeof DistributionListResponse>> => await DistributionListResponse.parseAsync(data);
|
|
186
|
+
|
|
187
|
+
export const listDistributionsErrorTransformer = async (data: unknown): Promise<z.output<typeof ErrorResponse>> => await ErrorResponse.parseAsync(data);
|
|
188
|
+
|
|
189
|
+
export const listDistributions = async <ThrowOnError extends boolean = false, TResponseStyle extends 'fields' | 'data' = 'fields'>(options: Options<ListDistributionsData, ThrowOnError>): WrapErrors<ListDistributionsResponses, ListDistributionsErrors, ThrowOnError, TResponseStyle> => {
|
|
190
|
+
let result;
|
|
191
|
+
try {
|
|
192
|
+
result = await listDistributions2(options);
|
|
193
|
+
}
|
|
194
|
+
catch (err) {
|
|
195
|
+
if (err instanceof Error) {
|
|
196
|
+
throw new TransportError(err as Error);
|
|
197
|
+
}
|
|
198
|
+
let typedErr;
|
|
199
|
+
try {
|
|
200
|
+
typedErr = await listDistributionsErrorTransformer(err);
|
|
201
|
+
}
|
|
202
|
+
catch (validationError) {
|
|
203
|
+
throw new ResponseValidationError(validationError as ZodError, err);
|
|
204
|
+
}
|
|
205
|
+
throw typedErr;
|
|
206
|
+
}
|
|
207
|
+
const errorBearing = result as {
|
|
208
|
+
error?: unknown;
|
|
209
|
+
};
|
|
210
|
+
if (typeof result === "object" && result !== null && "request" in result && "response" in result && (typeof errorBearing.error === "object" && errorBearing.error !== null)) {
|
|
211
|
+
if (errorBearing.error instanceof Error) {
|
|
212
|
+
errorBearing.error = new TransportError(errorBearing.error as Error);
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
try {
|
|
216
|
+
errorBearing.error = await listDistributionsErrorTransformer(errorBearing.error);
|
|
217
|
+
}
|
|
218
|
+
catch (validationError) {
|
|
219
|
+
errorBearing.error = new ResponseValidationError(validationError as ZodError, errorBearing.error);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return result as unknown as Awaited<WrapErrors<ListDistributionsResponses, ListDistributionsErrors, ThrowOnError, TResponseStyle>>;
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
export type GetDistributionResponses = {
|
|
227
|
+
200: z.output<typeof DistributionDetail>;
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
export type GetDistributionResponse = GetDistributionResponses[keyof GetDistributionResponses];
|
|
231
|
+
|
|
232
|
+
export type GetDistributionErrors = {
|
|
233
|
+
400: z.output<typeof ValidationErrorResponse>;
|
|
234
|
+
404: z.output<typeof ErrorResponse>;
|
|
235
|
+
500: z.output<typeof ErrorResponse>;
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
export type GetDistributionError = GetDistributionErrors[keyof GetDistributionErrors];
|
|
239
|
+
|
|
240
|
+
export const getDistributionTransformer = async (data: unknown): Promise<z.output<typeof DistributionDetail>> => await DistributionDetail.parseAsync(data);
|
|
241
|
+
|
|
242
|
+
export const getDistributionErrorTransformer = async (data: unknown): Promise<z.output<typeof ValidationErrorResponse> | z.output<typeof ErrorResponse>> => await z.union([ValidationErrorResponse, ErrorResponse]).parseAsync(data);
|
|
243
|
+
|
|
244
|
+
export const getDistribution = async <ThrowOnError extends boolean = false, TResponseStyle extends 'fields' | 'data' = 'fields'>(options: Options<GetDistributionData, ThrowOnError>): WrapErrors<GetDistributionResponses, GetDistributionErrors, ThrowOnError, TResponseStyle> => {
|
|
245
|
+
let result;
|
|
246
|
+
try {
|
|
247
|
+
result = await getDistribution2(options);
|
|
248
|
+
}
|
|
249
|
+
catch (err) {
|
|
250
|
+
if (err instanceof Error) {
|
|
251
|
+
throw new TransportError(err as Error);
|
|
252
|
+
}
|
|
253
|
+
let typedErr;
|
|
254
|
+
try {
|
|
255
|
+
typedErr = await getDistributionErrorTransformer(err);
|
|
256
|
+
}
|
|
257
|
+
catch (validationError) {
|
|
258
|
+
throw new ResponseValidationError(validationError as ZodError, err);
|
|
259
|
+
}
|
|
260
|
+
throw typedErr;
|
|
261
|
+
}
|
|
262
|
+
const errorBearing = result as {
|
|
263
|
+
error?: unknown;
|
|
264
|
+
};
|
|
265
|
+
if (typeof result === "object" && result !== null && "request" in result && "response" in result && (typeof errorBearing.error === "object" && errorBearing.error !== null)) {
|
|
266
|
+
if (errorBearing.error instanceof Error) {
|
|
267
|
+
errorBearing.error = new TransportError(errorBearing.error as Error);
|
|
268
|
+
}
|
|
269
|
+
else {
|
|
270
|
+
try {
|
|
271
|
+
errorBearing.error = await getDistributionErrorTransformer(errorBearing.error);
|
|
272
|
+
}
|
|
273
|
+
catch (validationError) {
|
|
274
|
+
errorBearing.error = new ResponseValidationError(validationError as ZodError, errorBearing.error);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return result as unknown as Awaited<WrapErrors<GetDistributionResponses, GetDistributionErrors, ThrowOnError, TResponseStyle>>;
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
export type ListAllocationsResponses = {
|
|
282
|
+
200: z.output<typeof AllocationListResponse>;
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
export type ListAllocationsResponse = ListAllocationsResponses[keyof ListAllocationsResponses];
|
|
286
|
+
|
|
287
|
+
export type ListAllocationsErrors = {
|
|
288
|
+
400: z.output<typeof ErrorResponse>;
|
|
289
|
+
404: z.output<typeof ErrorResponse>;
|
|
290
|
+
500: z.output<typeof ErrorResponse>;
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
export type ListAllocationsError = ListAllocationsErrors[keyof ListAllocationsErrors];
|
|
294
|
+
|
|
295
|
+
export const listAllocationsTransformer = async (data: unknown): Promise<z.output<typeof AllocationListResponse>> => await AllocationListResponse.parseAsync(data);
|
|
296
|
+
|
|
297
|
+
export const listAllocationsErrorTransformer = async (data: unknown): Promise<z.output<typeof ErrorResponse>> => await ErrorResponse.parseAsync(data);
|
|
298
|
+
|
|
299
|
+
export const listAllocations = async <ThrowOnError extends boolean = false, TResponseStyle extends 'fields' | 'data' = 'fields'>(options: Options<ListAllocationsData, ThrowOnError>): WrapErrors<ListAllocationsResponses, ListAllocationsErrors, ThrowOnError, TResponseStyle> => {
|
|
300
|
+
let result;
|
|
301
|
+
try {
|
|
302
|
+
result = await listAllocations2(options);
|
|
303
|
+
}
|
|
304
|
+
catch (err) {
|
|
305
|
+
if (err instanceof Error) {
|
|
306
|
+
throw new TransportError(err as Error);
|
|
307
|
+
}
|
|
308
|
+
let typedErr;
|
|
309
|
+
try {
|
|
310
|
+
typedErr = await listAllocationsErrorTransformer(err);
|
|
311
|
+
}
|
|
312
|
+
catch (validationError) {
|
|
313
|
+
throw new ResponseValidationError(validationError as ZodError, err);
|
|
314
|
+
}
|
|
315
|
+
throw typedErr;
|
|
316
|
+
}
|
|
317
|
+
const errorBearing = result as {
|
|
318
|
+
error?: unknown;
|
|
319
|
+
};
|
|
320
|
+
if (typeof result === "object" && result !== null && "request" in result && "response" in result && (typeof errorBearing.error === "object" && errorBearing.error !== null)) {
|
|
321
|
+
if (errorBearing.error instanceof Error) {
|
|
322
|
+
errorBearing.error = new TransportError(errorBearing.error as Error);
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
try {
|
|
326
|
+
errorBearing.error = await listAllocationsErrorTransformer(errorBearing.error);
|
|
327
|
+
}
|
|
328
|
+
catch (validationError) {
|
|
329
|
+
errorBearing.error = new ResponseValidationError(validationError as ZodError, errorBearing.error);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
return result as unknown as Awaited<WrapErrors<ListAllocationsResponses, ListAllocationsErrors, ThrowOnError, TResponseStyle>>;
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
export type ListExcludedAllocationsResponses = {
|
|
337
|
+
200: z.output<typeof ExcludedAllocationsResponse>;
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
export type ListExcludedAllocationsResponse = ListExcludedAllocationsResponses[keyof ListExcludedAllocationsResponses];
|
|
341
|
+
|
|
342
|
+
export type ListExcludedAllocationsErrors = {
|
|
343
|
+
400: z.output<typeof ValidationErrorResponse>;
|
|
344
|
+
404: z.output<typeof ErrorResponse>;
|
|
345
|
+
500: z.output<typeof ErrorResponse>;
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
export type ListExcludedAllocationsError = ListExcludedAllocationsErrors[keyof ListExcludedAllocationsErrors];
|
|
349
|
+
|
|
350
|
+
export const listExcludedAllocationsTransformer = async (data: unknown): Promise<z.output<typeof ExcludedAllocationsResponse>> => await ExcludedAllocationsResponse.parseAsync(data);
|
|
351
|
+
|
|
352
|
+
export const listExcludedAllocationsErrorTransformer = async (data: unknown): Promise<z.output<typeof ValidationErrorResponse> | z.output<typeof ErrorResponse>> => await z.union([ValidationErrorResponse, ErrorResponse]).parseAsync(data);
|
|
353
|
+
|
|
354
|
+
export const listExcludedAllocations = async <ThrowOnError extends boolean = false, TResponseStyle extends 'fields' | 'data' = 'fields'>(options: Options<ListExcludedAllocationsData, ThrowOnError>): WrapErrors<ListExcludedAllocationsResponses, ListExcludedAllocationsErrors, ThrowOnError, TResponseStyle> => {
|
|
355
|
+
let result;
|
|
356
|
+
try {
|
|
357
|
+
result = await listExcludedAllocations2(options);
|
|
358
|
+
}
|
|
359
|
+
catch (err) {
|
|
360
|
+
if (err instanceof Error) {
|
|
361
|
+
throw new TransportError(err as Error);
|
|
362
|
+
}
|
|
363
|
+
let typedErr;
|
|
364
|
+
try {
|
|
365
|
+
typedErr = await listExcludedAllocationsErrorTransformer(err);
|
|
366
|
+
}
|
|
367
|
+
catch (validationError) {
|
|
368
|
+
throw new ResponseValidationError(validationError as ZodError, err);
|
|
369
|
+
}
|
|
370
|
+
throw typedErr;
|
|
371
|
+
}
|
|
372
|
+
const errorBearing = result as {
|
|
373
|
+
error?: unknown;
|
|
374
|
+
};
|
|
375
|
+
if (typeof result === "object" && result !== null && "request" in result && "response" in result && (typeof errorBearing.error === "object" && errorBearing.error !== null)) {
|
|
376
|
+
if (errorBearing.error instanceof Error) {
|
|
377
|
+
errorBearing.error = new TransportError(errorBearing.error as Error);
|
|
378
|
+
}
|
|
379
|
+
else {
|
|
380
|
+
try {
|
|
381
|
+
errorBearing.error = await listExcludedAllocationsErrorTransformer(errorBearing.error);
|
|
382
|
+
}
|
|
383
|
+
catch (validationError) {
|
|
384
|
+
errorBearing.error = new ResponseValidationError(validationError as ZodError, errorBearing.error);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
return result as unknown as Awaited<WrapErrors<ListExcludedAllocationsResponses, ListExcludedAllocationsErrors, ThrowOnError, TResponseStyle>>;
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
export type GetAllocationResponses = {
|
|
392
|
+
200: z.output<typeof AllocationRow>;
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
export type GetAllocationResponse = GetAllocationResponses[keyof GetAllocationResponses];
|
|
396
|
+
|
|
397
|
+
export type GetAllocationErrors = {
|
|
398
|
+
400: z.output<typeof ValidationErrorResponse>;
|
|
399
|
+
404: z.output<typeof ErrorResponse>;
|
|
400
|
+
500: z.output<typeof ErrorResponse>;
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
export type GetAllocationError = GetAllocationErrors[keyof GetAllocationErrors];
|
|
404
|
+
|
|
405
|
+
export const getAllocationTransformer = async (data: unknown): Promise<z.output<typeof AllocationRow>> => await AllocationRow.parseAsync(data);
|
|
406
|
+
|
|
407
|
+
export const getAllocationErrorTransformer = async (data: unknown): Promise<z.output<typeof ValidationErrorResponse> | z.output<typeof ErrorResponse>> => await z.union([ValidationErrorResponse, ErrorResponse]).parseAsync(data);
|
|
408
|
+
|
|
409
|
+
export const getAllocation = async <ThrowOnError extends boolean = false, TResponseStyle extends 'fields' | 'data' = 'fields'>(options: Options<GetAllocationData, ThrowOnError>): WrapErrors<GetAllocationResponses, GetAllocationErrors, ThrowOnError, TResponseStyle> => {
|
|
410
|
+
let result;
|
|
411
|
+
try {
|
|
412
|
+
result = await getAllocation2(options);
|
|
413
|
+
}
|
|
414
|
+
catch (err) {
|
|
415
|
+
if (err instanceof Error) {
|
|
416
|
+
throw new TransportError(err as Error);
|
|
417
|
+
}
|
|
418
|
+
let typedErr;
|
|
419
|
+
try {
|
|
420
|
+
typedErr = await getAllocationErrorTransformer(err);
|
|
421
|
+
}
|
|
422
|
+
catch (validationError) {
|
|
423
|
+
throw new ResponseValidationError(validationError as ZodError, err);
|
|
424
|
+
}
|
|
425
|
+
throw typedErr;
|
|
426
|
+
}
|
|
427
|
+
const errorBearing = result as {
|
|
428
|
+
error?: unknown;
|
|
429
|
+
};
|
|
430
|
+
if (typeof result === "object" && result !== null && "request" in result && "response" in result && (typeof errorBearing.error === "object" && errorBearing.error !== null)) {
|
|
431
|
+
if (errorBearing.error instanceof Error) {
|
|
432
|
+
errorBearing.error = new TransportError(errorBearing.error as Error);
|
|
433
|
+
}
|
|
434
|
+
else {
|
|
435
|
+
try {
|
|
436
|
+
errorBearing.error = await getAllocationErrorTransformer(errorBearing.error);
|
|
437
|
+
}
|
|
438
|
+
catch (validationError) {
|
|
439
|
+
errorBearing.error = new ResponseValidationError(validationError as ZodError, errorBearing.error);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
return result as unknown as Awaited<WrapErrors<GetAllocationResponses, GetAllocationErrors, ThrowOnError, TResponseStyle>>;
|
|
444
|
+
};
|
|
445
|
+
|
|
446
|
+
export type GetAddressAllocationHistoryResponses = {
|
|
447
|
+
200: z.output<typeof AllocationHistoryResponse>;
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
export type GetAddressAllocationHistoryResponse = GetAddressAllocationHistoryResponses[keyof GetAddressAllocationHistoryResponses];
|
|
451
|
+
|
|
452
|
+
export type GetAddressAllocationHistoryErrors = {
|
|
453
|
+
400: z.output<typeof ValidationErrorResponse>;
|
|
454
|
+
500: z.output<typeof ErrorResponse>;
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
export type GetAddressAllocationHistoryError = GetAddressAllocationHistoryErrors[keyof GetAddressAllocationHistoryErrors];
|
|
458
|
+
|
|
459
|
+
export const getAddressAllocationHistoryTransformer = async (data: unknown): Promise<z.output<typeof AllocationHistoryResponse>> => await AllocationHistoryResponse.parseAsync(data);
|
|
460
|
+
|
|
461
|
+
export const getAddressAllocationHistoryErrorTransformer = async (data: unknown): Promise<z.output<typeof ValidationErrorResponse> | z.output<typeof ErrorResponse>> => await z.union([ValidationErrorResponse, ErrorResponse]).parseAsync(data);
|
|
462
|
+
|
|
463
|
+
export const getAddressAllocationHistory = async <ThrowOnError extends boolean = false, TResponseStyle extends 'fields' | 'data' = 'fields'>(options: Options<GetAddressAllocationHistoryData, ThrowOnError>): WrapErrors<GetAddressAllocationHistoryResponses, GetAddressAllocationHistoryErrors, ThrowOnError, TResponseStyle> => {
|
|
464
|
+
let result;
|
|
465
|
+
try {
|
|
466
|
+
result = await getAddressAllocationHistory2(options);
|
|
467
|
+
}
|
|
468
|
+
catch (err) {
|
|
469
|
+
if (err instanceof Error) {
|
|
470
|
+
throw new TransportError(err as Error);
|
|
471
|
+
}
|
|
472
|
+
let typedErr;
|
|
473
|
+
try {
|
|
474
|
+
typedErr = await getAddressAllocationHistoryErrorTransformer(err);
|
|
475
|
+
}
|
|
476
|
+
catch (validationError) {
|
|
477
|
+
throw new ResponseValidationError(validationError as ZodError, err);
|
|
478
|
+
}
|
|
479
|
+
throw typedErr;
|
|
480
|
+
}
|
|
481
|
+
const errorBearing = result as {
|
|
482
|
+
error?: unknown;
|
|
483
|
+
};
|
|
484
|
+
if (typeof result === "object" && result !== null && "request" in result && "response" in result && (typeof errorBearing.error === "object" && errorBearing.error !== null)) {
|
|
485
|
+
if (errorBearing.error instanceof Error) {
|
|
486
|
+
errorBearing.error = new TransportError(errorBearing.error as Error);
|
|
487
|
+
}
|
|
488
|
+
else {
|
|
489
|
+
try {
|
|
490
|
+
errorBearing.error = await getAddressAllocationHistoryErrorTransformer(errorBearing.error);
|
|
491
|
+
}
|
|
492
|
+
catch (validationError) {
|
|
493
|
+
errorBearing.error = new ResponseValidationError(validationError as ZodError, errorBearing.error);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
return result as unknown as Awaited<WrapErrors<GetAddressAllocationHistoryResponses, GetAddressAllocationHistoryErrors, ThrowOnError, TResponseStyle>>;
|
|
498
|
+
};
|
|
499
|
+
|
|
500
|
+
export type GetUnclaimedProofsResponses = {
|
|
501
|
+
200: z.output<typeof UnclaimedProofsResponse>;
|
|
502
|
+
};
|
|
503
|
+
|
|
504
|
+
export type GetUnclaimedProofsResponse = GetUnclaimedProofsResponses[keyof GetUnclaimedProofsResponses];
|
|
505
|
+
|
|
506
|
+
export type GetUnclaimedProofsErrors = {
|
|
507
|
+
400: z.output<typeof ValidationErrorResponse>;
|
|
508
|
+
500: z.output<typeof ErrorResponse>;
|
|
509
|
+
};
|
|
510
|
+
|
|
511
|
+
export type GetUnclaimedProofsError = GetUnclaimedProofsErrors[keyof GetUnclaimedProofsErrors];
|
|
512
|
+
|
|
513
|
+
export const getUnclaimedProofsTransformer = async (data: unknown): Promise<z.output<typeof UnclaimedProofsResponse>> => await UnclaimedProofsResponse.parseAsync(data);
|
|
514
|
+
|
|
515
|
+
export const getUnclaimedProofsErrorTransformer = async (data: unknown): Promise<z.output<typeof ValidationErrorResponse> | z.output<typeof ErrorResponse>> => await z.union([ValidationErrorResponse, ErrorResponse]).parseAsync(data);
|
|
516
|
+
|
|
517
|
+
export const getUnclaimedProofs = async <ThrowOnError extends boolean = false, TResponseStyle extends 'fields' | 'data' = 'fields'>(options: Options<GetUnclaimedProofsData, ThrowOnError>): WrapErrors<GetUnclaimedProofsResponses, GetUnclaimedProofsErrors, ThrowOnError, TResponseStyle> => {
|
|
518
|
+
let result;
|
|
519
|
+
try {
|
|
520
|
+
result = await getUnclaimedProofs2(options);
|
|
521
|
+
}
|
|
522
|
+
catch (err) {
|
|
523
|
+
if (err instanceof Error) {
|
|
524
|
+
throw new TransportError(err as Error);
|
|
525
|
+
}
|
|
526
|
+
let typedErr;
|
|
527
|
+
try {
|
|
528
|
+
typedErr = await getUnclaimedProofsErrorTransformer(err);
|
|
529
|
+
}
|
|
530
|
+
catch (validationError) {
|
|
531
|
+
throw new ResponseValidationError(validationError as ZodError, err);
|
|
532
|
+
}
|
|
533
|
+
throw typedErr;
|
|
534
|
+
}
|
|
535
|
+
const errorBearing = result as {
|
|
536
|
+
error?: unknown;
|
|
537
|
+
};
|
|
538
|
+
if (typeof result === "object" && result !== null && "request" in result && "response" in result && (typeof errorBearing.error === "object" && errorBearing.error !== null)) {
|
|
539
|
+
if (errorBearing.error instanceof Error) {
|
|
540
|
+
errorBearing.error = new TransportError(errorBearing.error as Error);
|
|
541
|
+
}
|
|
542
|
+
else {
|
|
543
|
+
try {
|
|
544
|
+
errorBearing.error = await getUnclaimedProofsErrorTransformer(errorBearing.error);
|
|
545
|
+
}
|
|
546
|
+
catch (validationError) {
|
|
547
|
+
errorBearing.error = new ResponseValidationError(validationError as ZodError, errorBearing.error);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
return result as unknown as Awaited<WrapErrors<GetUnclaimedProofsResponses, GetUnclaimedProofsErrors, ThrowOnError, TResponseStyle>>;
|
|
552
|
+
};
|
|
553
|
+
|
|
554
|
+
export type GetProofResponses = {
|
|
555
|
+
200: z.output<typeof ProofResponse>;
|
|
556
|
+
};
|
|
557
|
+
|
|
558
|
+
export type GetProofResponse = GetProofResponses[keyof GetProofResponses];
|
|
559
|
+
|
|
560
|
+
export type GetProofErrors = {
|
|
561
|
+
400: z.output<typeof ValidationErrorResponse>;
|
|
562
|
+
404: z.output<typeof ErrorResponse>;
|
|
563
|
+
500: z.output<typeof ErrorResponse>;
|
|
564
|
+
};
|
|
565
|
+
|
|
566
|
+
export type GetProofError = GetProofErrors[keyof GetProofErrors];
|
|
567
|
+
|
|
568
|
+
export const getProofTransformer = async (data: unknown): Promise<z.output<typeof ProofResponse>> => await ProofResponse.parseAsync(data);
|
|
569
|
+
|
|
570
|
+
export const getProofErrorTransformer = async (data: unknown): Promise<z.output<typeof ValidationErrorResponse> | z.output<typeof ErrorResponse>> => await z.union([ValidationErrorResponse, ErrorResponse]).parseAsync(data);
|
|
571
|
+
|
|
572
|
+
export const getProof = async <ThrowOnError extends boolean = false, TResponseStyle extends 'fields' | 'data' = 'fields'>(options: Options<GetProofData, ThrowOnError>): WrapErrors<GetProofResponses, GetProofErrors, ThrowOnError, TResponseStyle> => {
|
|
573
|
+
let result;
|
|
574
|
+
try {
|
|
575
|
+
result = await getProof2(options);
|
|
576
|
+
}
|
|
577
|
+
catch (err) {
|
|
578
|
+
if (err instanceof Error) {
|
|
579
|
+
throw new TransportError(err as Error);
|
|
580
|
+
}
|
|
581
|
+
let typedErr;
|
|
582
|
+
try {
|
|
583
|
+
typedErr = await getProofErrorTransformer(err);
|
|
584
|
+
}
|
|
585
|
+
catch (validationError) {
|
|
586
|
+
throw new ResponseValidationError(validationError as ZodError, err);
|
|
587
|
+
}
|
|
588
|
+
throw typedErr;
|
|
589
|
+
}
|
|
590
|
+
const errorBearing = result as {
|
|
591
|
+
error?: unknown;
|
|
592
|
+
};
|
|
593
|
+
if (typeof result === "object" && result !== null && "request" in result && "response" in result && (typeof errorBearing.error === "object" && errorBearing.error !== null)) {
|
|
594
|
+
if (errorBearing.error instanceof Error) {
|
|
595
|
+
errorBearing.error = new TransportError(errorBearing.error as Error);
|
|
596
|
+
}
|
|
597
|
+
else {
|
|
598
|
+
try {
|
|
599
|
+
errorBearing.error = await getProofErrorTransformer(errorBearing.error);
|
|
600
|
+
}
|
|
601
|
+
catch (validationError) {
|
|
602
|
+
errorBearing.error = new ResponseValidationError(validationError as ZodError, errorBearing.error);
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
return result as unknown as Awaited<WrapErrors<GetProofResponses, GetProofErrors, ThrowOnError, TResponseStyle>>;
|
|
607
|
+
};
|