@polygonlabs/staker-pool-allocations-schemas 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 (114) hide show
  1. package/MIGRATION.md +5 -0
  2. package/dist/allocation-history.d.ts +30 -0
  3. package/dist/allocation-history.d.ts.map +1 -0
  4. package/dist/allocation-history.js +29 -0
  5. package/dist/allocation-history.js.map +1 -0
  6. package/dist/allocation.d.ts +31 -0
  7. package/dist/allocation.d.ts.map +1 -0
  8. package/dist/allocation.js +40 -0
  9. package/dist/allocation.js.map +1 -0
  10. package/dist/codegen.d.ts +6 -0
  11. package/dist/codegen.d.ts.map +1 -0
  12. package/dist/codegen.js +32 -0
  13. package/dist/codegen.js.map +1 -0
  14. package/dist/common.d.ts +19 -0
  15. package/dist/common.d.ts.map +1 -0
  16. package/dist/common.js +63 -0
  17. package/dist/common.js.map +1 -0
  18. package/dist/distribution.d.ts +60 -0
  19. package/dist/distribution.d.ts.map +1 -0
  20. package/dist/distribution.js +43 -0
  21. package/dist/distribution.js.map +1 -0
  22. package/dist/error.d.ts +10 -0
  23. package/dist/error.d.ts.map +1 -0
  24. package/dist/error.js +15 -0
  25. package/dist/error.js.map +1 -0
  26. package/dist/index.d.ts +13 -0
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/index.js +17 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/management.d.ts +80 -0
  31. package/dist/management.d.ts.map +1 -0
  32. package/dist/management.js +126 -0
  33. package/dist/management.js.map +1 -0
  34. package/dist/proof.d.ts +10 -0
  35. package/dist/proof.d.ts.map +1 -0
  36. package/dist/proof.js +25 -0
  37. package/dist/proof.js.map +1 -0
  38. package/dist/registry-management.d.ts +525 -0
  39. package/dist/registry-management.d.ts.map +1 -0
  40. package/dist/registry-management.js +33 -0
  41. package/dist/registry-management.js.map +1 -0
  42. package/dist/registry-public.d.ts +1323 -0
  43. package/dist/registry-public.d.ts.map +1 -0
  44. package/dist/registry-public.js +31 -0
  45. package/dist/registry-public.js.map +1 -0
  46. package/dist/routes-management/distributions.d.ts +137 -0
  47. package/dist/routes-management/distributions.d.ts.map +1 -0
  48. package/dist/routes-management/distributions.js +72 -0
  49. package/dist/routes-management/distributions.js.map +1 -0
  50. package/dist/routes-management/excluded-addresses.d.ts +132 -0
  51. package/dist/routes-management/excluded-addresses.d.ts.map +1 -0
  52. package/dist/routes-management/excluded-addresses.js +84 -0
  53. package/dist/routes-management/excluded-addresses.js.map +1 -0
  54. package/dist/routes-management/operational.d.ts +48 -0
  55. package/dist/routes-management/operational.d.ts.map +1 -0
  56. package/dist/routes-management/operational.js +47 -0
  57. package/dist/routes-management/operational.js.map +1 -0
  58. package/dist/routes-public/addresses.d.ts +79 -0
  59. package/dist/routes-public/addresses.d.ts.map +1 -0
  60. package/dist/routes-public/addresses.js +45 -0
  61. package/dist/routes-public/addresses.js.map +1 -0
  62. package/dist/routes-public/allocations.d.ts +155 -0
  63. package/dist/routes-public/allocations.d.ts.map +1 -0
  64. package/dist/routes-public/allocations.js +81 -0
  65. package/dist/routes-public/allocations.js.map +1 -0
  66. package/dist/routes-public/distributions.d.ts +123 -0
  67. package/dist/routes-public/distributions.d.ts.map +1 -0
  68. package/dist/routes-public/distributions.js +55 -0
  69. package/dist/routes-public/distributions.js.map +1 -0
  70. package/dist/routes-public/operational.d.ts +46 -0
  71. package/dist/routes-public/operational.d.ts.map +1 -0
  72. package/dist/routes-public/operational.js +36 -0
  73. package/dist/routes-public/operational.js.map +1 -0
  74. package/dist/routes-public/proofs.d.ts +50 -0
  75. package/dist/routes-public/proofs.d.ts.map +1 -0
  76. package/dist/routes-public/proofs.js +34 -0
  77. package/dist/routes-public/proofs.js.map +1 -0
  78. package/dist/routes-public/wire.d.ts +60 -0
  79. package/dist/routes-public/wire.d.ts.map +1 -0
  80. package/dist/routes-public/wire.js +62 -0
  81. package/dist/routes-public/wire.js.map +1 -0
  82. package/dist/tsconfig.lib.tsbuildinfo +1 -0
  83. package/dist/unclaimed-proofs.d.ts +20 -0
  84. package/dist/unclaimed-proofs.d.ts.map +1 -0
  85. package/dist/unclaimed-proofs.js +22 -0
  86. package/dist/unclaimed-proofs.js.map +1 -0
  87. package/dist/zod.d.ts +3 -0
  88. package/dist/zod.d.ts.map +1 -0
  89. package/dist/zod.js +8 -0
  90. package/dist/zod.js.map +1 -0
  91. package/openapi.json +1215 -0
  92. package/package.json +49 -0
  93. package/src/allocation-history.ts +35 -0
  94. package/src/allocation.ts +51 -0
  95. package/src/codegen.ts +50 -0
  96. package/src/common.ts +76 -0
  97. package/src/distribution.ts +52 -0
  98. package/src/error.ts +17 -0
  99. package/src/index.ts +16 -0
  100. package/src/management.ts +158 -0
  101. package/src/proof.ts +27 -0
  102. package/src/registry-management.ts +36 -0
  103. package/src/registry-public.ts +33 -0
  104. package/src/routes-management/distributions.ts +87 -0
  105. package/src/routes-management/excluded-addresses.ts +103 -0
  106. package/src/routes-management/operational.ts +60 -0
  107. package/src/routes-public/addresses.ts +58 -0
  108. package/src/routes-public/allocations.ts +104 -0
  109. package/src/routes-public/distributions.ts +69 -0
  110. package/src/routes-public/operational.ts +55 -0
  111. package/src/routes-public/proofs.ts +46 -0
  112. package/src/routes-public/wire.ts +74 -0
  113. package/src/unclaimed-proofs.ts +27 -0
  114. package/src/zod.ts +9 -0
@@ -0,0 +1,79 @@
1
+ import type { RouteWithOpId, TypedRegistry } from '@polygonlabs/openapi-registry';
2
+ import { z } from '../zod.ts';
3
+ export declare const addAddressRoutes: <Ops extends Record<string, RouteWithOpId>, Schemes extends Record<string, true>>(r: TypedRegistry<Ops, Schemes>) => TypedRegistry<Ops & {
4
+ getAddressAllocationHistory: import("@polygonlabs/openapi-registry").MergedRoute<{
5
+ readonly operationId: "getAddressAllocationHistory";
6
+ readonly method: "get";
7
+ readonly path: "/v1/{network}/addresses/{address}/allocations";
8
+ readonly summary: "Per-address cross-distribution allocation history with live claim status";
9
+ readonly description: string;
10
+ readonly request: {
11
+ readonly params: z.ZodObject<{
12
+ network: z.ZodEnum<{
13
+ mainnet: "mainnet";
14
+ amoy: "amoy";
15
+ }>;
16
+ address: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
17
+ }, z.core.$strip>;
18
+ };
19
+ readonly responses: {
20
+ readonly 200: {
21
+ readonly description: "History rows ordered most-recently-completed first.";
22
+ readonly content: {
23
+ readonly 'application/json': {
24
+ readonly schema: z.ZodObject<{
25
+ items: z.ZodArray<z.ZodObject<{
26
+ address: z.ZodString;
27
+ distributionId: z.ZodString;
28
+ amount: z.ZodString;
29
+ leafIndex: z.ZodNullable<z.ZodNumber>;
30
+ merkleRoot: z.ZodString;
31
+ completedAt: z.ZodISODateTime;
32
+ status: z.ZodEnum<{
33
+ claimed: "claimed";
34
+ unclaimed: "unclaimed";
35
+ }>;
36
+ }, z.core.$strip>>;
37
+ }, z.core.$strip>;
38
+ };
39
+ };
40
+ };
41
+ };
42
+ }>;
43
+ } & {
44
+ getUnclaimedProofs: import("@polygonlabs/openapi-registry").MergedRoute<{
45
+ readonly operationId: "getUnclaimedProofs";
46
+ readonly method: "get";
47
+ readonly path: "/v1/{network}/addresses/{address}/unclaimed-proofs";
48
+ readonly summary: "Per-address unclaimed-proofs array — the primary claim-flow UI endpoint";
49
+ readonly description: string;
50
+ readonly request: {
51
+ readonly params: z.ZodObject<{
52
+ network: z.ZodEnum<{
53
+ mainnet: "mainnet";
54
+ amoy: "amoy";
55
+ }>;
56
+ address: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
57
+ }, z.core.$strip>;
58
+ };
59
+ readonly responses: {
60
+ readonly 200: {
61
+ readonly description: "Batch of unclaimed-proof entries ordered oldest-distribution first.";
62
+ readonly content: {
63
+ readonly 'application/json': {
64
+ readonly schema: z.ZodObject<{
65
+ items: z.ZodArray<z.ZodObject<{
66
+ distributionId: z.ZodString;
67
+ merkleRoot: z.ZodString;
68
+ amount: z.ZodString;
69
+ leafIndex: z.ZodNumber;
70
+ proof: z.ZodArray<z.ZodString>;
71
+ }, z.core.$strip>>;
72
+ }, z.core.$strip>;
73
+ };
74
+ };
75
+ };
76
+ };
77
+ }>;
78
+ }, Schemes>;
79
+ //# sourceMappingURL=addresses.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addresses.d.ts","sourceRoot":"","sources":["../../src/routes-public/addresses.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAIlF,OAAO,EAAE,CAAC,EAAE,MAAM,WAAW,CAAC;AAG9B,eAAO,MAAM,gBAAgB,GAC3B,GAAG,SAAS,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,EACzC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,EAEpC,GAAG,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WA2C1B,CAAC"}
@@ -0,0 +1,45 @@
1
+ import { AddressSchema, NetworkSchema } from "../common.js";
2
+ import { UnclaimedProofsResponseSchema } from "../unclaimed-proofs.js";
3
+ import { z } from "../zod.js";
4
+ import { AllocationHistoryResponseWireSchema } from "./wire.js";
5
+ export const addAddressRoutes = (r) => r
6
+ .registerPath({
7
+ operationId: 'getAddressAllocationHistory',
8
+ method: 'get',
9
+ path: '/v1/{network}/addresses/{address}/allocations',
10
+ summary: 'Per-address cross-distribution allocation history with live claim status',
11
+ description: 'Returns every allocation row for the given address across all completed ' +
12
+ 'distributions on the network, enriched with `status: "claimed" | "unclaimed"` ' +
13
+ 'derived live at request time by querying the pos-staker-pool-claims subgraph ' +
14
+ '(spec §3.6, D10). Empty array if the address never qualified.',
15
+ request: {
16
+ params: z.object({ network: NetworkSchema, address: AddressSchema })
17
+ },
18
+ responses: {
19
+ 200: {
20
+ description: 'History rows ordered most-recently-completed first.',
21
+ content: { 'application/json': { schema: AllocationHistoryResponseWireSchema } }
22
+ }
23
+ }
24
+ })
25
+ .registerPath({
26
+ operationId: 'getUnclaimedProofs',
27
+ method: 'get',
28
+ path: '/v1/{network}/addresses/{address}/unclaimed-proofs',
29
+ summary: 'Per-address unclaimed-proofs array — the primary claim-flow UI endpoint',
30
+ description: "Returns the address's outstanding allocations with merkle proofs ready to " +
31
+ 'submit to the claimer contract in one batched transaction. Proof generation is ' +
32
+ 'on demand from the persisted leaves (spec D9); the in-memory tree cache absorbs ' +
33
+ 'repeat calls for the same distribution. Empty array if every allocation has been ' +
34
+ 'claimed (or the address has none).',
35
+ request: {
36
+ params: z.object({ network: NetworkSchema, address: AddressSchema })
37
+ },
38
+ responses: {
39
+ 200: {
40
+ description: 'Batch of unclaimed-proof entries ordered oldest-distribution first.',
41
+ content: { 'application/json': { schema: UnclaimedProofsResponseSchema } }
42
+ }
43
+ }
44
+ });
45
+ //# sourceMappingURL=addresses.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addresses.js","sourceRoot":"","sources":["../../src/routes-public/addresses.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,CAAC,EAAE,MAAM,WAAW,CAAC;AAC9B,OAAO,EAAE,mCAAmC,EAAE,MAAM,WAAW,CAAC;AAEhE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAI9B,CAA8B,EAC9B,EAAE,CACF,CAAC;KACE,YAAY,CAAC;IACZ,WAAW,EAAE,6BAA6B;IAC1C,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,+CAA+C;IACrD,OAAO,EAAE,0EAA0E;IACnF,WAAW,EACT,0EAA0E;QAC1E,gFAAgF;QAChF,+EAA+E;QAC/E,+DAA+D;IACjE,OAAO,EAAE;QACP,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC;KACrE;IACD,SAAS,EAAE;QACT,GAAG,EAAE;YACH,WAAW,EAAE,qDAAqD;YAClE,OAAO,EAAE,EAAE,kBAAkB,EAAE,EAAE,MAAM,EAAE,mCAAmC,EAAE,EAAE;SACjF;KACF;CACF,CAAC;KACD,YAAY,CAAC;IACZ,WAAW,EAAE,oBAAoB;IACjC,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,oDAAoD;IAC1D,OAAO,EAAE,yEAAyE;IAClF,WAAW,EACT,4EAA4E;QAC5E,iFAAiF;QACjF,kFAAkF;QAClF,mFAAmF;QACnF,oCAAoC;IACtC,OAAO,EAAE;QACP,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC;KACrE;IACD,SAAS,EAAE;QACT,GAAG,EAAE;YACH,WAAW,EAAE,qEAAqE;YAClF,OAAO,EAAE,EAAE,kBAAkB,EAAE,EAAE,MAAM,EAAE,6BAA6B,EAAE,EAAE;SAC3E;KACF;CACF,CAAC,CAAC"}
@@ -0,0 +1,155 @@
1
+ import type { RouteWithOpId, TypedRegistry } from '@polygonlabs/openapi-registry';
2
+ import { z } from '../zod.ts';
3
+ export declare const addAllocationRoutes: <Ops extends Record<string, RouteWithOpId>, Schemes extends Record<string, true>>(r: TypedRegistry<Ops, Schemes>) => TypedRegistry<Ops & {
4
+ listAllocations: import("@polygonlabs/openapi-registry").MergedRoute<{
5
+ readonly operationId: "listAllocations";
6
+ readonly method: "get";
7
+ readonly path: "/v1/{network}/distributions/{distributionId}/allocations";
8
+ readonly summary: "List allocations for a completed distribution";
9
+ readonly description: "Paginated by `leafIndex` ascending.";
10
+ readonly request: {
11
+ readonly params: z.ZodObject<{
12
+ network: z.ZodEnum<{
13
+ mainnet: "mainnet";
14
+ amoy: "amoy";
15
+ }>;
16
+ distributionId: z.ZodString;
17
+ }, z.core.$strip>;
18
+ readonly query: z.ZodObject<{
19
+ cursor: z.ZodOptional<z.ZodString>;
20
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
21
+ }, z.core.$strip>;
22
+ };
23
+ readonly responses: {
24
+ readonly 200: {
25
+ readonly description: "Page of allocation rows.";
26
+ readonly content: {
27
+ readonly 'application/json': {
28
+ readonly schema: z.ZodObject<{
29
+ items: z.ZodArray<z.ZodObject<{
30
+ address: z.ZodString;
31
+ amount: z.ZodString;
32
+ leafIndex: z.ZodNullable<z.ZodNumber>;
33
+ }, z.core.$strip>>;
34
+ nextCursor: z.ZodNullable<z.ZodString>;
35
+ }, z.core.$strip>;
36
+ };
37
+ };
38
+ };
39
+ readonly 400: {
40
+ readonly description: string;
41
+ readonly content: {
42
+ readonly 'application/json': {
43
+ readonly schema: z.ZodObject<{
44
+ error: z.ZodLiteral<true>;
45
+ message: z.ZodString;
46
+ info: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
47
+ }, z.core.$strip>;
48
+ };
49
+ };
50
+ };
51
+ readonly 404: {
52
+ readonly description: "Distribution not found or not yet completed.";
53
+ readonly content: {
54
+ readonly 'application/json': {
55
+ readonly schema: z.ZodObject<{
56
+ error: z.ZodLiteral<true>;
57
+ message: z.ZodString;
58
+ info: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
59
+ }, z.core.$strip>;
60
+ };
61
+ };
62
+ };
63
+ };
64
+ }>;
65
+ } & {
66
+ listExcludedAllocations: import("@polygonlabs/openapi-registry").MergedRoute<{
67
+ readonly operationId: "listExcludedAllocations";
68
+ readonly method: "get";
69
+ readonly path: "/v1/{network}/distributions/{distributionId}/excluded-allocations";
70
+ readonly summary: "List off-chain (merkle-excluded) allocations for a distribution";
71
+ readonly description: string;
72
+ readonly request: {
73
+ readonly params: z.ZodObject<{
74
+ network: z.ZodEnum<{
75
+ mainnet: "mainnet";
76
+ amoy: "amoy";
77
+ }>;
78
+ distributionId: z.ZodString;
79
+ }, z.core.$strip>;
80
+ };
81
+ readonly responses: {
82
+ readonly 200: {
83
+ readonly description: "The off-chain allocation set.";
84
+ readonly content: {
85
+ readonly 'application/json': {
86
+ readonly schema: z.ZodObject<{
87
+ items: z.ZodArray<z.ZodObject<{
88
+ address: z.ZodString;
89
+ amount: z.ZodString;
90
+ }, z.core.$strip>>;
91
+ total: z.ZodNumber;
92
+ totalAmount: z.ZodString;
93
+ }, z.core.$strip>;
94
+ };
95
+ };
96
+ };
97
+ readonly 404: {
98
+ readonly description: "Distribution not found or not yet completed.";
99
+ readonly content: {
100
+ readonly 'application/json': {
101
+ readonly schema: z.ZodObject<{
102
+ error: z.ZodLiteral<true>;
103
+ message: z.ZodString;
104
+ info: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
105
+ }, z.core.$strip>;
106
+ };
107
+ };
108
+ };
109
+ };
110
+ }>;
111
+ } & {
112
+ getAllocation: import("@polygonlabs/openapi-registry").MergedRoute<{
113
+ readonly operationId: "getAllocation";
114
+ readonly method: "get";
115
+ readonly path: "/v1/{network}/distributions/{distributionId}/allocations/{address}";
116
+ readonly summary: "Get a single address allocation in a distribution";
117
+ readonly request: {
118
+ readonly params: z.ZodObject<{
119
+ network: z.ZodEnum<{
120
+ mainnet: "mainnet";
121
+ amoy: "amoy";
122
+ }>;
123
+ distributionId: z.ZodString;
124
+ address: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
125
+ }, z.core.$strip>;
126
+ };
127
+ readonly responses: {
128
+ readonly 200: {
129
+ readonly description: "Allocation row.";
130
+ readonly content: {
131
+ readonly 'application/json': {
132
+ readonly schema: z.ZodObject<{
133
+ address: z.ZodString;
134
+ amount: z.ZodString;
135
+ leafIndex: z.ZodNullable<z.ZodNumber>;
136
+ }, z.core.$strip>;
137
+ };
138
+ };
139
+ };
140
+ readonly 404: {
141
+ readonly description: "Distribution or allocation not found.";
142
+ readonly content: {
143
+ readonly 'application/json': {
144
+ readonly schema: z.ZodObject<{
145
+ error: z.ZodLiteral<true>;
146
+ message: z.ZodString;
147
+ info: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
148
+ }, z.core.$strip>;
149
+ };
150
+ };
151
+ };
152
+ };
153
+ }>;
154
+ }, Schemes>;
155
+ //# sourceMappingURL=allocations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"allocations.d.ts","sourceRoot":"","sources":["../../src/routes-public/allocations.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAUlF,OAAO,EAAE,CAAC,EAAE,MAAM,WAAW,CAAC;AAO9B,eAAO,MAAM,mBAAmB,GAC9B,GAAG,SAAS,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,EACzC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,EAEpC,GAAG,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WA+E1B,CAAC"}
@@ -0,0 +1,81 @@
1
+ import { ErrorResponseSchema } from '@polygonlabs/openapi-registry/error-schemas';
2
+ import { AddressSchema, DistributionIdSchema, NetworkSchema, PaginationQuerySchema } from "../common.js";
3
+ import { z } from "../zod.js";
4
+ import { AllocationListResponseWireSchema, AllocationRowWireSchema, ExcludedAllocationsResponseWireSchema } from "./wire.js";
5
+ export const addAllocationRoutes = (r) => r
6
+ .registerPath({
7
+ operationId: 'listAllocations',
8
+ method: 'get',
9
+ path: '/v1/{network}/distributions/{distributionId}/allocations',
10
+ summary: 'List allocations for a completed distribution',
11
+ description: 'Paginated by `leafIndex` ascending.',
12
+ request: {
13
+ params: z.object({ network: NetworkSchema, distributionId: DistributionIdSchema }),
14
+ query: PaginationQuerySchema
15
+ },
16
+ responses: {
17
+ 200: {
18
+ description: 'Page of allocation rows.',
19
+ content: { 'application/json': { schema: AllocationListResponseWireSchema } }
20
+ },
21
+ // Same 400 override rationale as `listDistributions`: the opaque
22
+ // cursor decodes in the handler and 400s with `info.code:
23
+ // 'INVALID_CURSOR'`, which the auto-injected ValidationErrorResponse
24
+ // shape would strip.
25
+ 400: {
26
+ description: 'Invalid pagination cursor (`info.code: "INVALID_CURSOR"`) or ' +
27
+ 'request failed schema validation.',
28
+ content: { 'application/json': { schema: ErrorResponseSchema } }
29
+ },
30
+ 404: {
31
+ description: 'Distribution not found or not yet completed.',
32
+ content: { 'application/json': { schema: ErrorResponseSchema } }
33
+ }
34
+ }
35
+ })
36
+ .registerPath({
37
+ operationId: 'listExcludedAllocations',
38
+ method: 'get',
39
+ path: '/v1/{network}/distributions/{distributionId}/excluded-allocations',
40
+ summary: 'List off-chain (merkle-excluded) allocations for a distribution',
41
+ description: 'Recipients allocated but excluded from the merkle tree (excluded addresses) — ' +
42
+ 'not claimable on-chain, settled manually. Not paginated (small bounded set). ' +
43
+ '`totalAmount` equals the distribution `total_allocated - claimable_total`.',
44
+ request: {
45
+ params: z.object({ network: NetworkSchema, distributionId: DistributionIdSchema })
46
+ },
47
+ responses: {
48
+ 200: {
49
+ description: 'The off-chain allocation set.',
50
+ content: { 'application/json': { schema: ExcludedAllocationsResponseWireSchema } }
51
+ },
52
+ 404: {
53
+ description: 'Distribution not found or not yet completed.',
54
+ content: { 'application/json': { schema: ErrorResponseSchema } }
55
+ }
56
+ }
57
+ })
58
+ .registerPath({
59
+ operationId: 'getAllocation',
60
+ method: 'get',
61
+ path: '/v1/{network}/distributions/{distributionId}/allocations/{address}',
62
+ summary: 'Get a single address allocation in a distribution',
63
+ request: {
64
+ params: z.object({
65
+ network: NetworkSchema,
66
+ distributionId: DistributionIdSchema,
67
+ address: AddressSchema
68
+ })
69
+ },
70
+ responses: {
71
+ 200: {
72
+ description: 'Allocation row.',
73
+ content: { 'application/json': { schema: AllocationRowWireSchema } }
74
+ },
75
+ 404: {
76
+ description: 'Distribution or allocation not found.',
77
+ content: { 'application/json': { schema: ErrorResponseSchema } }
78
+ }
79
+ }
80
+ });
81
+ //# sourceMappingURL=allocations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"allocations.js","sourceRoot":"","sources":["../../src/routes-public/allocations.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAElF,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,aAAa,EACb,qBAAqB,EACtB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,CAAC,EAAE,MAAM,WAAW,CAAC;AAC9B,OAAO,EACL,gCAAgC,EAChC,uBAAuB,EACvB,qCAAqC,EACtC,MAAM,WAAW,CAAC;AAEnB,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAIjC,CAA8B,EAC9B,EAAE,CACF,CAAC;KACE,YAAY,CAAC;IACZ,WAAW,EAAE,iBAAiB;IAC9B,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,0DAA0D;IAChE,OAAO,EAAE,+CAA+C;IACxD,WAAW,EAAE,qCAAqC;IAClD,OAAO,EAAE;QACP,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,oBAAoB,EAAE,CAAC;QAClF,KAAK,EAAE,qBAAqB;KAC7B;IACD,SAAS,EAAE;QACT,GAAG,EAAE;YACH,WAAW,EAAE,0BAA0B;YACvC,OAAO,EAAE,EAAE,kBAAkB,EAAE,EAAE,MAAM,EAAE,gCAAgC,EAAE,EAAE;SAC9E;QACD,iEAAiE;QACjE,0DAA0D;QAC1D,qEAAqE;QACrE,qBAAqB;QACrB,GAAG,EAAE;YACH,WAAW,EACT,+DAA+D;gBAC/D,mCAAmC;YACrC,OAAO,EAAE,EAAE,kBAAkB,EAAE,EAAE,MAAM,EAAE,mBAAm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BAAkB,EAAE,EAAE,MAAM,EAAE,mBAAmB,EAAE,EAAE;SACjE;KACF;CACF,CAAC,CAAC"}
@@ -0,0 +1,123 @@
1
+ import type { RouteWithOpId, TypedRegistry } from '@polygonlabs/openapi-registry';
2
+ import { z } from '../zod.ts';
3
+ export declare const addDistributionRoutes: <Ops extends Record<string, RouteWithOpId>, Schemes extends Record<string, true>>(r: TypedRegistry<Ops, Schemes>) => TypedRegistry<Ops & {
4
+ listDistributions: import("@polygonlabs/openapi-registry").MergedRoute<{
5
+ readonly operationId: "listDistributions";
6
+ readonly method: "get";
7
+ readonly path: "/v1/{network}/distributions";
8
+ readonly summary: "List completed distributions";
9
+ readonly description: string;
10
+ readonly request: {
11
+ readonly params: z.ZodObject<{
12
+ network: z.ZodEnum<{
13
+ mainnet: "mainnet";
14
+ amoy: "amoy";
15
+ }>;
16
+ }, z.core.$strip>;
17
+ readonly query: z.ZodObject<{
18
+ cursor: z.ZodOptional<z.ZodString>;
19
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
20
+ }, z.core.$strip>;
21
+ };
22
+ readonly responses: {
23
+ readonly 200: {
24
+ readonly description: "Page of distribution summaries.";
25
+ readonly content: {
26
+ readonly 'application/json': {
27
+ readonly schema: z.ZodObject<{
28
+ items: z.ZodArray<z.ZodObject<{
29
+ distributionId: z.ZodString;
30
+ status: z.ZodEnum<{
31
+ pending: "pending";
32
+ running: "running";
33
+ completed: "completed";
34
+ failed: "failed";
35
+ }>;
36
+ startPoSBlock: z.ZodString;
37
+ endPoSBlock: z.ZodString;
38
+ merkleRoot: z.ZodNullable<z.ZodString>;
39
+ totalAllocated: z.ZodNullable<z.ZodString>;
40
+ completedAt: z.ZodNullable<z.ZodISODateTime>;
41
+ }, z.core.$strip>>;
42
+ nextCursor: z.ZodNullable<z.ZodString>;
43
+ }, z.core.$strip>;
44
+ };
45
+ };
46
+ };
47
+ readonly 400: {
48
+ readonly description: string;
49
+ readonly content: {
50
+ readonly 'application/json': {
51
+ readonly schema: z.ZodObject<{
52
+ error: z.ZodLiteral<true>;
53
+ message: z.ZodString;
54
+ info: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
55
+ }, z.core.$strip>;
56
+ };
57
+ };
58
+ };
59
+ };
60
+ }>;
61
+ } & {
62
+ getDistribution: import("@polygonlabs/openapi-registry").MergedRoute<{
63
+ readonly operationId: "getDistribution";
64
+ readonly method: "get";
65
+ readonly path: "/v1/{network}/distributions/{distributionId}";
66
+ readonly summary: "Get a single completed distribution";
67
+ readonly request: {
68
+ readonly params: z.ZodObject<{
69
+ network: z.ZodEnum<{
70
+ mainnet: "mainnet";
71
+ amoy: "amoy";
72
+ }>;
73
+ distributionId: z.ZodString;
74
+ }, z.core.$strip>;
75
+ };
76
+ readonly responses: {
77
+ readonly 200: {
78
+ readonly description: "Distribution detail.";
79
+ readonly content: {
80
+ readonly 'application/json': {
81
+ readonly schema: z.ZodObject<{
82
+ distributionId: z.ZodString;
83
+ status: z.ZodEnum<{
84
+ pending: "pending";
85
+ running: "running";
86
+ completed: "completed";
87
+ failed: "failed";
88
+ }>;
89
+ startPoSBlock: z.ZodString;
90
+ endPoSBlock: z.ZodString;
91
+ merkleRoot: z.ZodNullable<z.ZodString>;
92
+ totalAllocated: z.ZodNullable<z.ZodString>;
93
+ completedAt: z.ZodNullable<z.ZodISODateTime>;
94
+ checkpointCount: z.ZodNumber;
95
+ polUsdPrice: z.ZodNullable<z.ZodString>;
96
+ maxClaimableUsdThreshold: z.ZodNullable<z.ZodString>;
97
+ inputsHash: z.ZodNullable<z.ZodString>;
98
+ posStakingSubgraphBlock: z.ZodNullable<z.ZodString>;
99
+ posStakingSubgraphHash: z.ZodNullable<z.ZodString>;
100
+ posCheckpointsSubgraphBlock: z.ZodNullable<z.ZodString>;
101
+ posCheckpointsSubgraphHash: z.ZodNullable<z.ZodString>;
102
+ posPriorityFeesSubgraphBlock: z.ZodNullable<z.ZodString>;
103
+ posPriorityFeesSubgraphHash: z.ZodNullable<z.ZodString>;
104
+ }, z.core.$strip>;
105
+ };
106
+ };
107
+ };
108
+ readonly 404: {
109
+ readonly description: "Distribution not found or not yet completed.";
110
+ readonly content: {
111
+ readonly 'application/json': {
112
+ readonly schema: z.ZodObject<{
113
+ error: z.ZodLiteral<true>;
114
+ message: z.ZodString;
115
+ info: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
116
+ }, z.core.$strip>;
117
+ };
118
+ };
119
+ };
120
+ };
121
+ }>;
122
+ }, Schemes>;
123
+ //# sourceMappingURL=distributions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"distributions.d.ts","sourceRoot":"","sources":["../../src/routes-public/distributions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAMlF,OAAO,EAAE,CAAC,EAAE,MAAM,WAAW,CAAC;AAE9B,eAAO,MAAM,qBAAqB,GAChC,GAAG,SAAS,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,EACzC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,EAEpC,GAAG,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAqD1B,CAAC"}
@@ -0,0 +1,55 @@
1
+ import { ErrorResponseSchema } from '@polygonlabs/openapi-registry/error-schemas';
2
+ import { DistributionIdSchema, NetworkSchema, PaginationQuerySchema } from "../common.js";
3
+ import { DistributionDetailSchema, DistributionListResponseSchema } from "../distribution.js";
4
+ import { z } from "../zod.js";
5
+ export const addDistributionRoutes = (r) => r
6
+ .registerPath({
7
+ operationId: 'listDistributions',
8
+ method: 'get',
9
+ path: '/v1/{network}/distributions',
10
+ summary: 'List completed distributions',
11
+ description: 'Paginated list of completed distributions, oldest first by id (e.g. `2026-04`). ' +
12
+ 'Non-completed rows are not surfaced on the public API.',
13
+ request: {
14
+ params: z.object({ network: NetworkSchema }),
15
+ query: PaginationQuerySchema
16
+ },
17
+ responses: {
18
+ 200: {
19
+ description: 'Page of distribution summaries.',
20
+ content: { 'application/json': { schema: DistributionListResponseSchema } }
21
+ },
22
+ // Override the auto-injected ValidationErrorResponse 400: this route
23
+ // also emits a handler-thrown `BadRequest` for an undecodable opaque
24
+ // cursor, whose `info` is `{ code: 'INVALID_CURSOR' }` rather than
25
+ // section-keyed validation trees. The generic ErrorResponse shape is
26
+ // the honest superset of both bodies — encoding the cursor body
27
+ // against the narrower ValidationErrorResponse would silently strip
28
+ // `info.code`.
29
+ 400: {
30
+ description: 'Invalid pagination cursor (`info.code: "INVALID_CURSOR"`) or ' +
31
+ 'request failed schema validation.',
32
+ content: { 'application/json': { schema: ErrorResponseSchema } }
33
+ }
34
+ }
35
+ })
36
+ .registerPath({
37
+ operationId: 'getDistribution',
38
+ method: 'get',
39
+ path: '/v1/{network}/distributions/{distributionId}',
40
+ summary: 'Get a single completed distribution',
41
+ request: {
42
+ params: z.object({ network: NetworkSchema, distributionId: DistributionIdSchema })
43
+ },
44
+ responses: {
45
+ 200: {
46
+ description: 'Distribution detail.',
47
+ content: { 'application/json': { schema: DistributionDetailSchema } }
48
+ },
49
+ 404: {
50
+ description: 'Distribution not found or not yet completed.',
51
+ content: { 'application/json': { schema: ErrorResponseSchema } }
52
+ }
53
+ }
54
+ });
55
+ //# sourceMappingURL=distributions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"distributions.js","sourceRoot":"","sources":["../../src/routes-public/distributions.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAElF,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAC1F,OAAO,EAAE,wBAAwB,EAAE,8BAA8B,EAA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,GAAG,EAAE;YACH,WAAW,EAAE,8CAA8C;YAC3D,OAAO,EAAE,EAAE,kBAAkB,EAAE,EAAE,MAAM,EAAE,mBAAmB,EAAE,EAAE;SACjE;KACF;CACF,CAAC,CAAC"}
@@ -0,0 +1,46 @@
1
+ import type { RouteWithOpId, TypedRegistry } from '@polygonlabs/openapi-registry';
2
+ import { z } from '../zod.ts';
3
+ export declare const OperationalStatusSchema: z.ZodObject<{
4
+ status: z.ZodLiteral<"ok">;
5
+ }, z.core.$strip>;
6
+ export declare const addOperationalRoutes: <Ops extends Record<string, RouteWithOpId>, Schemes extends Record<string, true>>(r: TypedRegistry<Ops, Schemes>) => TypedRegistry<Ops & {
7
+ getHealthCheck: import("@polygonlabs/openapi-registry").MergedRoute<{
8
+ readonly operationId: "getHealthCheck";
9
+ readonly method: "get";
10
+ readonly path: "/health-check";
11
+ readonly summary: "Liveness check (K8s probe)";
12
+ readonly responses: {
13
+ readonly 200: {
14
+ readonly description: "Service is alive.";
15
+ readonly content: {
16
+ readonly 'application/json': {
17
+ readonly schema: z.ZodObject<{
18
+ status: z.ZodLiteral<"ok">;
19
+ }, z.core.$strip>;
20
+ };
21
+ };
22
+ };
23
+ };
24
+ }>;
25
+ } & {
26
+ getReadiness: import("@polygonlabs/openapi-registry").MergedRoute<{
27
+ readonly operationId: "getReadiness";
28
+ readonly method: "get";
29
+ readonly path: "/readiness";
30
+ readonly summary: "Readiness check";
31
+ readonly description: string;
32
+ readonly responses: {
33
+ readonly 200: {
34
+ readonly description: "Service is ready.";
35
+ readonly content: {
36
+ readonly 'application/json': {
37
+ readonly schema: z.ZodObject<{
38
+ status: z.ZodLiteral<"ok">;
39
+ }, z.core.$strip>;
40
+ };
41
+ };
42
+ };
43
+ };
44
+ }>;
45
+ }, Schemes>;
46
+ //# sourceMappingURL=operational.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operational.d.ts","sourceRoot":"","sources":["../../src/routes-public/operational.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAElF,OAAO,EAAE,CAAC,EAAE,MAAM,WAAW,CAAC;AAI9B,eAAO,MAAM,uBAAuB;;iBAEL,CAAC;AAIhC,eAAO,MAAM,oBAAoB,GAC/B,GAAG,SAAS,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,EACzC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,EAEpC,GAAG,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WA6B1B,CAAC"}
@@ -0,0 +1,36 @@
1
+ import { z } from "../zod.js";
2
+ // Exported (and aliased to its registered name in the package barrel) so
3
+ // the @polygonlabs/zod-to-openapi-heyapi codegen audit can resolve it.
4
+ export const OperationalStatusSchema = z
5
+ .object({ status: z.literal('ok') })
6
+ .openapi('OperationalStatus');
7
+ // Generic over the parent's `Ops` and `Schemes` accumulators so the helper
8
+ // preserves everything registered before `.with(addOperationalRoutes)`.
9
+ export const addOperationalRoutes = (r) => r
10
+ .registerPath({
11
+ operationId: 'getHealthCheck',
12
+ method: 'get',
13
+ path: '/health-check',
14
+ summary: 'Liveness check (K8s probe)',
15
+ responses: {
16
+ 200: {
17
+ description: 'Service is alive.',
18
+ content: { 'application/json': { schema: OperationalStatusSchema } }
19
+ }
20
+ }
21
+ })
22
+ .registerPath({
23
+ operationId: 'getReadiness',
24
+ method: 'get',
25
+ path: '/readiness',
26
+ summary: 'Readiness check',
27
+ description: 'Distinguishes "fully ready" from "partially degraded but still serving". ' +
28
+ 'Currently a 200 stub — the real DB + subgraph reachability probe is outstanding work.',
29
+ responses: {
30
+ 200: {
31
+ description: 'Service is ready.',
32
+ content: { 'application/json': { schema: OperationalStatusSchema } }
33
+ }
34
+ }
35
+ });
36
+ //# sourceMappingURL=operational.js.map