@lodestar/api 1.20.0-dev.f6d3bce802 → 1.20.0-dev.fe23f68998

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 (228) hide show
  1. package/README.md +2 -2
  2. package/lib/beacon/client/beacon.d.ts +4 -3
  3. package/lib/beacon/client/beacon.js +3 -36
  4. package/lib/beacon/client/beacon.js.map +1 -1
  5. package/lib/beacon/client/config.d.ts +4 -3
  6. package/lib/beacon/client/config.js +3 -6
  7. package/lib/beacon/client/config.js.map +1 -1
  8. package/lib/beacon/client/debug.d.ts +4 -3
  9. package/lib/beacon/client/debug.js +4 -45
  10. package/lib/beacon/client/debug.js.map +1 -1
  11. package/lib/beacon/client/events.d.ts +5 -2
  12. package/lib/beacon/client/events.js +33 -35
  13. package/lib/beacon/client/events.js.map +1 -1
  14. package/lib/beacon/client/index.d.ts +6 -3
  15. package/lib/beacon/client/index.js +2 -2
  16. package/lib/beacon/client/index.js.map +1 -1
  17. package/lib/beacon/client/lightclient.d.ts +4 -3
  18. package/lib/beacon/client/lightclient.js +4 -7
  19. package/lib/beacon/client/lightclient.js.map +1 -1
  20. package/lib/beacon/client/lodestar.d.ts +4 -3
  21. package/lib/beacon/client/lodestar.js +4 -7
  22. package/lib/beacon/client/lodestar.js.map +1 -1
  23. package/lib/beacon/client/node.d.ts +4 -3
  24. package/lib/beacon/client/node.js +4 -7
  25. package/lib/beacon/client/node.js.map +1 -1
  26. package/lib/beacon/client/proof.d.ts +5 -4
  27. package/lib/beacon/client/proof.js +5 -61
  28. package/lib/beacon/client/proof.js.map +1 -1
  29. package/lib/beacon/client/validator.d.ts +4 -3
  30. package/lib/beacon/client/validator.js +4 -7
  31. package/lib/beacon/client/validator.js.map +1 -1
  32. package/lib/beacon/index.d.ts +5 -5
  33. package/lib/beacon/index.js.map +1 -1
  34. package/lib/beacon/routes/beacon/block.d.ts +286 -167
  35. package/lib/beacon/routes/beacon/block.js +317 -117
  36. package/lib/beacon/routes/beacon/block.js.map +1 -1
  37. package/lib/beacon/routes/beacon/index.d.ts +6 -588
  38. package/lib/beacon/routes/beacon/index.js +16 -26
  39. package/lib/beacon/routes/beacon/index.js.map +1 -1
  40. package/lib/beacon/routes/beacon/pool.d.ts +155 -117
  41. package/lib/beacon/routes/beacon/pool.js +146 -42
  42. package/lib/beacon/routes/beacon/pool.js.map +1 -1
  43. package/lib/beacon/routes/beacon/rewards.d.ts +113 -101
  44. package/lib/beacon/routes/beacon/rewards.js +98 -63
  45. package/lib/beacon/routes/beacon/rewards.js.map +1 -1
  46. package/lib/beacon/routes/beacon/state.d.ts +172 -226
  47. package/lib/beacon/routes/beacon/state.js +204 -126
  48. package/lib/beacon/routes/beacon/state.js.map +1 -1
  49. package/lib/beacon/routes/config.d.ts +21 -36
  50. package/lib/beacon/routes/config.js +45 -24
  51. package/lib/beacon/routes/config.js.map +1 -1
  52. package/lib/beacon/routes/debug.d.ts +22 -104
  53. package/lib/beacon/routes/debug.js +53 -45
  54. package/lib/beacon/routes/debug.js.map +1 -1
  55. package/lib/beacon/routes/events.d.ts +24 -20
  56. package/lib/beacon/routes/events.js +40 -18
  57. package/lib/beacon/routes/events.js.map +1 -1
  58. package/lib/beacon/routes/index.d.ts +19 -19
  59. package/lib/beacon/routes/index.js +1 -0
  60. package/lib/beacon/routes/index.js.map +1 -1
  61. package/lib/beacon/routes/lightclient.d.ts +34 -56
  62. package/lib/beacon/routes/lightclient.js +108 -48
  63. package/lib/beacon/routes/lightclient.js.map +1 -1
  64. package/lib/beacon/routes/lodestar.d.ts +74 -148
  65. package/lib/beacon/routes/lodestar.js +126 -77
  66. package/lib/beacon/routes/lodestar.js.map +1 -1
  67. package/lib/beacon/routes/node.d.ts +48 -82
  68. package/lib/beacon/routes/node.js +90 -57
  69. package/lib/beacon/routes/node.js.map +1 -1
  70. package/lib/beacon/routes/proof.d.ts +25 -31
  71. package/lib/beacon/routes/proof.js +44 -24
  72. package/lib/beacon/routes/proof.js.map +1 -1
  73. package/lib/beacon/routes/validator.d.ts +524 -325
  74. package/lib/beacon/routes/validator.js +468 -213
  75. package/lib/beacon/routes/validator.js.map +1 -1
  76. package/lib/beacon/server/beacon.d.ts +3 -4
  77. package/lib/beacon/server/beacon.js +4 -57
  78. package/lib/beacon/server/beacon.js.map +1 -1
  79. package/lib/beacon/server/config.d.ts +3 -4
  80. package/lib/beacon/server/config.js +4 -5
  81. package/lib/beacon/server/config.js.map +1 -1
  82. package/lib/beacon/server/debug.d.ts +3 -4
  83. package/lib/beacon/server/debug.js +4 -54
  84. package/lib/beacon/server/debug.js.map +1 -1
  85. package/lib/beacon/server/events.d.ts +4 -4
  86. package/lib/beacon/server/events.js +17 -23
  87. package/lib/beacon/server/events.js.map +1 -1
  88. package/lib/beacon/server/index.d.ts +7 -8
  89. package/lib/beacon/server/index.js +13 -14
  90. package/lib/beacon/server/index.js.map +1 -1
  91. package/lib/beacon/server/lightclient.d.ts +3 -4
  92. package/lib/beacon/server/lightclient.js +4 -5
  93. package/lib/beacon/server/lightclient.js.map +1 -1
  94. package/lib/beacon/server/lodestar.d.ts +3 -4
  95. package/lib/beacon/server/lodestar.js +4 -5
  96. package/lib/beacon/server/lodestar.js.map +1 -1
  97. package/lib/beacon/server/node.d.ts +3 -4
  98. package/lib/beacon/server/node.js +4 -18
  99. package/lib/beacon/server/node.js.map +1 -1
  100. package/lib/beacon/server/proof.d.ts +3 -4
  101. package/lib/beacon/server/proof.js +4 -36
  102. package/lib/beacon/server/proof.js.map +1 -1
  103. package/lib/beacon/server/validator.d.ts +3 -4
  104. package/lib/beacon/server/validator.js +4 -21
  105. package/lib/beacon/server/validator.js.map +1 -1
  106. package/lib/builder/client.d.ts +4 -6
  107. package/lib/builder/client.js +3 -9
  108. package/lib/builder/client.js.map +1 -1
  109. package/lib/builder/index.d.ts +8 -5
  110. package/lib/builder/index.js +4 -1
  111. package/lib/builder/index.js.map +1 -1
  112. package/lib/builder/routes.d.ts +25 -39
  113. package/lib/builder/routes.js +78 -34
  114. package/lib/builder/routes.js.map +1 -1
  115. package/lib/builder/server/index.d.ts +6 -6
  116. package/lib/builder/server/index.js +7 -8
  117. package/lib/builder/server/index.js.map +1 -1
  118. package/lib/index.d.ts +9 -6
  119. package/lib/index.js +5 -4
  120. package/lib/index.js.map +1 -1
  121. package/lib/keymanager/client.d.ts +4 -3
  122. package/lib/keymanager/client.js +4 -7
  123. package/lib/keymanager/client.js.map +1 -1
  124. package/lib/keymanager/index.d.ts +5 -4
  125. package/lib/keymanager/index.js +1 -1
  126. package/lib/keymanager/index.js.map +1 -1
  127. package/lib/keymanager/routes.d.ts +155 -177
  128. package/lib/keymanager/routes.js +236 -123
  129. package/lib/keymanager/routes.js.map +1 -1
  130. package/lib/keymanager/server/index.d.ts +6 -6
  131. package/lib/keymanager/server/index.js +7 -8
  132. package/lib/keymanager/server/index.js.map +1 -1
  133. package/lib/server/index.d.ts +2 -0
  134. package/lib/server/index.js +3 -0
  135. package/lib/server/index.js.map +1 -0
  136. package/lib/utils/client/error.d.ts +6 -0
  137. package/lib/utils/client/error.js +8 -0
  138. package/lib/utils/client/error.js.map +1 -0
  139. package/lib/utils/client/httpClient.d.ts +35 -75
  140. package/lib/utils/client/httpClient.js +201 -153
  141. package/lib/utils/client/httpClient.js.map +1 -1
  142. package/lib/utils/client/index.d.ts +6 -2
  143. package/lib/utils/client/index.js +6 -2
  144. package/lib/utils/client/index.js.map +1 -1
  145. package/lib/utils/client/method.d.ts +11 -0
  146. package/lib/utils/client/method.js +27 -0
  147. package/lib/utils/client/method.js.map +1 -0
  148. package/lib/utils/client/request.d.ts +33 -0
  149. package/lib/utils/client/request.js +66 -0
  150. package/lib/utils/client/request.js.map +1 -0
  151. package/lib/utils/client/response.d.ts +36 -0
  152. package/lib/utils/client/response.js +167 -0
  153. package/lib/utils/client/response.js.map +1 -0
  154. package/lib/utils/codecs.d.ts +28 -0
  155. package/lib/utils/codecs.js +105 -0
  156. package/lib/utils/codecs.js.map +1 -0
  157. package/lib/utils/fork.d.ts +7 -0
  158. package/lib/utils/fork.js +29 -0
  159. package/lib/utils/fork.js.map +1 -0
  160. package/lib/utils/headers.d.ts +37 -0
  161. package/lib/utils/headers.js +134 -0
  162. package/lib/utils/headers.js.map +1 -0
  163. package/lib/utils/httpStatusCode.js.map +1 -0
  164. package/lib/utils/index.d.ts +1 -1
  165. package/lib/utils/index.js +1 -1
  166. package/lib/utils/index.js.map +1 -1
  167. package/lib/utils/metadata.d.ts +88 -0
  168. package/lib/utils/metadata.js +126 -0
  169. package/lib/utils/metadata.js.map +1 -0
  170. package/lib/utils/schema.d.ts +31 -17
  171. package/lib/utils/schema.js +18 -6
  172. package/lib/utils/schema.js.map +1 -1
  173. package/lib/utils/serdes.d.ts +3 -0
  174. package/lib/utils/serdes.js +13 -0
  175. package/lib/utils/serdes.js.map +1 -1
  176. package/lib/utils/server/{errors.d.ts → error.d.ts} +2 -2
  177. package/lib/utils/server/{errors.js → error.js} +1 -1
  178. package/lib/utils/server/error.js.map +1 -0
  179. package/lib/utils/server/handler.d.ts +11 -0
  180. package/lib/utils/server/handler.js +115 -0
  181. package/lib/utils/server/handler.js.map +1 -0
  182. package/lib/utils/server/index.d.ts +5 -4
  183. package/lib/utils/server/index.js +5 -4
  184. package/lib/utils/server/index.js.map +1 -1
  185. package/lib/utils/server/method.d.ts +35 -0
  186. package/lib/utils/server/method.js +2 -0
  187. package/lib/utils/server/method.js.map +1 -0
  188. package/lib/utils/server/parser.d.ts +3 -0
  189. package/lib/utils/server/parser.js +20 -0
  190. package/lib/utils/server/parser.js.map +1 -0
  191. package/lib/utils/server/route.d.ts +20 -0
  192. package/lib/utils/server/route.js +19 -0
  193. package/lib/utils/server/route.js.map +1 -0
  194. package/lib/utils/types.d.ts +116 -104
  195. package/lib/utils/types.js +2 -155
  196. package/lib/utils/types.js.map +1 -1
  197. package/lib/utils/urlFormat.d.ts +2 -2
  198. package/lib/utils/urlFormat.js +3 -3
  199. package/lib/utils/urlFormat.js.map +1 -1
  200. package/lib/utils/wireFormat.d.ts +8 -0
  201. package/lib/utils/wireFormat.js +23 -0
  202. package/lib/utils/wireFormat.js.map +1 -0
  203. package/package.json +9 -6
  204. package/lib/interfaces.d.ts +0 -44
  205. package/lib/interfaces.js +0 -2
  206. package/lib/interfaces.js.map +0 -1
  207. package/lib/utils/acceptHeader.d.ts +0 -9
  208. package/lib/utils/acceptHeader.js +0 -62
  209. package/lib/utils/acceptHeader.js.map +0 -1
  210. package/lib/utils/client/client.d.ts +0 -29
  211. package/lib/utils/client/client.js +0 -88
  212. package/lib/utils/client/client.js.map +0 -1
  213. package/lib/utils/client/httpStatusCode.js.map +0 -1
  214. package/lib/utils/routes.d.ts +0 -6
  215. package/lib/utils/routes.js +0 -31
  216. package/lib/utils/routes.js.map +0 -1
  217. package/lib/utils/server/errors.js.map +0 -1
  218. package/lib/utils/server/genericJsonServer.d.ts +0 -13
  219. package/lib/utils/server/genericJsonServer.js +0 -32
  220. package/lib/utils/server/genericJsonServer.js.map +0 -1
  221. package/lib/utils/server/registerRoute.d.ts +0 -3
  222. package/lib/utils/server/registerRoute.js +0 -13
  223. package/lib/utils/server/registerRoute.js.map +0 -1
  224. package/lib/utils/server/types.d.ts +0 -22
  225. package/lib/utils/server/types.js +0 -2
  226. package/lib/utils/server/types.js.map +0 -1
  227. /package/lib/utils/{client/httpStatusCode.d.ts → httpStatusCode.d.ts} +0 -0
  228. /package/lib/utils/{client/httpStatusCode.js → httpStatusCode.js} +0 -0
@@ -1,289 +1,235 @@
1
- import { phase0, CommitteeIndex, Slot, ValidatorIndex, Epoch, Root, RootHex } from "@lodestar/types";
2
- import { ApiClientResponse } from "../../../interfaces.js";
3
- import { HttpStatusCode } from "../../../utils/client/httpStatusCode.js";
4
- import { RoutesData, ReturnTypes, ReqSerializers } from "../../../utils/index.js";
1
+ import { ContainerType, ValueOf } from "@chainsafe/ssz";
2
+ import { ChainForkConfig } from "@lodestar/config";
3
+ import { phase0, CommitteeIndex, Slot, Epoch, RootHex, StringType } from "@lodestar/types";
4
+ import { Endpoint, RouteDefinitions } from "../../../utils/index.js";
5
+ import { ExecutionOptimisticAndFinalizedMeta } from "../../../utils/metadata.js";
6
+ import { RootResponse } from "./block.js";
5
7
  export type StateId = RootHex | Slot | "head" | "genesis" | "finalized" | "justified";
8
+ export type StateArgs = {
9
+ /**
10
+ * State identifier.
11
+ * Can be one of: "head" (canonical head in node's view), "genesis", "finalized", "justified", \<slot\>, \<hex encoded stateRoot with 0x prefix\>.
12
+ */
13
+ stateId: StateId;
14
+ };
6
15
  export type ValidatorId = string | number;
7
- /**
8
- * True if the response references an unverified execution payload. Optimistic information may be invalidated at
9
- * a later time. If the field is not present, assume the False value.
10
- */
11
- export type ExecutionOptimistic = boolean;
12
- /**
13
- * True if the response references the finalized history of the chain, as determined by fork choice.
14
- */
15
- export type Finalized = boolean;
16
16
  export type ValidatorStatus = "active" | "pending_initialized" | "pending_queued" | "active_ongoing" | "active_exiting" | "active_slashed" | "exited_unslashed" | "exited_slashed" | "withdrawal_possible" | "withdrawal_done";
17
- export type ValidatorFilters = {
18
- id?: ValidatorId[];
19
- status?: ValidatorStatus[];
20
- };
21
- export type CommitteesFilters = {
22
- epoch?: Epoch;
23
- index?: CommitteeIndex;
24
- slot?: Slot;
25
- };
26
- export type FinalityCheckpoints = {
27
- previousJustified: phase0.Checkpoint;
28
- currentJustified: phase0.Checkpoint;
29
- finalized: phase0.Checkpoint;
30
- };
31
- export type ValidatorResponse = {
32
- index: ValidatorIndex;
33
- balance: number;
34
- status: ValidatorStatus;
35
- validator: phase0.Validator;
36
- };
37
- export type ValidatorBalance = {
38
- index: ValidatorIndex;
39
- balance: number;
40
- };
41
- export type EpochCommitteeResponse = {
42
- index: CommitteeIndex;
43
- slot: Slot;
44
- validators: ArrayLike<ValidatorIndex>;
45
- };
46
- export type EpochSyncCommitteeResponse = {
47
- /** all of the validator indices in the current sync committee */
48
- validators: ValidatorIndex[];
17
+ export declare const RandaoResponseType: ContainerType<{
18
+ randao: import("@chainsafe/ssz").ByteVectorType;
19
+ }>;
20
+ export declare const FinalityCheckpointsType: ContainerType<{
21
+ previousJustified: ContainerType<{
22
+ epoch: import("@chainsafe/ssz").UintNumberType;
23
+ root: import("@chainsafe/ssz").ByteVectorType; /** All of the validator indices in the current sync committee */
24
+ }>;
25
+ currentJustified: ContainerType<{
26
+ epoch: import("@chainsafe/ssz").UintNumberType;
27
+ root: import("@chainsafe/ssz").ByteVectorType; /** All of the validator indices in the current sync committee */
28
+ }>;
29
+ finalized: ContainerType<{
30
+ epoch: import("@chainsafe/ssz").UintNumberType;
31
+ root: import("@chainsafe/ssz").ByteVectorType; /** All of the validator indices in the current sync committee */
32
+ }>;
33
+ }>;
34
+ export declare const ValidatorResponseType: ContainerType<{
35
+ index: import("@chainsafe/ssz").UintNumberType;
36
+ balance: import("@chainsafe/ssz").UintNumberType;
37
+ status: StringType<ValidatorStatus>;
38
+ validator: import("@lodestar/types/lib/phase0/validator.js").ValidatorNodeStructType;
39
+ }>;
40
+ export declare const EpochCommitteeResponseType: ContainerType<{
41
+ index: import("@chainsafe/ssz").UintNumberType;
42
+ slot: import("@chainsafe/ssz").UintNumberType;
43
+ validators: import("@chainsafe/ssz").ArrayType<import("@chainsafe/ssz").Type<number>, unknown, unknown>;
44
+ }>;
45
+ export declare const ValidatorBalanceType: ContainerType<{
46
+ index: import("@chainsafe/ssz").UintNumberType;
47
+ balance: import("@chainsafe/ssz").UintNumberType;
48
+ }>;
49
+ export declare const EpochSyncCommitteeResponseType: ContainerType<{
50
+ /** All of the validator indices in the current sync committee */
51
+ validators: import("@chainsafe/ssz").ArrayType<import("@chainsafe/ssz").Type<number>, unknown, unknown>;
49
52
  /** Subcommittee slices of the current sync committee */
50
- validatorAggregates: ValidatorIndex[][];
51
- };
52
- export type Api = {
53
+ validatorAggregates: import("@chainsafe/ssz").ArrayType<import("@chainsafe/ssz").Type<number[]>, unknown, unknown>;
54
+ }>;
55
+ export declare const ValidatorResponseListType: import("@chainsafe/ssz").ArrayType<import("@chainsafe/ssz").Type<import("@chainsafe/ssz").ValueOfFields<{
56
+ index: import("@chainsafe/ssz").UintNumberType;
57
+ balance: import("@chainsafe/ssz").UintNumberType;
58
+ status: StringType<ValidatorStatus>;
59
+ validator: import("@lodestar/types/lib/phase0/validator.js").ValidatorNodeStructType;
60
+ }>>, unknown, unknown>;
61
+ export declare const EpochCommitteeResponseListType: import("@chainsafe/ssz").ArrayType<import("@chainsafe/ssz").Type<import("@chainsafe/ssz").ValueOfFields<{
62
+ index: import("@chainsafe/ssz").UintNumberType;
63
+ slot: import("@chainsafe/ssz").UintNumberType;
64
+ validators: import("@chainsafe/ssz").ArrayType<import("@chainsafe/ssz").Type<number>, unknown, unknown>;
65
+ }>>, unknown, unknown>;
66
+ export declare const ValidatorBalanceListType: import("@chainsafe/ssz").ArrayType<import("@chainsafe/ssz").Type<import("@chainsafe/ssz").ValueOfFields<{
67
+ index: import("@chainsafe/ssz").UintNumberType;
68
+ balance: import("@chainsafe/ssz").UintNumberType;
69
+ }>>, unknown, unknown>;
70
+ export type RandaoResponse = ValueOf<typeof RandaoResponseType>;
71
+ export type FinalityCheckpoints = ValueOf<typeof FinalityCheckpointsType>;
72
+ export type ValidatorResponse = ValueOf<typeof ValidatorResponseType>;
73
+ export type EpochCommitteeResponse = ValueOf<typeof EpochCommitteeResponseType>;
74
+ export type ValidatorBalance = ValueOf<typeof ValidatorBalanceType>;
75
+ export type EpochSyncCommitteeResponse = ValueOf<typeof EpochSyncCommitteeResponseType>;
76
+ export type ValidatorResponseList = ValueOf<typeof ValidatorResponseListType>;
77
+ export type EpochCommitteeResponseList = ValueOf<typeof EpochCommitteeResponseListType>;
78
+ export type ValidatorBalanceList = ValueOf<typeof ValidatorBalanceListType>;
79
+ export type Endpoints = {
53
80
  /**
54
81
  * Get state SSZ HashTreeRoot
55
82
  * Calculates HashTreeRoot for state with given 'stateId'. If stateId is root, same value will be returned.
56
- *
57
- * @param stateId State identifier.
58
- * Can be one of: "head" (canonical head in node's view), "genesis", "finalized", "justified", \<slot\>, \<hex encoded stateRoot with 0x prefix\>.
59
83
  */
60
- getStateRoot(stateId: StateId): Promise<ApiClientResponse<{
61
- [HttpStatusCode.OK]: {
62
- data: {
63
- root: Root;
64
- };
65
- executionOptimistic: ExecutionOptimistic;
66
- finalized: Finalized;
84
+ getStateRoot: Endpoint<"GET", StateArgs, {
85
+ params: {
86
+ state_id: string;
67
87
  };
68
- }, HttpStatusCode.BAD_REQUEST | HttpStatusCode.NOT_FOUND>>;
88
+ }, RootResponse, ExecutionOptimisticAndFinalizedMeta>;
69
89
  /**
70
90
  * Get Fork object for requested state
71
91
  * Returns [Fork](https://github.com/ethereum/consensus-specs/blob/v1.1.10/specs/phase0/beacon-chain.md#fork) object for state with given 'stateId'.
72
- * @param stateId State identifier.
73
- * Can be one of: "head" (canonical head in node's view), "genesis", "finalized", "justified", \<slot\>, \<hex encoded stateRoot with 0x prefix\>.
74
92
  */
75
- getStateFork(stateId: StateId): Promise<ApiClientResponse<{
76
- [HttpStatusCode.OK]: {
77
- data: phase0.Fork;
78
- executionOptimistic: ExecutionOptimistic;
79
- finalized: Finalized;
93
+ getStateFork: Endpoint<"GET", StateArgs, {
94
+ params: {
95
+ state_id: string;
80
96
  };
81
- }, HttpStatusCode.BAD_REQUEST | HttpStatusCode.NOT_FOUND>>;
97
+ }, phase0.Fork, ExecutionOptimisticAndFinalizedMeta>;
82
98
  /**
83
99
  * Fetch the RANDAO mix for the requested epoch from the state identified by 'stateId'.
84
- *
85
- * @param stateId State identifier.
86
- * Can be one of: "head" (canonical head in node's view), "genesis", "finalized", "justified", \<slot\>, \<hex encoded stateRoot with 0x prefix\>.
87
- * @param epoch Fetch randao mix for the given epoch. If an epoch is not specified then the RANDAO mix for the state's current epoch will be returned.
88
100
  */
89
- getStateRandao(stateId: StateId, epoch?: Epoch): Promise<ApiClientResponse<{
90
- [HttpStatusCode.OK]: {
91
- data: {
92
- randao: Root;
93
- };
94
- executionOptimistic: ExecutionOptimistic;
95
- finalized: Finalized;
101
+ getStateRandao: Endpoint<"GET", StateArgs & {
102
+ /**
103
+ * Fetch randao mix for the given epoch. If an epoch is not specified
104
+ * then the RANDAO mix for the state's current epoch will be returned.
105
+ */
106
+ epoch?: Epoch;
107
+ }, {
108
+ params: {
109
+ state_id: string;
96
110
  };
97
- }, HttpStatusCode.BAD_REQUEST | HttpStatusCode.NOT_FOUND>>;
111
+ query: {
112
+ epoch?: number;
113
+ };
114
+ }, RandaoResponse, ExecutionOptimisticAndFinalizedMeta>;
98
115
  /**
99
116
  * Get state finality checkpoints
100
117
  * Returns finality checkpoints for state with given 'stateId'.
101
118
  * In case finality is not yet achieved, checkpoint should return epoch 0 and ZERO_HASH as root.
102
- * @param stateId State identifier.
103
- * Can be one of: "head" (canonical head in node's view), "genesis", "finalized", "justified", \<slot\>, \<hex encoded stateRoot with 0x prefix\>.
104
119
  */
105
- getStateFinalityCheckpoints(stateId: StateId): Promise<ApiClientResponse<{
106
- [HttpStatusCode.OK]: {
107
- data: FinalityCheckpoints;
108
- executionOptimistic: ExecutionOptimistic;
109
- finalized: Finalized;
120
+ getStateFinalityCheckpoints: Endpoint<"GET", StateArgs, {
121
+ params: {
122
+ state_id: string;
110
123
  };
111
- }, HttpStatusCode.BAD_REQUEST | HttpStatusCode.NOT_FOUND>>;
124
+ }, FinalityCheckpoints, ExecutionOptimisticAndFinalizedMeta>;
112
125
  /**
113
- * Get validators from state
114
- * Returns filterable list of validators with their balance, status and index.
115
- * @param stateId State identifier.
116
- * Can be one of: "head" (canonical head in node's view), "genesis", "finalized", "justified", \<slot\>, \<hex encoded stateRoot with 0x prefix\>.
117
- * @param id Either hex encoded public key (with 0x prefix) or validator index
118
- * @param status [Validator status specification](https://hackmd.io/ofFJ5gOmQpu1jjHilHbdQQ)
126
+ * Get validator from state by id
127
+ * Returns validator specified by state and id or public key along with status and balance.
119
128
  */
120
- getStateValidators(stateId: StateId, filters?: ValidatorFilters): Promise<ApiClientResponse<{
121
- [HttpStatusCode.OK]: {
122
- data: ValidatorResponse[];
123
- executionOptimistic: ExecutionOptimistic;
124
- finalized: Finalized;
129
+ getStateValidator: Endpoint<"GET", StateArgs & {
130
+ /** Either hex encoded public key (with 0x prefix) or validator index */
131
+ validatorId: ValidatorId;
132
+ }, {
133
+ params: {
134
+ state_id: string;
135
+ validator_id: ValidatorId;
125
136
  };
126
- }, HttpStatusCode.BAD_REQUEST | HttpStatusCode.NOT_FOUND>>;
137
+ }, ValidatorResponse, ExecutionOptimisticAndFinalizedMeta>;
127
138
  /**
128
139
  * Get validators from state
129
140
  * Returns filterable list of validators with their balance, status and index.
130
- * @param stateId State identifier.
131
- * Can be one of: "head" (canonical head in node's view), "genesis", "finalized", "justified", \<slot\>, \<hex encoded stateRoot with 0x prefix\>.
132
- * @param id Either hex encoded public key (with 0x prefix) or validator index
133
- * @param status [Validator status specification](https://hackmd.io/ofFJ5gOmQpu1jjHilHbdQQ)
134
141
  */
135
- postStateValidators(stateId: StateId, filters?: ValidatorFilters): Promise<ApiClientResponse<{
136
- [HttpStatusCode.OK]: {
137
- data: ValidatorResponse[];
138
- executionOptimistic: ExecutionOptimistic;
139
- finalized: Finalized;
142
+ getStateValidators: Endpoint<"GET", StateArgs & {
143
+ /** Either hex encoded public key (with 0x prefix) or validator index */
144
+ validatorIds?: ValidatorId[];
145
+ /** [Validator status specification](https://hackmd.io/ofFJ5gOmQpu1jjHilHbdQQ) */
146
+ statuses?: ValidatorStatus[];
147
+ }, {
148
+ params: {
149
+ state_id: string;
140
150
  };
141
- }, HttpStatusCode.BAD_REQUEST | HttpStatusCode.NOT_FOUND>>;
151
+ query: {
152
+ id?: ValidatorId[];
153
+ status?: ValidatorStatus[];
154
+ };
155
+ }, ValidatorResponseList, ExecutionOptimisticAndFinalizedMeta>;
142
156
  /**
143
- * Get validator from state by id
144
- * Returns validator specified by state and id or public key along with status and balance.
145
- * @param stateId State identifier.
146
- * Can be one of: "head" (canonical head in node's view), "genesis", "finalized", "justified", \<slot\>, \<hex encoded stateRoot with 0x prefix\>.
147
- * @param validatorId Either hex encoded public key (with 0x prefix) or validator index
157
+ * Get validators from state
158
+ * Returns filterable list of validators with their balance, status and index.
148
159
  */
149
- getStateValidator(stateId: StateId, validatorId: ValidatorId): Promise<ApiClientResponse<{
150
- [HttpStatusCode.OK]: {
151
- data: ValidatorResponse;
152
- executionOptimistic: ExecutionOptimistic;
153
- finalized: Finalized;
160
+ postStateValidators: Endpoint<"POST", StateArgs & {
161
+ /** Either hex encoded public key (with 0x prefix) or validator index */
162
+ validatorIds?: ValidatorId[];
163
+ /** [Validator status specification](https://hackmd.io/ofFJ5gOmQpu1jjHilHbdQQ) */
164
+ statuses?: ValidatorStatus[];
165
+ }, {
166
+ params: {
167
+ state_id: string;
168
+ };
169
+ body: {
170
+ ids?: string[];
171
+ statuses?: ValidatorStatus[];
154
172
  };
155
- }, HttpStatusCode.BAD_REQUEST | HttpStatusCode.NOT_FOUND>>;
173
+ }, ValidatorResponseList, ExecutionOptimisticAndFinalizedMeta>;
156
174
  /**
157
175
  * Get validator balances from state
158
176
  * Returns filterable list of validator balances.
159
- * @param stateId State identifier.
160
- * Can be one of: "head" (canonical head in node's view), "genesis", "finalized", "justified", \<slot\>, \<hex encoded stateRoot with 0x prefix\>.
161
- * @param id Either hex encoded public key (with 0x prefix) or validator index
162
177
  */
163
- getStateValidatorBalances(stateId: StateId, indices?: ValidatorId[]): Promise<ApiClientResponse<{
164
- [HttpStatusCode.OK]: {
165
- data: ValidatorBalance[];
166
- executionOptimistic: ExecutionOptimistic;
167
- finalized: Finalized;
178
+ getStateValidatorBalances: Endpoint<"GET", StateArgs & {
179
+ /** Either hex encoded public key (with 0x prefix) or validator index */
180
+ validatorIds?: ValidatorId[];
181
+ }, {
182
+ params: {
183
+ state_id: string;
168
184
  };
169
- }, HttpStatusCode.BAD_REQUEST>>;
185
+ query: {
186
+ id?: ValidatorId[];
187
+ };
188
+ }, ValidatorBalanceList, ExecutionOptimisticAndFinalizedMeta>;
170
189
  /**
171
190
  * Get validator balances from state
172
191
  * Returns filterable list of validator balances.
173
- * @param stateId State identifier.
174
- * Can be one of: "head" (canonical head in node's view), "genesis", "finalized", "justified", \<slot\>, \<hex encoded stateRoot with 0x prefix\>.
175
- * @param id Either hex encoded public key (with 0x prefix) or validator index
176
192
  */
177
- postStateValidatorBalances(stateId: StateId, indices?: ValidatorId[]): Promise<ApiClientResponse<{
178
- [HttpStatusCode.OK]: {
179
- data: ValidatorBalance[];
180
- executionOptimistic: ExecutionOptimistic;
181
- finalized: Finalized;
193
+ postStateValidatorBalances: Endpoint<"POST", StateArgs & {
194
+ /** Either hex encoded public key (with 0x prefix) or validator index */
195
+ validatorIds?: ValidatorId[];
196
+ }, {
197
+ params: {
198
+ state_id: string;
182
199
  };
183
- }, HttpStatusCode.BAD_REQUEST>>;
200
+ body: string[];
201
+ }, ValidatorBalanceList, ExecutionOptimisticAndFinalizedMeta>;
184
202
  /**
185
203
  * Get all committees for a state.
186
204
  * Retrieves the committees for the given state.
187
- * @param stateId State identifier.
188
- * Can be one of: "head" (canonical head in node's view), "genesis", "finalized", "justified", \<slot\>, \<hex encoded stateRoot with 0x prefix\>.
189
- * @param epoch Fetch committees for the given epoch. If not present then the committees for the epoch of the state will be obtained.
190
- * @param index Restrict returned values to those matching the supplied committee index.
191
- * @param slot Restrict returned values to those matching the supplied slot.
192
205
  */
193
- getEpochCommittees(stateId: StateId, filters?: CommitteesFilters): Promise<ApiClientResponse<{
194
- [HttpStatusCode.OK]: {
195
- data: EpochCommitteeResponse[];
196
- executionOptimistic: ExecutionOptimistic;
197
- finalized: Finalized;
198
- };
199
- }, HttpStatusCode.BAD_REQUEST | HttpStatusCode.NOT_FOUND>>;
200
- getEpochSyncCommittees(stateId: StateId, epoch?: Epoch): Promise<ApiClientResponse<{
201
- [HttpStatusCode.OK]: {
202
- data: EpochSyncCommitteeResponse;
203
- executionOptimistic: ExecutionOptimistic;
204
- finalized: Finalized;
205
- };
206
- }, HttpStatusCode.BAD_REQUEST | HttpStatusCode.NOT_FOUND>>;
207
- };
208
- /**
209
- * Define javascript values for each route
210
- */
211
- export declare const routesData: RoutesData<Api>;
212
- type StateIdOnlyReq = {
213
- params: {
214
- state_id: string;
215
- };
216
- };
217
- export type ReqTypes = {
218
- getEpochCommittees: {
206
+ getEpochCommittees: Endpoint<"GET", StateArgs & {
207
+ /** Fetch committees for the given epoch. If not present then the committees for the epoch of the state will be obtained. */
208
+ epoch?: Epoch;
209
+ /** Restrict returned values to those matching the supplied committee index. */
210
+ index?: CommitteeIndex;
211
+ /** Restrict returned values to those matching the supplied slot. */
212
+ slot?: Slot;
213
+ }, {
219
214
  params: {
220
- state_id: StateId;
215
+ state_id: string;
221
216
  };
222
217
  query: {
223
218
  slot?: number;
224
219
  epoch?: number;
225
220
  index?: number;
226
221
  };
227
- };
228
- getEpochSyncCommittees: {
229
- params: {
230
- state_id: StateId;
231
- };
232
- query: {
233
- epoch?: number;
234
- };
235
- };
236
- getStateFinalityCheckpoints: StateIdOnlyReq;
237
- getStateFork: StateIdOnlyReq;
238
- getStateRoot: StateIdOnlyReq;
239
- getStateRandao: {
222
+ }, EpochCommitteeResponseList, ExecutionOptimisticAndFinalizedMeta>;
223
+ getEpochSyncCommittees: Endpoint<"GET", StateArgs & {
224
+ epoch?: Epoch;
225
+ }, {
240
226
  params: {
241
- state_id: StateId;
227
+ state_id: string;
242
228
  };
243
229
  query: {
244
230
  epoch?: number;
245
231
  };
246
- };
247
- getStateValidator: {
248
- params: {
249
- state_id: StateId;
250
- validator_id: ValidatorId;
251
- };
252
- };
253
- getStateValidators: {
254
- params: {
255
- state_id: StateId;
256
- };
257
- query: {
258
- id?: ValidatorId[];
259
- status?: ValidatorStatus[];
260
- };
261
- };
262
- postStateValidators: {
263
- params: {
264
- state_id: StateId;
265
- };
266
- body: {
267
- ids?: string[];
268
- statuses?: ValidatorStatus[];
269
- };
270
- };
271
- getStateValidatorBalances: {
272
- params: {
273
- state_id: StateId;
274
- };
275
- query: {
276
- id?: ValidatorId[];
277
- };
278
- };
279
- postStateValidatorBalances: {
280
- params: {
281
- state_id: StateId;
282
- };
283
- body?: string[];
284
- };
232
+ }, EpochSyncCommitteeResponse, ExecutionOptimisticAndFinalizedMeta>;
285
233
  };
286
- export declare function getReqSerializers(): ReqSerializers<Api, ReqTypes>;
287
- export declare function getReturnTypes(): ReturnTypes<Api>;
288
- export {};
234
+ export declare function getDefinitions(_config: ChainForkConfig): RouteDefinitions<Endpoints>;
289
235
  //# sourceMappingURL=state.d.ts.map