@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.
Files changed (103) hide show
  1. package/MIGRATION.md +5 -0
  2. package/dist/generated/@tanstack/react-query.gen.d.ts +796 -0
  3. package/dist/generated/@tanstack/react-query.gen.d.ts.map +1 -0
  4. package/dist/generated/@tanstack/react-query.gen.js +283 -0
  5. package/dist/generated/@tanstack/react-query.gen.js.map +1 -0
  6. package/dist/generated/client/client.gen.d.ts +3 -0
  7. package/dist/generated/client/client.gen.d.ts.map +1 -0
  8. package/dist/generated/client/client.gen.js +236 -0
  9. package/dist/generated/client/client.gen.js.map +1 -0
  10. package/dist/generated/client/index.d.ts +9 -0
  11. package/dist/generated/client/index.d.ts.map +1 -0
  12. package/dist/generated/client/index.js +7 -0
  13. package/dist/generated/client/index.js.map +1 -0
  14. package/dist/generated/client/types.gen.d.ts +118 -0
  15. package/dist/generated/client/types.gen.d.ts.map +1 -0
  16. package/dist/generated/client/types.gen.js +3 -0
  17. package/dist/generated/client/types.gen.js.map +1 -0
  18. package/dist/generated/client/utils.gen.d.ts +34 -0
  19. package/dist/generated/client/utils.gen.d.ts.map +1 -0
  20. package/dist/generated/client/utils.gen.js +229 -0
  21. package/dist/generated/client/utils.gen.js.map +1 -0
  22. package/dist/generated/client.gen.d.ts +13 -0
  23. package/dist/generated/client.gen.d.ts.map +1 -0
  24. package/dist/generated/client.gen.js +4 -0
  25. package/dist/generated/client.gen.js.map +1 -0
  26. package/dist/generated/core/auth.gen.d.ts +19 -0
  27. package/dist/generated/core/auth.gen.d.ts.map +1 -0
  28. package/dist/generated/core/auth.gen.js +15 -0
  29. package/dist/generated/core/auth.gen.js.map +1 -0
  30. package/dist/generated/core/bodySerializer.gen.d.ts +26 -0
  31. package/dist/generated/core/bodySerializer.gen.d.ts.map +1 -0
  32. package/dist/generated/core/bodySerializer.gen.js +58 -0
  33. package/dist/generated/core/bodySerializer.gen.js.map +1 -0
  34. package/dist/generated/core/params.gen.d.ts +44 -0
  35. package/dist/generated/core/params.gen.d.ts.map +1 -0
  36. package/dist/generated/core/params.gen.js +101 -0
  37. package/dist/generated/core/params.gen.js.map +1 -0
  38. package/dist/generated/core/pathSerializer.gen.d.ts +34 -0
  39. package/dist/generated/core/pathSerializer.gen.d.ts.map +1 -0
  40. package/dist/generated/core/pathSerializer.gen.js +107 -0
  41. package/dist/generated/core/pathSerializer.gen.js.map +1 -0
  42. package/dist/generated/core/queryKeySerializer.gen.d.ts +19 -0
  43. package/dist/generated/core/queryKeySerializer.gen.d.ts.map +1 -0
  44. package/dist/generated/core/queryKeySerializer.gen.js +93 -0
  45. package/dist/generated/core/queryKeySerializer.gen.js.map +1 -0
  46. package/dist/generated/core/serverSentEvents.gen.d.ts +72 -0
  47. package/dist/generated/core/serverSentEvents.gen.d.ts.map +1 -0
  48. package/dist/generated/core/serverSentEvents.gen.js +134 -0
  49. package/dist/generated/core/serverSentEvents.gen.js.map +1 -0
  50. package/dist/generated/core/types.gen.d.ts +79 -0
  51. package/dist/generated/core/types.gen.d.ts.map +1 -0
  52. package/dist/generated/core/types.gen.js +3 -0
  53. package/dist/generated/core/types.gen.js.map +1 -0
  54. package/dist/generated/core/utils.gen.d.ts +20 -0
  55. package/dist/generated/core/utils.gen.d.ts.map +1 -0
  56. package/dist/generated/core/utils.gen.js +88 -0
  57. package/dist/generated/core/utils.gen.js.map +1 -0
  58. package/dist/generated/index.d.ts +4 -0
  59. package/dist/generated/index.d.ts.map +1 -0
  60. package/dist/generated/index.js +5 -0
  61. package/dist/generated/index.js.map +1 -0
  62. package/dist/generated/registry-validator.gen.d.ts +168 -0
  63. package/dist/generated/registry-validator.gen.d.ts.map +1 -0
  64. package/dist/generated/registry-validator.gen.js +402 -0
  65. package/dist/generated/registry-validator.gen.js.map +1 -0
  66. package/dist/generated/sdk.gen.d.ts +71 -0
  67. package/dist/generated/sdk.gen.d.ts.map +1 -0
  68. package/dist/generated/sdk.gen.js +98 -0
  69. package/dist/generated/sdk.gen.js.map +1 -0
  70. package/dist/generated/types.gen.d.ts +435 -0
  71. package/dist/generated/types.gen.d.ts.map +1 -0
  72. package/dist/generated/types.gen.js +3 -0
  73. package/dist/generated/types.gen.js.map +1 -0
  74. package/dist/index.d.ts +2 -0
  75. package/dist/index.d.ts.map +1 -0
  76. package/dist/index.js +33 -0
  77. package/dist/index.js.map +1 -0
  78. package/dist/react.d.ts +2 -0
  79. package/dist/react.d.ts.map +1 -0
  80. package/dist/react.js +18 -0
  81. package/dist/react.js.map +1 -0
  82. package/dist/tsconfig.lib.tsbuildinfo +1 -0
  83. package/package.json +68 -0
  84. package/src/generated/@tanstack/react-query.gen.ts +322 -0
  85. package/src/generated/client/client.gen.ts +298 -0
  86. package/src/generated/client/index.ts +25 -0
  87. package/src/generated/client/types.gen.ts +214 -0
  88. package/src/generated/client/utils.gen.ts +316 -0
  89. package/src/generated/client.gen.ts +16 -0
  90. package/src/generated/core/auth.gen.ts +41 -0
  91. package/src/generated/core/bodySerializer.gen.ts +82 -0
  92. package/src/generated/core/params.gen.ts +169 -0
  93. package/src/generated/core/pathSerializer.gen.ts +171 -0
  94. package/src/generated/core/queryKeySerializer.gen.ts +117 -0
  95. package/src/generated/core/serverSentEvents.gen.ts +243 -0
  96. package/src/generated/core/types.gen.ts +104 -0
  97. package/src/generated/core/utils.gen.ts +140 -0
  98. package/src/generated/index.ts +5 -0
  99. package/src/generated/registry-validator.gen.ts +607 -0
  100. package/src/generated/sdk.gen.ts +124 -0
  101. package/src/generated/types.gen.ts +503 -0
  102. package/src/index.ts +68 -0
  103. package/src/react.ts +42 -0
@@ -0,0 +1,124 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+
3
+ import { client } from './client.gen.js';
4
+ import type { Client, Options as Options2, TDataShape } from './client/index.js';
5
+ import { type GetAddressAllocationHistoryErrors, type GetAddressAllocationHistoryResponses, getAddressAllocationHistoryTransformer, type GetAllocationErrors, type GetAllocationResponses, getAllocationTransformer, type GetDistributionErrors, type GetDistributionResponses, getDistributionTransformer, type GetHealthCheckErrors, type GetHealthCheckResponses, getHealthCheckTransformer, type GetProofErrors, type GetProofResponses, getProofTransformer, type GetReadinessErrors, type GetReadinessResponses, getReadinessTransformer, type GetUnclaimedProofsErrors, type GetUnclaimedProofsResponses, getUnclaimedProofsTransformer, type ListAllocationsErrors, type ListAllocationsResponses, listAllocationsTransformer, type ListDistributionsErrors, type ListDistributionsResponses, listDistributionsTransformer, type ListExcludedAllocationsErrors, type ListExcludedAllocationsResponses, listExcludedAllocationsTransformer } from './registry-validator.gen.js';
6
+ import type { GetAddressAllocationHistoryData, GetAllocationData, GetDistributionData, GetHealthCheckData, GetProofData, GetReadinessData, GetUnclaimedProofsData, ListAllocationsData, ListDistributionsData, ListExcludedAllocationsData } from './types.gen.js';
7
+
8
+ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {
9
+ /**
10
+ * You can provide a client instance returned by `createClient()` instead of
11
+ * individual options. This might be also useful if you want to implement a
12
+ * custom client.
13
+ */
14
+ client?: Client;
15
+ /**
16
+ * You can pass arbitrary values through the `meta` object. This can be
17
+ * used to access values that aren't defined as part of the SDK function.
18
+ */
19
+ meta?: Record<string, unknown>;
20
+ };
21
+
22
+ /**
23
+ * Liveness check (K8s probe)
24
+ */
25
+ export const getHealthCheck = <ThrowOnError extends boolean = false>(options?: Options<GetHealthCheckData, ThrowOnError>) => (options?.client ?? client).get<GetHealthCheckResponses, GetHealthCheckErrors, ThrowOnError>({
26
+ responseTransformer: getHealthCheckTransformer,
27
+ url: '/health-check',
28
+ ...options
29
+ });
30
+
31
+ /**
32
+ * Readiness check
33
+ *
34
+ * Distinguishes "fully ready" from "partially degraded but still serving". Currently a 200 stub — the real DB + subgraph reachability probe is outstanding work.
35
+ */
36
+ export const getReadiness = <ThrowOnError extends boolean = false>(options?: Options<GetReadinessData, ThrowOnError>) => (options?.client ?? client).get<GetReadinessResponses, GetReadinessErrors, ThrowOnError>({
37
+ responseTransformer: getReadinessTransformer,
38
+ url: '/readiness',
39
+ ...options
40
+ });
41
+
42
+ /**
43
+ * List completed distributions
44
+ *
45
+ * Paginated list of completed distributions, oldest first by id (e.g. `2026-04`). Non-completed rows are not surfaced on the public API.
46
+ */
47
+ export const listDistributions = <ThrowOnError extends boolean = false>(options: Options<ListDistributionsData, ThrowOnError>) => (options.client ?? client).get<ListDistributionsResponses, ListDistributionsErrors, ThrowOnError>({
48
+ responseTransformer: listDistributionsTransformer,
49
+ url: '/v1/{network}/distributions',
50
+ ...options
51
+ });
52
+
53
+ /**
54
+ * Get a single completed distribution
55
+ */
56
+ export const getDistribution = <ThrowOnError extends boolean = false>(options: Options<GetDistributionData, ThrowOnError>) => (options.client ?? client).get<GetDistributionResponses, GetDistributionErrors, ThrowOnError>({
57
+ responseTransformer: getDistributionTransformer,
58
+ url: '/v1/{network}/distributions/{distributionId}',
59
+ ...options
60
+ });
61
+
62
+ /**
63
+ * List allocations for a completed distribution
64
+ *
65
+ * Paginated by `leafIndex` ascending.
66
+ */
67
+ export const listAllocations = <ThrowOnError extends boolean = false>(options: Options<ListAllocationsData, ThrowOnError>) => (options.client ?? client).get<ListAllocationsResponses, ListAllocationsErrors, ThrowOnError>({
68
+ responseTransformer: listAllocationsTransformer,
69
+ url: '/v1/{network}/distributions/{distributionId}/allocations',
70
+ ...options
71
+ });
72
+
73
+ /**
74
+ * List off-chain (merkle-excluded) allocations for a distribution
75
+ *
76
+ * Recipients allocated but excluded from the merkle tree (excluded addresses) — not claimable on-chain, settled manually. Not paginated (small bounded set). `totalAmount` equals the distribution `total_allocated - claimable_total`.
77
+ */
78
+ export const listExcludedAllocations = <ThrowOnError extends boolean = false>(options: Options<ListExcludedAllocationsData, ThrowOnError>) => (options.client ?? client).get<ListExcludedAllocationsResponses, ListExcludedAllocationsErrors, ThrowOnError>({
79
+ responseTransformer: listExcludedAllocationsTransformer,
80
+ url: '/v1/{network}/distributions/{distributionId}/excluded-allocations',
81
+ ...options
82
+ });
83
+
84
+ /**
85
+ * Get a single address allocation in a distribution
86
+ */
87
+ export const getAllocation = <ThrowOnError extends boolean = false>(options: Options<GetAllocationData, ThrowOnError>) => (options.client ?? client).get<GetAllocationResponses, GetAllocationErrors, ThrowOnError>({
88
+ responseTransformer: getAllocationTransformer,
89
+ url: '/v1/{network}/distributions/{distributionId}/allocations/{address}',
90
+ ...options
91
+ });
92
+
93
+ /**
94
+ * Per-address cross-distribution allocation history with live claim status
95
+ *
96
+ * Returns every allocation row for the given address across all completed distributions on the network, enriched with `status: "claimed" | "unclaimed"` derived live at request time by querying the pos-staker-pool-claims subgraph (spec §3.6, D10). Empty array if the address never qualified.
97
+ */
98
+ export const getAddressAllocationHistory = <ThrowOnError extends boolean = false>(options: Options<GetAddressAllocationHistoryData, ThrowOnError>) => (options.client ?? client).get<GetAddressAllocationHistoryResponses, GetAddressAllocationHistoryErrors, ThrowOnError>({
99
+ responseTransformer: getAddressAllocationHistoryTransformer,
100
+ url: '/v1/{network}/addresses/{address}/allocations',
101
+ ...options
102
+ });
103
+
104
+ /**
105
+ * Per-address unclaimed-proofs array — the primary claim-flow UI endpoint
106
+ *
107
+ * Returns the address's outstanding allocations with merkle proofs ready to submit to the claimer contract in one batched transaction. Proof generation is on demand from the persisted leaves (spec D9); the in-memory tree cache absorbs repeat calls for the same distribution. Empty array if every allocation has been claimed (or the address has none).
108
+ */
109
+ export const getUnclaimedProofs = <ThrowOnError extends boolean = false>(options: Options<GetUnclaimedProofsData, ThrowOnError>) => (options.client ?? client).get<GetUnclaimedProofsResponses, GetUnclaimedProofsErrors, ThrowOnError>({
110
+ responseTransformer: getUnclaimedProofsTransformer,
111
+ url: '/v1/{network}/addresses/{address}/unclaimed-proofs',
112
+ ...options
113
+ });
114
+
115
+ /**
116
+ * Get the merkle proof for a single allocation
117
+ *
118
+ * Rebuilds (or cache-hits) the merkle tree from the persisted allocations table and extracts the proof for the requested address. The returned tuple `(merkleRoot, address, amount, leafIndex, proof)` can be passed straight to a Solidity verifier built around the same `[address, uint256]` leaf encoding.
119
+ */
120
+ export const getProof = <ThrowOnError extends boolean = false>(options: Options<GetProofData, ThrowOnError>) => (options.client ?? client).get<GetProofResponses, GetProofErrors, ThrowOnError>({
121
+ responseTransformer: getProofTransformer,
122
+ url: '/v1/{network}/distributions/{distributionId}/allocations/{address}/proof',
123
+ ...options
124
+ });
@@ -0,0 +1,503 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+
3
+ export type ClientOptions = {
4
+ baseUrl: `${string}://${string}` | (string & {});
5
+ };
6
+
7
+ export type OperationalStatus = {
8
+ status: 'ok';
9
+ };
10
+
11
+ /**
12
+ * Standard error response shape from `@polygonlabs/express`'s `createErrorHandler`. `info` is present when the underlying `HTTPError` carries structured info (e.g. validation failures, domain-specific context); absent for plain errors and most non-validation HTTPErrors.
13
+ */
14
+ export type ErrorResponse = {
15
+ error: true;
16
+ message: string;
17
+ info?: {
18
+ [key: string]: unknown;
19
+ };
20
+ };
21
+
22
+ export type DistributionListResponse = {
23
+ items: Array<DistributionSummary>;
24
+ nextCursor: string | null;
25
+ };
26
+
27
+ export type DistributionSummary = {
28
+ distributionId: string;
29
+ status: 'pending' | 'running' | 'completed' | 'failed';
30
+ startPoSBlock: string;
31
+ endPoSBlock: string;
32
+ merkleRoot: string | null;
33
+ totalAllocated: string | null;
34
+ completedAt: string | null;
35
+ };
36
+
37
+ export type DistributionDetail = DistributionSummary & {
38
+ checkpointCount: number;
39
+ polUsdPrice: string | null;
40
+ maxClaimableUsdThreshold: string | null;
41
+ inputsHash: string | null;
42
+ posStakingSubgraphBlock: string | null;
43
+ posStakingSubgraphHash: string | null;
44
+ posCheckpointsSubgraphBlock: string | null;
45
+ posCheckpointsSubgraphHash: string | null;
46
+ posPriorityFeesSubgraphBlock: string | null;
47
+ posPriorityFeesSubgraphHash: string | null;
48
+ };
49
+
50
+ /**
51
+ * Narrowed `ErrorResponse` for 400s emitted by the registry-driven router when request validation fails. `info` is non-optional and carries the section-keyed `ValidationErrorInfo` shape.
52
+ */
53
+ export type ValidationErrorResponse = {
54
+ error: true;
55
+ message: string;
56
+ info: ValidationErrorInfo;
57
+ };
58
+
59
+ /**
60
+ * Section-keyed map of request validation failures. Only sections that failed appear; each value is the `z.treeifyError` tree for that section. Clients can wire e.g. `info.body.properties.label.errors[0]` directly into field-level UI feedback rather than walking a flat issue list.
61
+ */
62
+ export type ValidationErrorInfo = {
63
+ params?: ZodErrorTree;
64
+ query?: ZodErrorTree;
65
+ body?: ZodErrorTree;
66
+ headers?: ZodErrorTree;
67
+ };
68
+
69
+ /**
70
+ * Recursive Zod validation error tree (the output of `z.treeifyError`). `errors` carries the messages at this node; `properties` keys nested object errors by field name; `items` indexes nested array errors.
71
+ */
72
+ export type ZodErrorTree = {
73
+ errors: Array<string>;
74
+ properties?: {
75
+ [key: string]: ZodErrorTree;
76
+ };
77
+ items?: Array<ZodErrorTree>;
78
+ };
79
+
80
+ export type AllocationListResponse = {
81
+ items: Array<AllocationRow>;
82
+ nextCursor: string | null;
83
+ };
84
+
85
+ export type AllocationRow = {
86
+ address: string;
87
+ amount: string;
88
+ leafIndex: number | null;
89
+ };
90
+
91
+ export type ExcludedAllocationsResponse = {
92
+ items: Array<ExcludedAllocationRow>;
93
+ total: number;
94
+ totalAmount: string;
95
+ };
96
+
97
+ export type ExcludedAllocationRow = {
98
+ address: string;
99
+ amount: string;
100
+ };
101
+
102
+ export type AllocationHistoryResponse = {
103
+ items: Array<AllocationHistoryRow>;
104
+ };
105
+
106
+ export type AllocationHistoryRow = {
107
+ distributionId: string;
108
+ address: string;
109
+ amount: string;
110
+ leafIndex: number | null;
111
+ merkleRoot: string;
112
+ completedAt: string;
113
+ /**
114
+ * Derived live at request time by diffing the address's allocations against the pos-staker-pool-claims subgraph. Never persisted (spec D10).
115
+ */
116
+ status: 'claimed' | 'unclaimed';
117
+ };
118
+
119
+ export type UnclaimedProofsResponse = {
120
+ items: Array<UnclaimedProofBatch>;
121
+ };
122
+
123
+ export type UnclaimedProofBatch = {
124
+ distributionId: string;
125
+ merkleRoot: string;
126
+ amount: string;
127
+ leafIndex: number;
128
+ proof: Array<string>;
129
+ };
130
+
131
+ export type ProofResponse = {
132
+ /**
133
+ * Distribution merkle root — same value as `DistributionDetail.merkleRoot`.
134
+ */
135
+ merkleRoot: string;
136
+ address: string;
137
+ amount: string;
138
+ /**
139
+ * Index of this leaf in the canonical (lowercased-address-sorted) tree.
140
+ */
141
+ leafIndex: number;
142
+ /**
143
+ * Sibling-hash array. Pass straight to the claimer contract.
144
+ */
145
+ proof: Array<string>;
146
+ };
147
+
148
+ export type GetHealthCheckData = {
149
+ body?: never;
150
+ path?: never;
151
+ query?: never;
152
+ url: '/health-check';
153
+ };
154
+
155
+ export type GetHealthCheckErrors = {
156
+ /**
157
+ * Internal server error.
158
+ */
159
+ 500: ErrorResponse;
160
+ };
161
+
162
+ export type GetHealthCheckError = GetHealthCheckErrors[keyof GetHealthCheckErrors];
163
+
164
+ export type GetHealthCheckResponses = {
165
+ /**
166
+ * Service is alive.
167
+ */
168
+ 200: OperationalStatus;
169
+ };
170
+
171
+ export type GetHealthCheckResponse = GetHealthCheckResponses[keyof GetHealthCheckResponses];
172
+
173
+ export type GetReadinessData = {
174
+ body?: never;
175
+ path?: never;
176
+ query?: never;
177
+ url: '/readiness';
178
+ };
179
+
180
+ export type GetReadinessErrors = {
181
+ /**
182
+ * Internal server error.
183
+ */
184
+ 500: ErrorResponse;
185
+ };
186
+
187
+ export type GetReadinessError = GetReadinessErrors[keyof GetReadinessErrors];
188
+
189
+ export type GetReadinessResponses = {
190
+ /**
191
+ * Service is ready.
192
+ */
193
+ 200: OperationalStatus;
194
+ };
195
+
196
+ export type GetReadinessResponse = GetReadinessResponses[keyof GetReadinessResponses];
197
+
198
+ export type ListDistributionsData = {
199
+ body?: never;
200
+ path: {
201
+ /**
202
+ * Polygon network the distribution covers. `mainnet` is PoS mainnet, `amoy` is the PoS testnet.
203
+ */
204
+ network: 'mainnet' | 'amoy';
205
+ };
206
+ query?: {
207
+ cursor?: string;
208
+ limit?: number;
209
+ };
210
+ url: '/v1/{network}/distributions';
211
+ };
212
+
213
+ export type ListDistributionsErrors = {
214
+ /**
215
+ * Invalid pagination cursor (`info.code: "INVALID_CURSOR"`) or request failed schema validation.
216
+ */
217
+ 400: ErrorResponse;
218
+ /**
219
+ * Internal server error.
220
+ */
221
+ 500: ErrorResponse;
222
+ };
223
+
224
+ export type ListDistributionsError = ListDistributionsErrors[keyof ListDistributionsErrors];
225
+
226
+ export type ListDistributionsResponses = {
227
+ /**
228
+ * Page of distribution summaries.
229
+ */
230
+ 200: DistributionListResponse;
231
+ };
232
+
233
+ export type ListDistributionsResponse = ListDistributionsResponses[keyof ListDistributionsResponses];
234
+
235
+ export type GetDistributionData = {
236
+ body?: never;
237
+ path: {
238
+ /**
239
+ * Polygon network the distribution covers. `mainnet` is PoS mainnet, `amoy` is the PoS testnet.
240
+ */
241
+ network: 'mainnet' | 'amoy';
242
+ distributionId: string;
243
+ };
244
+ query?: never;
245
+ url: '/v1/{network}/distributions/{distributionId}';
246
+ };
247
+
248
+ export type GetDistributionErrors = {
249
+ /**
250
+ * Request failed schema validation.
251
+ */
252
+ 400: ValidationErrorResponse;
253
+ /**
254
+ * Distribution not found or not yet completed.
255
+ */
256
+ 404: ErrorResponse;
257
+ /**
258
+ * Internal server error.
259
+ */
260
+ 500: ErrorResponse;
261
+ };
262
+
263
+ export type GetDistributionError = GetDistributionErrors[keyof GetDistributionErrors];
264
+
265
+ export type GetDistributionResponses = {
266
+ /**
267
+ * Distribution detail.
268
+ */
269
+ 200: DistributionDetail;
270
+ };
271
+
272
+ export type GetDistributionResponse = GetDistributionResponses[keyof GetDistributionResponses];
273
+
274
+ export type ListAllocationsData = {
275
+ body?: never;
276
+ path: {
277
+ /**
278
+ * Polygon network the distribution covers. `mainnet` is PoS mainnet, `amoy` is the PoS testnet.
279
+ */
280
+ network: 'mainnet' | 'amoy';
281
+ distributionId: string;
282
+ };
283
+ query?: {
284
+ cursor?: string;
285
+ limit?: number;
286
+ };
287
+ url: '/v1/{network}/distributions/{distributionId}/allocations';
288
+ };
289
+
290
+ export type ListAllocationsErrors = {
291
+ /**
292
+ * Invalid pagination cursor (`info.code: "INVALID_CURSOR"`) or request failed schema validation.
293
+ */
294
+ 400: ErrorResponse;
295
+ /**
296
+ * Distribution not found or not yet completed.
297
+ */
298
+ 404: ErrorResponse;
299
+ /**
300
+ * Internal server error.
301
+ */
302
+ 500: ErrorResponse;
303
+ };
304
+
305
+ export type ListAllocationsError = ListAllocationsErrors[keyof ListAllocationsErrors];
306
+
307
+ export type ListAllocationsResponses = {
308
+ /**
309
+ * Page of allocation rows.
310
+ */
311
+ 200: AllocationListResponse;
312
+ };
313
+
314
+ export type ListAllocationsResponse = ListAllocationsResponses[keyof ListAllocationsResponses];
315
+
316
+ export type ListExcludedAllocationsData = {
317
+ body?: never;
318
+ path: {
319
+ /**
320
+ * Polygon network the distribution covers. `mainnet` is PoS mainnet, `amoy` is the PoS testnet.
321
+ */
322
+ network: 'mainnet' | 'amoy';
323
+ distributionId: string;
324
+ };
325
+ query?: never;
326
+ url: '/v1/{network}/distributions/{distributionId}/excluded-allocations';
327
+ };
328
+
329
+ export type ListExcludedAllocationsErrors = {
330
+ /**
331
+ * Request failed schema validation.
332
+ */
333
+ 400: ValidationErrorResponse;
334
+ /**
335
+ * Distribution not found or not yet completed.
336
+ */
337
+ 404: ErrorResponse;
338
+ /**
339
+ * Internal server error.
340
+ */
341
+ 500: ErrorResponse;
342
+ };
343
+
344
+ export type ListExcludedAllocationsError = ListExcludedAllocationsErrors[keyof ListExcludedAllocationsErrors];
345
+
346
+ export type ListExcludedAllocationsResponses = {
347
+ /**
348
+ * The off-chain allocation set.
349
+ */
350
+ 200: ExcludedAllocationsResponse;
351
+ };
352
+
353
+ export type ListExcludedAllocationsResponse = ListExcludedAllocationsResponses[keyof ListExcludedAllocationsResponses];
354
+
355
+ export type GetAllocationData = {
356
+ body?: never;
357
+ path: {
358
+ /**
359
+ * Polygon network the distribution covers. `mainnet` is PoS mainnet, `amoy` is the PoS testnet.
360
+ */
361
+ network: 'mainnet' | 'amoy';
362
+ distributionId: string;
363
+ address: string;
364
+ };
365
+ query?: never;
366
+ url: '/v1/{network}/distributions/{distributionId}/allocations/{address}';
367
+ };
368
+
369
+ export type GetAllocationErrors = {
370
+ /**
371
+ * Request failed schema validation.
372
+ */
373
+ 400: ValidationErrorResponse;
374
+ /**
375
+ * Distribution or allocation not found.
376
+ */
377
+ 404: ErrorResponse;
378
+ /**
379
+ * Internal server error.
380
+ */
381
+ 500: ErrorResponse;
382
+ };
383
+
384
+ export type GetAllocationError = GetAllocationErrors[keyof GetAllocationErrors];
385
+
386
+ export type GetAllocationResponses = {
387
+ /**
388
+ * Allocation row.
389
+ */
390
+ 200: AllocationRow;
391
+ };
392
+
393
+ export type GetAllocationResponse = GetAllocationResponses[keyof GetAllocationResponses];
394
+
395
+ export type GetAddressAllocationHistoryData = {
396
+ body?: never;
397
+ path: {
398
+ /**
399
+ * Polygon network the distribution covers. `mainnet` is PoS mainnet, `amoy` is the PoS testnet.
400
+ */
401
+ network: 'mainnet' | 'amoy';
402
+ address: string;
403
+ };
404
+ query?: never;
405
+ url: '/v1/{network}/addresses/{address}/allocations';
406
+ };
407
+
408
+ export type GetAddressAllocationHistoryErrors = {
409
+ /**
410
+ * Request failed schema validation.
411
+ */
412
+ 400: ValidationErrorResponse;
413
+ /**
414
+ * Internal server error.
415
+ */
416
+ 500: ErrorResponse;
417
+ };
418
+
419
+ export type GetAddressAllocationHistoryError = GetAddressAllocationHistoryErrors[keyof GetAddressAllocationHistoryErrors];
420
+
421
+ export type GetAddressAllocationHistoryResponses = {
422
+ /**
423
+ * History rows ordered most-recently-completed first.
424
+ */
425
+ 200: AllocationHistoryResponse;
426
+ };
427
+
428
+ export type GetAddressAllocationHistoryResponse = GetAddressAllocationHistoryResponses[keyof GetAddressAllocationHistoryResponses];
429
+
430
+ export type GetUnclaimedProofsData = {
431
+ body?: never;
432
+ path: {
433
+ /**
434
+ * Polygon network the distribution covers. `mainnet` is PoS mainnet, `amoy` is the PoS testnet.
435
+ */
436
+ network: 'mainnet' | 'amoy';
437
+ address: string;
438
+ };
439
+ query?: never;
440
+ url: '/v1/{network}/addresses/{address}/unclaimed-proofs';
441
+ };
442
+
443
+ export type GetUnclaimedProofsErrors = {
444
+ /**
445
+ * Request failed schema validation.
446
+ */
447
+ 400: ValidationErrorResponse;
448
+ /**
449
+ * Internal server error.
450
+ */
451
+ 500: ErrorResponse;
452
+ };
453
+
454
+ export type GetUnclaimedProofsError = GetUnclaimedProofsErrors[keyof GetUnclaimedProofsErrors];
455
+
456
+ export type GetUnclaimedProofsResponses = {
457
+ /**
458
+ * Batch of unclaimed-proof entries ordered oldest-distribution first.
459
+ */
460
+ 200: UnclaimedProofsResponse;
461
+ };
462
+
463
+ export type GetUnclaimedProofsResponse = GetUnclaimedProofsResponses[keyof GetUnclaimedProofsResponses];
464
+
465
+ export type GetProofData = {
466
+ body?: never;
467
+ path: {
468
+ /**
469
+ * Polygon network the distribution covers. `mainnet` is PoS mainnet, `amoy` is the PoS testnet.
470
+ */
471
+ network: 'mainnet' | 'amoy';
472
+ distributionId: string;
473
+ address: string;
474
+ };
475
+ query?: never;
476
+ url: '/v1/{network}/distributions/{distributionId}/allocations/{address}/proof';
477
+ };
478
+
479
+ export type GetProofErrors = {
480
+ /**
481
+ * Request failed schema validation.
482
+ */
483
+ 400: ValidationErrorResponse;
484
+ /**
485
+ * Distribution not found, not yet completed, address has no allocation, or the allocation is excluded from the tree (settled off-chain).
486
+ */
487
+ 404: ErrorResponse;
488
+ /**
489
+ * Internal server error.
490
+ */
491
+ 500: ErrorResponse;
492
+ };
493
+
494
+ export type GetProofError = GetProofErrors[keyof GetProofErrors];
495
+
496
+ export type GetProofResponses = {
497
+ /**
498
+ * Proof bundle ready to submit to the claimer contract.
499
+ */
500
+ 200: ProofResponse;
501
+ };
502
+
503
+ export type GetProofResponse = GetProofResponses[keyof GetProofResponses];
package/src/index.ts ADDED
@@ -0,0 +1,68 @@
1
+ // Public surface for @polygonlabs/staker-pool-allocations-client.
2
+ //
3
+ // Everything in `./generated/` is regenerated by `pnpm run generate` from
4
+ // the registered Zod schemas in `@polygonlabs/staker-pool-allocations-schemas`
5
+ // (the same values the service validates responses against), so there is no
6
+ // rename layer to drift. The hand-written barrel below imports only from
7
+ // `./generated/index.js` — the auto-barrel that
8
+ // `@polygonlabs/zod-to-openapi-heyapi`'s `defineRegistryClientConfig` keeps
9
+ // complete:
10
+ //
11
+ // - `client` for `client.setConfig({ baseUrl })` at app entry
12
+ // - Every SDK wrapper (`listDistributions`, `getProof`, …) — each runs the
13
+ // schemas package's `parseAsync` on the response body before returning
14
+ // - The `TransportError` / `ResponseValidationError` classes plus their
15
+ // `is*Error` type-predicate guards for canonical narrowing
16
+ // - `WrapErrors<TData, TError, ThrowOnError>` — the wrapper's statically
17
+ // widened return type, surfaced for typed-error narrowing
18
+ //
19
+ // React-flavoured TanStack Query options factories (`getProofOptions`,
20
+ // `listDistributionsInfiniteOptions`, …) live in the `./react` subpath
21
+ // export so consumers that don't need React don't pay the
22
+ // @tanstack/react-query peer-dep cost.
23
+ //
24
+ // For advanced setups that need more than the singleton client — multiple
25
+ // instances pointing at different base URLs, per-request config in SSR, a
26
+ // custom fetch adapter — import `createClient` and `createConfig` from the
27
+ // `./factory` subpath:
28
+ //
29
+ // import { createClient, createConfig } from '@polygonlabs/staker-pool-allocations-client/factory';
30
+ // const myClient = createClient(createConfig({ baseUrl, fetch: customFetch }));
31
+ // await listDistributions({ client: myClient, path: { network: 'mainnet' } });
32
+ export {
33
+ client,
34
+ getAddressAllocationHistory,
35
+ type GetAddressAllocationHistoryError,
36
+ type GetAddressAllocationHistoryResponse,
37
+ getAllocation,
38
+ type GetAllocationError,
39
+ type GetAllocationResponse,
40
+ getDistribution,
41
+ type GetDistributionError,
42
+ type GetDistributionResponse,
43
+ getHealthCheck,
44
+ type GetHealthCheckResponse,
45
+ getProof,
46
+ type GetProofError,
47
+ type GetProofResponse,
48
+ getReadiness,
49
+ type GetReadinessResponse,
50
+ getUnclaimedProofs,
51
+ type GetUnclaimedProofsError,
52
+ type GetUnclaimedProofsResponse,
53
+ isResponseValidationError,
54
+ isTransportError,
55
+ isWrapperError,
56
+ listAllocations,
57
+ type ListAllocationsError,
58
+ type ListAllocationsResponse,
59
+ listDistributions,
60
+ type ListDistributionsError,
61
+ type ListDistributionsResponse,
62
+ listExcludedAllocations,
63
+ type ListExcludedAllocationsError,
64
+ type ListExcludedAllocationsResponse,
65
+ ResponseValidationError,
66
+ TransportError,
67
+ type WrapErrors
68
+ } from './generated/index.js';