@lodestar/api 1.35.0-dev.f80d2d52da → 1.35.0-dev.fcf8d024ea

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 (180) hide show
  1. package/lib/beacon/client/beacon.d.ts.map +1 -0
  2. package/lib/beacon/client/config.d.ts.map +1 -0
  3. package/lib/beacon/client/debug.d.ts.map +1 -0
  4. package/lib/beacon/client/events.d.ts.map +1 -0
  5. package/lib/beacon/client/index.d.ts.map +1 -0
  6. package/lib/beacon/client/index.js.map +1 -1
  7. package/lib/beacon/client/lightclient.d.ts.map +1 -0
  8. package/lib/beacon/client/lodestar.d.ts.map +1 -0
  9. package/lib/beacon/client/node.d.ts.map +1 -0
  10. package/lib/beacon/client/proof.d.ts.map +1 -0
  11. package/lib/beacon/client/validator.d.ts.map +1 -0
  12. package/lib/beacon/index.d.ts +1 -1
  13. package/lib/beacon/index.d.ts.map +1 -0
  14. package/lib/beacon/index.js.map +1 -1
  15. package/lib/beacon/routes/beacon/block.d.ts.map +1 -0
  16. package/lib/beacon/routes/beacon/index.d.ts +3 -3
  17. package/lib/beacon/routes/beacon/index.d.ts.map +1 -0
  18. package/lib/beacon/routes/beacon/index.js.map +1 -1
  19. package/lib/beacon/routes/beacon/pool.d.ts +1 -1
  20. package/lib/beacon/routes/beacon/pool.d.ts.map +1 -0
  21. package/lib/beacon/routes/beacon/rewards.d.ts.map +1 -0
  22. package/lib/beacon/routes/beacon/rewards.js.map +1 -1
  23. package/lib/beacon/routes/beacon/state.d.ts +2 -2
  24. package/lib/beacon/routes/beacon/state.d.ts.map +1 -0
  25. package/lib/beacon/routes/config.d.ts +1 -1
  26. package/lib/beacon/routes/config.d.ts.map +1 -0
  27. package/lib/beacon/routes/debug.d.ts.map +1 -0
  28. package/lib/beacon/routes/events.d.ts.map +1 -0
  29. package/lib/beacon/routes/events.js.map +1 -1
  30. package/lib/beacon/routes/index.d.ts.map +1 -0
  31. package/lib/beacon/routes/index.js.map +1 -1
  32. package/lib/beacon/routes/lightclient.d.ts.map +1 -0
  33. package/lib/beacon/routes/lodestar.d.ts.map +1 -0
  34. package/lib/beacon/routes/node.d.ts.map +1 -0
  35. package/lib/beacon/routes/proof.d.ts.map +1 -0
  36. package/lib/beacon/routes/validator.d.ts +1 -1
  37. package/lib/beacon/routes/validator.d.ts.map +1 -0
  38. package/lib/beacon/server/beacon.d.ts.map +1 -0
  39. package/lib/beacon/server/config.d.ts.map +1 -0
  40. package/lib/beacon/server/debug.d.ts.map +1 -0
  41. package/lib/beacon/server/events.d.ts.map +1 -0
  42. package/lib/beacon/server/index.d.ts +1 -1
  43. package/lib/beacon/server/index.d.ts.map +1 -0
  44. package/lib/beacon/server/index.js.map +1 -1
  45. package/lib/beacon/server/lightclient.d.ts.map +1 -0
  46. package/lib/beacon/server/lodestar.d.ts.map +1 -0
  47. package/lib/beacon/server/node.d.ts.map +1 -0
  48. package/lib/beacon/server/proof.d.ts.map +1 -0
  49. package/lib/beacon/server/validator.d.ts.map +1 -0
  50. package/lib/builder/client.d.ts.map +1 -0
  51. package/lib/builder/index.d.ts.map +1 -0
  52. package/lib/builder/index.js.map +1 -1
  53. package/lib/builder/routes.d.ts.map +1 -0
  54. package/lib/builder/routes.js.map +1 -1
  55. package/lib/builder/server/index.d.ts +1 -1
  56. package/lib/builder/server/index.d.ts.map +1 -0
  57. package/lib/index.d.ts +6 -6
  58. package/lib/index.d.ts.map +1 -0
  59. package/lib/index.js +3 -3
  60. package/lib/index.js.map +1 -1
  61. package/lib/keymanager/client.d.ts.map +1 -0
  62. package/lib/keymanager/index.d.ts +2 -2
  63. package/lib/keymanager/index.d.ts.map +1 -0
  64. package/lib/keymanager/index.js +1 -2
  65. package/lib/keymanager/index.js.map +1 -1
  66. package/lib/keymanager/routes.d.ts.map +1 -0
  67. package/lib/keymanager/server/index.d.ts +1 -1
  68. package/lib/keymanager/server/index.d.ts.map +1 -0
  69. package/lib/server/index.d.ts.map +1 -0
  70. package/lib/utils/client/error.d.ts.map +1 -0
  71. package/lib/utils/client/error.js +2 -0
  72. package/lib/utils/client/error.js.map +1 -1
  73. package/lib/utils/client/eventSource.d.ts.map +1 -0
  74. package/lib/utils/client/format.d.ts.map +1 -0
  75. package/lib/utils/client/httpClient.d.ts +1 -2
  76. package/lib/utils/client/httpClient.d.ts.map +1 -0
  77. package/lib/utils/client/httpClient.js +13 -9
  78. package/lib/utils/client/httpClient.js.map +1 -1
  79. package/lib/utils/client/index.d.ts +1 -1
  80. package/lib/utils/client/index.d.ts.map +1 -0
  81. package/lib/utils/client/index.js +1 -1
  82. package/lib/utils/client/index.js.map +1 -1
  83. package/lib/utils/client/method.d.ts.map +1 -0
  84. package/lib/utils/client/metrics.d.ts.map +1 -0
  85. package/lib/utils/client/request.d.ts.map +1 -0
  86. package/lib/utils/client/response.d.ts.map +1 -0
  87. package/lib/utils/client/response.js +6 -0
  88. package/lib/utils/client/response.js.map +1 -1
  89. package/lib/utils/codecs.d.ts.map +1 -0
  90. package/lib/utils/fork.d.ts.map +1 -0
  91. package/lib/utils/headers.d.ts.map +1 -0
  92. package/lib/utils/httpStatusCode.d.ts.map +1 -0
  93. package/lib/utils/index.d.ts.map +1 -0
  94. package/lib/utils/metadata.d.ts.map +1 -0
  95. package/lib/utils/schema.d.ts.map +1 -0
  96. package/lib/utils/serdes.d.ts.map +1 -0
  97. package/lib/utils/server/error.d.ts.map +1 -0
  98. package/lib/utils/server/error.js +1 -0
  99. package/lib/utils/server/error.js.map +1 -1
  100. package/lib/utils/server/handler.d.ts.map +1 -0
  101. package/lib/utils/server/index.d.ts.map +1 -0
  102. package/lib/utils/server/method.d.ts.map +1 -0
  103. package/lib/utils/server/parser.d.ts.map +1 -0
  104. package/lib/utils/server/route.d.ts.map +1 -0
  105. package/lib/utils/server/route.js.map +1 -1
  106. package/lib/utils/types.d.ts.map +1 -0
  107. package/lib/utils/urlFormat.d.ts.map +1 -0
  108. package/lib/utils/wireFormat.d.ts.map +1 -0
  109. package/package.json +17 -11
  110. package/src/beacon/client/beacon.ts +12 -0
  111. package/src/beacon/client/config.ts +12 -0
  112. package/src/beacon/client/debug.ts +12 -0
  113. package/src/beacon/client/events.ts +69 -0
  114. package/src/beacon/client/index.ts +46 -0
  115. package/src/beacon/client/lightclient.ts +12 -0
  116. package/src/beacon/client/lodestar.ts +12 -0
  117. package/src/beacon/client/node.ts +12 -0
  118. package/src/beacon/client/proof.ts +12 -0
  119. package/src/beacon/client/validator.ts +12 -0
  120. package/src/beacon/index.ts +24 -0
  121. package/src/beacon/routes/beacon/block.ts +602 -0
  122. package/src/beacon/routes/beacon/index.ts +66 -0
  123. package/src/beacon/routes/beacon/pool.ts +503 -0
  124. package/src/beacon/routes/beacon/rewards.ts +216 -0
  125. package/src/beacon/routes/beacon/state.ts +588 -0
  126. package/src/beacon/routes/config.ts +114 -0
  127. package/src/beacon/routes/debug.ts +231 -0
  128. package/src/beacon/routes/events.ts +337 -0
  129. package/src/beacon/routes/index.ts +33 -0
  130. package/src/beacon/routes/lightclient.ts +241 -0
  131. package/src/beacon/routes/lodestar.ts +456 -0
  132. package/src/beacon/routes/node.ts +286 -0
  133. package/src/beacon/routes/proof.ts +79 -0
  134. package/src/beacon/routes/validator.ts +1014 -0
  135. package/src/beacon/server/beacon.ts +7 -0
  136. package/src/beacon/server/config.ts +7 -0
  137. package/src/beacon/server/debug.ts +7 -0
  138. package/src/beacon/server/events.ts +73 -0
  139. package/src/beacon/server/index.ts +55 -0
  140. package/src/beacon/server/lightclient.ts +7 -0
  141. package/src/beacon/server/lodestar.ts +7 -0
  142. package/src/beacon/server/node.ts +7 -0
  143. package/src/beacon/server/proof.ts +7 -0
  144. package/src/beacon/server/validator.ts +7 -0
  145. package/src/builder/client.ts +9 -0
  146. package/src/builder/index.ts +26 -0
  147. package/src/builder/routes.ts +227 -0
  148. package/src/builder/server/index.ts +19 -0
  149. package/src/index.ts +19 -0
  150. package/src/keymanager/client.ts +9 -0
  151. package/src/keymanager/index.ts +39 -0
  152. package/src/keymanager/routes.ts +699 -0
  153. package/src/keymanager/server/index.ts +19 -0
  154. package/src/server/index.ts +2 -0
  155. package/src/utils/client/error.ts +10 -0
  156. package/src/utils/client/eventSource.ts +7 -0
  157. package/src/utils/client/format.ts +22 -0
  158. package/src/utils/client/httpClient.ts +444 -0
  159. package/src/utils/client/index.ts +6 -0
  160. package/src/utils/client/method.ts +50 -0
  161. package/src/utils/client/metrics.ts +9 -0
  162. package/src/utils/client/request.ts +113 -0
  163. package/src/utils/client/response.ts +205 -0
  164. package/src/utils/codecs.ts +143 -0
  165. package/src/utils/fork.ts +44 -0
  166. package/src/utils/headers.ts +173 -0
  167. package/src/utils/httpStatusCode.ts +392 -0
  168. package/src/utils/index.ts +3 -0
  169. package/src/utils/metadata.ts +170 -0
  170. package/src/utils/schema.ts +141 -0
  171. package/src/utils/serdes.ts +120 -0
  172. package/src/utils/server/error.ts +9 -0
  173. package/src/utils/server/handler.ts +149 -0
  174. package/src/utils/server/index.ts +5 -0
  175. package/src/utils/server/method.ts +38 -0
  176. package/src/utils/server/parser.ts +15 -0
  177. package/src/utils/server/route.ts +45 -0
  178. package/src/utils/types.ts +161 -0
  179. package/src/utils/urlFormat.ts +112 -0
  180. package/src/utils/wireFormat.ts +24 -0
@@ -0,0 +1,286 @@
1
+ import {ContainerType, ValueOf} from "@chainsafe/ssz";
2
+ import {ChainForkConfig} from "@lodestar/config";
3
+ import {fulu, ssz, stringType} from "@lodestar/types";
4
+ import {
5
+ ArrayOf,
6
+ EmptyArgs,
7
+ EmptyMeta,
8
+ EmptyMetaCodec,
9
+ EmptyRequest,
10
+ EmptyRequestCodec,
11
+ EmptyResponseCodec,
12
+ EmptyResponseData,
13
+ JsonOnlyResponseCodec,
14
+ } from "../../utils/codecs.js";
15
+ import {HttpStatusCode} from "../../utils/httpStatusCode.js";
16
+ import {Endpoint, RouteDefinitions, Schema} from "../../utils/index.js";
17
+ import {WireFormat} from "../../utils/wireFormat.js";
18
+
19
+ export const NetworkIdentityType = new ContainerType(
20
+ {
21
+ /** Cryptographic hash of a peer’s public key. [Read more](https://docs.libp2p.io/concepts/peer-id/) */
22
+ peerId: stringType,
23
+ /** Ethereum node record. [Read more](https://eips.ethereum.org/EIPS/eip-778) */
24
+ enr: stringType,
25
+ p2pAddresses: ArrayOf(stringType),
26
+ discoveryAddresses: ArrayOf(stringType),
27
+ // TODO Fulu: replace with `ssz.fulu.Metadata` once `custody_group_count` is more widely supported
28
+ /** Based on Ethereum Consensus [Metadata object](https://github.com/ethereum/consensus-specs/blob/v1.1.10/specs/phase0/p2p-interface.md#metadata) */
29
+ metadata: ssz.altair.Metadata,
30
+ },
31
+ {jsonCase: "eth2"}
32
+ );
33
+
34
+ export const PeerCountType = new ContainerType(
35
+ {
36
+ disconnected: ssz.UintNum64,
37
+ connecting: ssz.UintNum64,
38
+ connected: ssz.UintNum64,
39
+ disconnecting: ssz.UintNum64,
40
+ },
41
+ {jsonCase: "eth2"}
42
+ );
43
+
44
+ export const SyncingStatusType = new ContainerType(
45
+ {
46
+ /** Head slot node is trying to reach */
47
+ headSlot: ssz.Slot,
48
+ /** How many slots node needs to process to reach head. 0 if synced. */
49
+ syncDistance: ssz.Slot,
50
+ /** Set to true if the node is syncing, false if the node is synced. */
51
+ isSyncing: ssz.Boolean,
52
+ /** Set to true if the node is optimistically tracking head. */
53
+ isOptimistic: ssz.Boolean,
54
+ /** Set to true if the connected el client is offline */
55
+ elOffline: ssz.Boolean,
56
+ },
57
+ {jsonCase: "eth2"}
58
+ );
59
+
60
+ export type NetworkIdentity = ValueOf<typeof NetworkIdentityType> & {
61
+ metadata: Partial<fulu.Metadata>;
62
+ };
63
+
64
+ export type PeerState = "disconnected" | "connecting" | "connected" | "disconnecting";
65
+ export type PeerDirection = "inbound" | "outbound";
66
+
67
+ export type NodePeer = {
68
+ peerId: string;
69
+ enr: string;
70
+ lastSeenP2pAddress: string;
71
+ state: PeerState;
72
+ // the spec does not specify direction for a disconnected peer, lodestar uses null in that case
73
+ direction: PeerDirection | null;
74
+ };
75
+
76
+ export type PeersMeta = {count: number};
77
+
78
+ export type PeerCount = ValueOf<typeof PeerCountType>;
79
+
80
+ export type FilterGetPeers = {
81
+ state?: PeerState[];
82
+ direction?: PeerDirection[];
83
+ };
84
+
85
+ export type SyncingStatus = ValueOf<typeof SyncingStatusType>;
86
+
87
+ export enum NodeHealth {
88
+ READY = HttpStatusCode.OK,
89
+ SYNCING = HttpStatusCode.PARTIAL_CONTENT,
90
+ NOT_INITIALIZED_OR_ISSUES = HttpStatusCode.SERVICE_UNAVAILABLE,
91
+ }
92
+
93
+ /**
94
+ * Read information about the beacon node.
95
+ */
96
+ export type Endpoints = {
97
+ /**
98
+ * Get node network identity
99
+ * Retrieves data about the node's network presence
100
+ */
101
+ getNetworkIdentity: Endpoint<
102
+ // ⏎
103
+ "GET",
104
+ EmptyArgs,
105
+ EmptyRequest,
106
+ NetworkIdentity,
107
+ EmptyMeta
108
+ >;
109
+
110
+ /**
111
+ * Get node network peers
112
+ * Retrieves data about the node's network peers. By default this returns all peers. Multiple query params are combined using AND conditions
113
+ */
114
+ getPeers: Endpoint<
115
+ "GET",
116
+ FilterGetPeers,
117
+ {query: {state?: PeerState[]; direction?: PeerDirection[]}},
118
+ NodePeer[],
119
+ PeersMeta
120
+ >;
121
+
122
+ /**
123
+ * Get peer
124
+ * Retrieves data about the given peer
125
+ */
126
+ getPeer: Endpoint<
127
+ // ⏎
128
+ "GET",
129
+ {peerId: string},
130
+ {params: {peer_id: string}},
131
+ NodePeer,
132
+ EmptyMeta
133
+ >;
134
+
135
+ /**
136
+ * Get peer count
137
+ * Retrieves number of known peers.
138
+ */
139
+ getPeerCount: Endpoint<
140
+ // ⏎
141
+ "GET",
142
+ EmptyArgs,
143
+ EmptyRequest,
144
+ PeerCount,
145
+ EmptyMeta
146
+ >;
147
+
148
+ /**
149
+ * Get version string of the running beacon node.
150
+ * Requests that the beacon node identify information about its implementation in a format similar to a [HTTP User-Agent](https://tools.ietf.org/html/rfc7231#section-5.5.3) field.
151
+ */
152
+ getNodeVersion: Endpoint<
153
+ // ⏎
154
+ "GET",
155
+ EmptyArgs,
156
+ EmptyRequest,
157
+ {version: string},
158
+ EmptyMeta
159
+ >;
160
+
161
+ /**
162
+ * Get node syncing status
163
+ * Requests the beacon node to describe if it's currently syncing or not, and if it is, what block it is up to.
164
+ */
165
+ getSyncingStatus: Endpoint<
166
+ // ⏎
167
+ "GET",
168
+ EmptyArgs,
169
+ EmptyRequest,
170
+ SyncingStatus,
171
+ EmptyMeta
172
+ >;
173
+
174
+ /**
175
+ * Get health check
176
+ * Returns node health status in http status codes. Useful for load balancers.
177
+ */
178
+ getHealth: Endpoint<
179
+ // ⏎
180
+ "GET",
181
+ {syncingStatus?: number},
182
+ {query: {syncing_status?: number}},
183
+ EmptyResponseData,
184
+ EmptyMeta
185
+ >;
186
+ };
187
+
188
+ export function getDefinitions(_config: ChainForkConfig): RouteDefinitions<Endpoints> {
189
+ return {
190
+ getNetworkIdentity: {
191
+ url: "/eth/v1/node/identity",
192
+ method: "GET",
193
+ req: EmptyRequestCodec,
194
+ resp: {
195
+ onlySupport: WireFormat.json,
196
+ // TODO Fulu: clean this up
197
+ data: {
198
+ ...JsonOnlyResponseCodec.data,
199
+ toJson: (data) => {
200
+ const json = NetworkIdentityType.toJson(data);
201
+ const {custodyGroupCount} = data.metadata;
202
+ (json as {metadata: {custody_group_count: string | undefined}}).metadata.custody_group_count =
203
+ custodyGroupCount !== undefined ? String(custodyGroupCount) : undefined;
204
+ return json;
205
+ },
206
+ fromJson: (json) => {
207
+ const data = NetworkIdentityType.fromJson(json);
208
+ const {
209
+ metadata: {custody_group_count},
210
+ } = json as {metadata: {custody_group_count: string | undefined}};
211
+ (data.metadata as Partial<fulu.Metadata>).custodyGroupCount =
212
+ custody_group_count !== undefined ? parseInt(custody_group_count) : undefined;
213
+ return data;
214
+ },
215
+ },
216
+ meta: EmptyMetaCodec,
217
+ },
218
+ },
219
+ getPeers: {
220
+ url: "/eth/v1/node/peers",
221
+ method: "GET",
222
+ req: {
223
+ writeReq: ({state, direction}) => ({query: {state, direction}}),
224
+ parseReq: ({query}) => ({state: query.state, direction: query.direction}),
225
+ schema: {query: {state: Schema.StringArray, direction: Schema.StringArray}},
226
+ },
227
+ resp: {
228
+ ...JsonOnlyResponseCodec,
229
+ meta: {
230
+ toJson: (d) => d,
231
+ fromJson: (d) => ({count: (d as PeersMeta).count}),
232
+ toHeadersObject: () => ({}),
233
+ fromHeaders: () => ({}) as PeersMeta,
234
+ },
235
+ transform: {
236
+ toResponse: (data, meta) => ({data, meta}),
237
+ fromResponse: (resp) => resp as {data: NodePeer[]; meta: PeersMeta},
238
+ },
239
+ },
240
+ },
241
+ getPeer: {
242
+ url: "/eth/v1/node/peers/{peer_id}",
243
+ method: "GET",
244
+ req: {
245
+ writeReq: ({peerId}) => ({params: {peer_id: peerId}}),
246
+ parseReq: ({params}) => ({peerId: params.peer_id}),
247
+ schema: {params: {peer_id: Schema.StringRequired}},
248
+ },
249
+ resp: JsonOnlyResponseCodec,
250
+ },
251
+ getPeerCount: {
252
+ url: "/eth/v1/node/peer_count",
253
+ method: "GET",
254
+ req: EmptyRequestCodec,
255
+ resp: {
256
+ data: PeerCountType,
257
+ meta: EmptyMetaCodec,
258
+ },
259
+ },
260
+ getNodeVersion: {
261
+ url: "/eth/v1/node/version",
262
+ method: "GET",
263
+ req: EmptyRequestCodec,
264
+ resp: JsonOnlyResponseCodec,
265
+ },
266
+ getSyncingStatus: {
267
+ url: "/eth/v1/node/syncing",
268
+ method: "GET",
269
+ req: EmptyRequestCodec,
270
+ resp: {
271
+ data: SyncingStatusType,
272
+ meta: EmptyMetaCodec,
273
+ },
274
+ },
275
+ getHealth: {
276
+ url: "/eth/v1/node/health",
277
+ method: "GET",
278
+ req: {
279
+ writeReq: ({syncingStatus}) => ({query: {syncing_status: syncingStatus}}),
280
+ parseReq: ({query}) => ({syncingStatus: query.syncing_status}),
281
+ schema: {query: {syncing_status: Schema.Uint}},
282
+ },
283
+ resp: EmptyResponseCodec,
284
+ },
285
+ };
286
+ }
@@ -0,0 +1,79 @@
1
+ import {CompactMultiProof, ProofType} from "@chainsafe/persistent-merkle-tree";
2
+ import {ByteListType, ContainerType} from "@chainsafe/ssz";
3
+ import {ChainForkConfig} from "@lodestar/config";
4
+ import {ssz} from "@lodestar/types";
5
+ import {fromHex, toHex} from "@lodestar/utils";
6
+ import {ArrayOf} from "../../utils/codecs.js";
7
+ import {Endpoint, RouteDefinitions, Schema} from "../../utils/index.js";
8
+ import {VersionCodec, VersionMeta} from "../../utils/metadata.js";
9
+
10
+ export const CompactMultiProofType = new ContainerType({
11
+ leaves: ArrayOf(ssz.Root, 10000),
12
+ descriptor: new ByteListType(2048),
13
+ });
14
+
15
+ export type Endpoints = {
16
+ /**
17
+ * Returns a multiproof of `descriptor` at the requested `stateId`.
18
+ * The requested `stateId` may not be available. Regular nodes only keep recent states in memory.
19
+ */
20
+ getStateProof: Endpoint<
21
+ "GET",
22
+ {stateId: string; descriptor: Uint8Array},
23
+ {params: {state_id: string}; query: {format: string}},
24
+ CompactMultiProof,
25
+ VersionMeta
26
+ >;
27
+ /**
28
+ * Returns a multiproof of `descriptor` at the requested `blockId`.
29
+ * The requested `blockId` may not be available. Regular nodes only keep recent states in memory.
30
+ */
31
+ getBlockProof: Endpoint<
32
+ "GET",
33
+ {blockId: string; descriptor: Uint8Array},
34
+ {params: {block_id: string}; query: {format: string}},
35
+ CompactMultiProof,
36
+ VersionMeta
37
+ >;
38
+ };
39
+
40
+ export function getDefinitions(_config: ChainForkConfig): RouteDefinitions<Endpoints> {
41
+ return {
42
+ getStateProof: {
43
+ url: "/eth/v0/beacon/proof/state/{state_id}",
44
+ method: "GET",
45
+ req: {
46
+ writeReq: ({stateId, descriptor}) => ({params: {state_id: stateId}, query: {format: toHex(descriptor)}}),
47
+ parseReq: ({params, query}) => ({stateId: params.state_id, descriptor: fromHex(query.format)}),
48
+ schema: {params: {state_id: Schema.StringRequired}, query: {format: Schema.StringRequired}},
49
+ },
50
+ resp: {
51
+ data: {
52
+ toJson: (data) => CompactMultiProofType.toJson(data),
53
+ fromJson: (data) => ({...CompactMultiProofType.fromJson(data), type: ProofType.compactMulti}),
54
+ serialize: (data) => CompactMultiProofType.serialize(data),
55
+ deserialize: (data) => ({...CompactMultiProofType.deserialize(data), type: ProofType.compactMulti}),
56
+ },
57
+ meta: VersionCodec,
58
+ },
59
+ },
60
+ getBlockProof: {
61
+ url: "/eth/v0/beacon/proof/block/{block_id}",
62
+ method: "GET",
63
+ req: {
64
+ writeReq: ({blockId, descriptor}) => ({params: {block_id: blockId}, query: {format: toHex(descriptor)}}),
65
+ parseReq: ({params, query}) => ({blockId: params.block_id, descriptor: fromHex(query.format)}),
66
+ schema: {params: {block_id: Schema.StringRequired}, query: {format: Schema.StringRequired}},
67
+ },
68
+ resp: {
69
+ data: {
70
+ toJson: (data) => CompactMultiProofType.toJson(data),
71
+ fromJson: (data) => ({...CompactMultiProofType.fromJson(data), type: ProofType.compactMulti}),
72
+ serialize: (data) => CompactMultiProofType.serialize(data),
73
+ deserialize: (data) => ({...CompactMultiProofType.deserialize(data), type: ProofType.compactMulti}),
74
+ },
75
+ meta: VersionCodec,
76
+ },
77
+ },
78
+ };
79
+ }