@lodestar/api 1.19.0 → 1.20.0-dev.0f3109f322

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,8 +1,8 @@
1
- import type { Api } from "./routes/index.js";
1
+ import type { Endpoints } from "./routes/index.js";
2
2
  import * as routes from "./routes/index.js";
3
3
  export { routes };
4
- export { getClient } from "./client/index.js";
5
- export type { Api };
6
- export type ApiNamespace = keyof Api;
7
- export declare const allNamespaces: (keyof Api)[];
4
+ export { getClient, type ApiClient } from "./client/index.js";
5
+ export type { Endpoints };
6
+ export type ApiNamespace = keyof Endpoints;
7
+ export declare const allNamespaces: (keyof Endpoints)[];
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/beacon/index.ts"],"names":[],"mappings":"AAEA,sEAAsE;AAEtE,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAC,MAAM,EAAC,CAAC;AAChB,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAK5C,MAAM,gBAAgB,GAA6B;IACjD,MAAM,EAAE,IAAI;IACZ,MAAM,EAAE,IAAI;IACZ,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,IAAI;IACZ,WAAW,EAAE,IAAI;IACjB,QAAQ,EAAE,IAAI;IACd,IAAI,EAAE,IAAI;IACV,KAAK,EAAE,IAAI;IACX,SAAS,EAAE,IAAI;CAChB,CAAC;AACF,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/beacon/index.ts"],"names":[],"mappings":"AAEA,sEAAsE;AAEtE,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAC,MAAM,EAAC,CAAC;AAChB,OAAO,EAAC,SAAS,EAAiB,MAAM,mBAAmB,CAAC;AAK5D,MAAM,gBAAgB,GAAmC;IACvD,MAAM,EAAE,IAAI;IACZ,MAAM,EAAE,IAAI;IACZ,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,IAAI;IACZ,WAAW,EAAE,IAAI;IACjB,QAAQ,EAAE,IAAI;IACd,IAAI,EAAE,IAAI;IACV,KAAK,EAAE,IAAI;IACX,SAAS,EAAE,IAAI;CAChB,CAAC;AACF,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAmB,CAAC"}
@@ -1,121 +1,275 @@
1
- import { ForkName } from "@lodestar/params";
1
+ import { ContainerType, ListCompositeType, ValueOf } from "@chainsafe/ssz";
2
2
  import { ChainForkConfig } from "@lodestar/config";
3
- import { phase0, allForks, Slot, Root, RootHex, deneb } from "@lodestar/types";
4
- import { RoutesData, ReturnTypes, ReqSerializers } from "../../../utils/index.js";
5
- import { HttpStatusCode } from "../../../utils/client/httpStatusCode.js";
6
- import { ApiClientResponse, ResponseFormat } from "../../../interfaces.js";
7
- export type BlockId = RootHex | Slot | "head" | "genesis" | "finalized";
8
- /**
9
- * True if the response references an unverified execution payload. Optimistic information may be invalidated at
10
- * a later time. If the field is not present, assume the False value.
11
- */
12
- export type ExecutionOptimistic = boolean;
13
- /**
14
- * True if the response references the finalized history of the chain, as determined by fork choice.
15
- */
16
- export type Finalized = boolean;
17
- export type BlockHeaderResponse = {
18
- root: Root;
19
- canonical: boolean;
20
- header: phase0.SignedBeaconBlockHeader;
3
+ import { Slot, RootHex, deneb, SignedBeaconBlock, BeaconBlockBody, SignedBeaconBlockOrContents, SignedBlindedBeaconBlock } from "@lodestar/types";
4
+ import { ForkPreExecution } from "@lodestar/params";
5
+ import { Endpoint, RouteDefinitions } from "../../../utils/index.js";
6
+ import { EmptyMeta, EmptyResponseData } from "../../../utils/codecs.js";
7
+ import { ExecutionOptimisticAndFinalizedMeta, ExecutionOptimisticFinalizedAndVersionMeta, MetaHeader } from "../../../utils/metadata.js";
8
+ export declare const BlockHeaderResponseType: ContainerType<{
9
+ root: import("@chainsafe/ssz").ByteVectorType;
10
+ canonical: import("@chainsafe/ssz").BooleanType;
11
+ header: ContainerType<{
12
+ message: ContainerType<{
13
+ slot: import("@chainsafe/ssz").UintNumberType;
14
+ proposerIndex: import("@chainsafe/ssz").UintNumberType;
15
+ parentRoot: import("@chainsafe/ssz").ByteVectorType;
16
+ stateRoot: import("@chainsafe/ssz").ByteVectorType;
17
+ bodyRoot: import("@chainsafe/ssz").ByteVectorType;
18
+ }>;
19
+ signature: import("@chainsafe/ssz").ByteVectorType;
20
+ }>;
21
+ }>;
22
+ export declare const BlockHeadersResponseType: ListCompositeType<ContainerType<{
23
+ root: import("@chainsafe/ssz").ByteVectorType;
24
+ canonical: import("@chainsafe/ssz").BooleanType;
25
+ header: ContainerType<{
26
+ message: ContainerType<{
27
+ slot: import("@chainsafe/ssz").UintNumberType;
28
+ proposerIndex: import("@chainsafe/ssz").UintNumberType;
29
+ parentRoot: import("@chainsafe/ssz").ByteVectorType;
30
+ stateRoot: import("@chainsafe/ssz").ByteVectorType;
31
+ bodyRoot: import("@chainsafe/ssz").ByteVectorType;
32
+ }>;
33
+ signature: import("@chainsafe/ssz").ByteVectorType;
34
+ }>;
35
+ }>>;
36
+ export declare const RootResponseType: ContainerType<{
37
+ root: import("@chainsafe/ssz").ByteVectorType;
38
+ }>;
39
+ export declare const SignedBlockContentsType: ContainerType<{
40
+ signedBlock: ContainerType<{
41
+ message: ContainerType<{
42
+ body: ContainerType<{
43
+ executionPayload: ContainerType<{
44
+ blobGasUsed: import("@chainsafe/ssz").UintBigintType;
45
+ excessBlobGas: import("@chainsafe/ssz").UintBigintType;
46
+ withdrawals: ListCompositeType<ContainerType<{
47
+ index: import("@chainsafe/ssz").UintNumberType;
48
+ validatorIndex: import("@chainsafe/ssz").UintNumberType;
49
+ address: import("@lodestar/types/lib/utils/executionAddress.js").ExecutionAddressType;
50
+ amount: import("@chainsafe/ssz").UintBigintType;
51
+ }>>;
52
+ transactions: ListCompositeType<import("@chainsafe/ssz").ByteListType>;
53
+ parentHash: import("@chainsafe/ssz").ByteVectorType;
54
+ feeRecipient: import("@lodestar/types/lib/utils/executionAddress.js").ExecutionAddressType;
55
+ stateRoot: import("@chainsafe/ssz").ByteVectorType;
56
+ receiptsRoot: import("@chainsafe/ssz").ByteVectorType;
57
+ logsBloom: import("@chainsafe/ssz").ByteVectorType;
58
+ prevRandao: import("@chainsafe/ssz").ByteVectorType;
59
+ blockNumber: import("@chainsafe/ssz").UintNumberType;
60
+ gasLimit: import("@chainsafe/ssz").UintNumberType;
61
+ gasUsed: import("@chainsafe/ssz").UintNumberType;
62
+ timestamp: import("@chainsafe/ssz").UintNumberType;
63
+ extraData: import("@chainsafe/ssz").ByteListType;
64
+ baseFeePerGas: import("@chainsafe/ssz").UintBigintType;
65
+ blockHash: import("@chainsafe/ssz").ByteVectorType;
66
+ }>;
67
+ blsToExecutionChanges: ListCompositeType<ContainerType<{
68
+ message: ContainerType<{
69
+ validatorIndex: import("@chainsafe/ssz").UintNumberType;
70
+ fromBlsPubkey: import("@chainsafe/ssz").ByteVectorType;
71
+ toExecutionAddress: import("@lodestar/types/lib/utils/executionAddress.js").ExecutionAddressType;
72
+ }>;
73
+ signature: import("@chainsafe/ssz").ByteVectorType;
74
+ }>>;
75
+ blobKzgCommitments: ListCompositeType<import("@chainsafe/ssz").ByteVectorType>;
76
+ syncAggregate: ContainerType<{
77
+ syncCommitteeBits: import("@chainsafe/ssz").BitVectorType;
78
+ syncCommitteeSignature: import("@chainsafe/ssz").ByteVectorType;
79
+ }>;
80
+ randaoReveal: import("@chainsafe/ssz").ByteVectorType;
81
+ eth1Data: ContainerType<{
82
+ depositRoot: import("@chainsafe/ssz").ByteVectorType;
83
+ depositCount: import("@chainsafe/ssz").UintNumberType;
84
+ blockHash: import("@chainsafe/ssz").ByteVectorType;
85
+ }>;
86
+ graffiti: import("@chainsafe/ssz").ByteVectorType;
87
+ proposerSlashings: ListCompositeType<ContainerType<{
88
+ signedHeader1: ContainerType<{
89
+ message: ContainerType<{
90
+ slot: import("@chainsafe/ssz").UintBigintType;
91
+ proposerIndex: import("@chainsafe/ssz").UintNumberType;
92
+ parentRoot: import("@chainsafe/ssz").ByteVectorType;
93
+ stateRoot: import("@chainsafe/ssz").ByteVectorType;
94
+ bodyRoot: import("@chainsafe/ssz").ByteVectorType;
95
+ }>;
96
+ signature: import("@chainsafe/ssz").ByteVectorType;
97
+ }>;
98
+ signedHeader2: ContainerType<{
99
+ message: ContainerType<{
100
+ slot: import("@chainsafe/ssz").UintBigintType;
101
+ proposerIndex: import("@chainsafe/ssz").UintNumberType;
102
+ parentRoot: import("@chainsafe/ssz").ByteVectorType;
103
+ stateRoot: import("@chainsafe/ssz").ByteVectorType;
104
+ bodyRoot: import("@chainsafe/ssz").ByteVectorType;
105
+ }>;
106
+ signature: import("@chainsafe/ssz").ByteVectorType;
107
+ }>;
108
+ }>>;
109
+ attesterSlashings: ListCompositeType<ContainerType<{
110
+ attestation1: ContainerType<{
111
+ attestingIndices: import("@chainsafe/ssz").ListBasicType<import("@chainsafe/ssz").UintNumberType>;
112
+ data: ContainerType<{
113
+ slot: import("@chainsafe/ssz").UintBigintType;
114
+ index: import("@chainsafe/ssz").UintBigintType;
115
+ beaconBlockRoot: import("@chainsafe/ssz").ByteVectorType;
116
+ source: ContainerType<{
117
+ epoch: import("@chainsafe/ssz").UintBigintType;
118
+ root: import("@chainsafe/ssz").ByteVectorType;
119
+ }>;
120
+ target: ContainerType<{
121
+ epoch: import("@chainsafe/ssz").UintBigintType;
122
+ root: import("@chainsafe/ssz").ByteVectorType;
123
+ }>;
124
+ }>;
125
+ signature: import("@chainsafe/ssz").ByteVectorType;
126
+ }>;
127
+ attestation2: ContainerType<{
128
+ attestingIndices: import("@chainsafe/ssz").ListBasicType<import("@chainsafe/ssz").UintNumberType>;
129
+ data: ContainerType<{
130
+ slot: import("@chainsafe/ssz").UintBigintType;
131
+ index: import("@chainsafe/ssz").UintBigintType;
132
+ beaconBlockRoot: import("@chainsafe/ssz").ByteVectorType;
133
+ source: ContainerType<{
134
+ epoch: import("@chainsafe/ssz").UintBigintType;
135
+ root: import("@chainsafe/ssz").ByteVectorType;
136
+ }>;
137
+ target: ContainerType<{
138
+ epoch: import("@chainsafe/ssz").UintBigintType;
139
+ root: import("@chainsafe/ssz").ByteVectorType;
140
+ }>;
141
+ }>;
142
+ signature: import("@chainsafe/ssz").ByteVectorType;
143
+ }>;
144
+ }>>;
145
+ attestations: ListCompositeType<ContainerType<{
146
+ aggregationBits: import("@chainsafe/ssz").BitListType;
147
+ data: ContainerType<{
148
+ slot: import("@chainsafe/ssz").UintNumberType;
149
+ index: import("@chainsafe/ssz").UintNumberType;
150
+ beaconBlockRoot: import("@chainsafe/ssz").ByteVectorType;
151
+ source: ContainerType<{
152
+ epoch: import("@chainsafe/ssz").UintNumberType;
153
+ root: import("@chainsafe/ssz").ByteVectorType;
154
+ }>;
155
+ target: ContainerType<{
156
+ epoch: import("@chainsafe/ssz").UintNumberType;
157
+ root: import("@chainsafe/ssz").ByteVectorType;
158
+ }>;
159
+ }>;
160
+ signature: import("@chainsafe/ssz").ByteVectorType;
161
+ }>>;
162
+ deposits: ListCompositeType<ContainerType<{
163
+ proof: import("@chainsafe/ssz").VectorCompositeType<import("@chainsafe/ssz").ByteVectorType>;
164
+ data: ContainerType<{
165
+ pubkey: import("@chainsafe/ssz").ByteVectorType;
166
+ withdrawalCredentials: import("@chainsafe/ssz").ByteVectorType;
167
+ amount: import("@chainsafe/ssz").UintNumberType;
168
+ signature: import("@chainsafe/ssz").ByteVectorType;
169
+ }>;
170
+ }>>;
171
+ voluntaryExits: ListCompositeType<ContainerType<{
172
+ message: ContainerType<{
173
+ epoch: import("@chainsafe/ssz").UintNumberType;
174
+ validatorIndex: import("@chainsafe/ssz").UintNumberType;
175
+ }>;
176
+ signature: import("@chainsafe/ssz").ByteVectorType;
177
+ }>>;
178
+ }>;
179
+ slot: import("@chainsafe/ssz").UintNumberType;
180
+ proposerIndex: import("@chainsafe/ssz").UintNumberType;
181
+ parentRoot: import("@chainsafe/ssz").ByteVectorType;
182
+ stateRoot: import("@chainsafe/ssz").ByteVectorType;
183
+ }>;
184
+ signature: import("@chainsafe/ssz").ByteVectorType;
185
+ }>;
186
+ kzgProofs: ListCompositeType<import("@chainsafe/ssz").ByteVectorType>;
187
+ blobs: ListCompositeType<import("@chainsafe/ssz").ByteVectorType>;
188
+ }>;
189
+ export type BlockHeaderResponse = ValueOf<typeof BlockHeaderResponseType>;
190
+ export type BlockHeadersResponse = ValueOf<typeof BlockHeadersResponseType>;
191
+ export type RootResponse = ValueOf<typeof RootResponseType>;
192
+ export type SignedBlockContents = ValueOf<typeof SignedBlockContentsType>;
193
+ export type BlockId = RootHex | Slot | "head" | "genesis" | "finalized" | "justified";
194
+ export type BlockArgs = {
195
+ /**
196
+ * Block identifier.
197
+ * Can be one of: "head" (canonical head in node's view), "genesis", "finalized", "justified", \<slot\>, \<hex encoded blockRoot with 0x prefix\>.
198
+ */
199
+ blockId: BlockId;
21
200
  };
22
201
  export declare enum BroadcastValidation {
202
+ /**
203
+ NOTE: The value `none` is not part of the spec.
204
+
205
+ In case a node is configured only with the unknownBlockSync, it needs to know the unknown parent blocks on the network
206
+ to initiate the syncing process. Such cases can be covered only if we publish blocks and make sure no gossip validation
207
+ is performed on those. But this behavior is not the default.
208
+ */
23
209
  none = "none",
24
210
  gossip = "gossip",
25
211
  consensus = "consensus",
26
212
  consensusAndEquivocation = "consensus_and_equivocation"
27
213
  }
28
- export type BlockResponse<T extends ResponseFormat = "json"> = T extends "ssz" ? ApiClientResponse<{
29
- [HttpStatusCode.OK]: Uint8Array;
30
- }, HttpStatusCode.BAD_REQUEST | HttpStatusCode.NOT_FOUND> : ApiClientResponse<{
31
- [HttpStatusCode.OK]: {
32
- data: allForks.SignedBeaconBlock;
33
- };
34
- }, HttpStatusCode.BAD_REQUEST | HttpStatusCode.NOT_FOUND>;
35
- export type BlockV2Response<T extends ResponseFormat = "json"> = T extends "ssz" ? ApiClientResponse<{
36
- [HttpStatusCode.OK]: Uint8Array;
37
- }, HttpStatusCode.BAD_REQUEST | HttpStatusCode.NOT_FOUND> : ApiClientResponse<{
38
- [HttpStatusCode.OK]: {
39
- data: allForks.SignedBeaconBlock;
40
- executionOptimistic: ExecutionOptimistic;
41
- finalized: Finalized;
42
- version: ForkName;
43
- };
44
- }, HttpStatusCode.BAD_REQUEST | HttpStatusCode.NOT_FOUND>;
45
- export type Api = {
214
+ export type Endpoints = {
46
215
  /**
47
216
  * Get block
48
- * Returns the complete `SignedBeaconBlock` for a given block ID.
49
- * Depending on the `Accept` header it can be returned either as JSON or SSZ-serialized bytes.
50
- *
51
- * @param blockId Block identifier.
52
- * Can be one of: "head" (canonical head in node's view), "genesis", "finalized", \<slot\>, \<hex encoded blockRoot with 0x prefix\>.
217
+ * Retrieves block details for given block id.
53
218
  */
54
- getBlock<T extends ResponseFormat = "json">(blockId: BlockId, format?: T): Promise<BlockResponse<T>>;
219
+ getBlockV2: Endpoint<"GET", BlockArgs, {
220
+ params: {
221
+ block_id: string;
222
+ };
223
+ }, SignedBeaconBlock, ExecutionOptimisticFinalizedAndVersionMeta>;
55
224
  /**
56
- * Get block
57
- * Retrieves block details for given block id.
58
- * @param blockId Block identifier.
59
- * Can be one of: "head" (canonical head in node's view), "genesis", "finalized", \<slot\>, \<hex encoded blockRoot with 0x prefix\>.
225
+ * Get blinded block
226
+ * Retrieves blinded block for given block id.
60
227
  */
61
- getBlockV2<T extends ResponseFormat = "json">(blockId: BlockId, format?: T): Promise<BlockV2Response<T>>;
228
+ getBlindedBlock: Endpoint<"GET", BlockArgs, {
229
+ params: {
230
+ block_id: string;
231
+ };
232
+ }, SignedBlindedBeaconBlock | SignedBeaconBlock<ForkPreExecution>, ExecutionOptimisticFinalizedAndVersionMeta>;
62
233
  /**
63
234
  * Get block attestations
64
235
  * Retrieves attestation included in requested block.
65
- * @param blockId Block identifier.
66
- * Can be one of: "head" (canonical head in node's view), "genesis", "finalized", \<slot\>, \<hex encoded blockRoot with 0x prefix\>.
67
236
  */
68
- getBlockAttestations(blockId: BlockId): Promise<ApiClientResponse<{
69
- [HttpStatusCode.OK]: {
70
- data: phase0.Attestation[];
71
- executionOptimistic: ExecutionOptimistic;
72
- finalized: Finalized;
237
+ getBlockAttestations: Endpoint<"GET", BlockArgs, {
238
+ params: {
239
+ block_id: string;
73
240
  };
74
- }, HttpStatusCode.BAD_REQUEST | HttpStatusCode.NOT_FOUND>>;
241
+ }, BeaconBlockBody["attestations"], ExecutionOptimisticAndFinalizedMeta>;
75
242
  /**
76
243
  * Get block header
77
244
  * Retrieves block header for given block id.
78
- * @param blockId Block identifier.
79
- * Can be one of: "head" (canonical head in node's view), "genesis", "finalized", \<slot\>, \<hex encoded blockRoot with 0x prefix\>.
80
245
  */
81
- getBlockHeader(blockId: BlockId): Promise<ApiClientResponse<{
82
- [HttpStatusCode.OK]: {
83
- data: BlockHeaderResponse;
84
- executionOptimistic: ExecutionOptimistic;
85
- finalized: Finalized;
246
+ getBlockHeader: Endpoint<"GET", BlockArgs, {
247
+ params: {
248
+ block_id: string;
86
249
  };
87
- }, HttpStatusCode.BAD_REQUEST | HttpStatusCode.NOT_FOUND>>;
250
+ }, BlockHeaderResponse, ExecutionOptimisticAndFinalizedMeta>;
88
251
  /**
89
252
  * Get block headers
90
253
  * Retrieves block headers matching given query. By default it will fetch current head slot blocks.
91
- * @param slot
92
- * @param parentRoot
93
254
  */
94
- getBlockHeaders(filters: Partial<{
95
- slot: Slot;
96
- parentRoot: string;
97
- }>): Promise<ApiClientResponse<{
98
- [HttpStatusCode.OK]: {
99
- data: BlockHeaderResponse[];
100
- executionOptimistic: ExecutionOptimistic;
101
- finalized: Finalized;
255
+ getBlockHeaders: Endpoint<"GET", {
256
+ slot?: Slot;
257
+ parentRoot?: string;
258
+ }, {
259
+ query: {
260
+ slot?: number;
261
+ parent_root?: string;
102
262
  };
103
- }, HttpStatusCode.BAD_REQUEST>>;
263
+ }, BlockHeaderResponse[], ExecutionOptimisticAndFinalizedMeta>;
104
264
  /**
105
265
  * Get block root
106
266
  * Retrieves hashTreeRoot of BeaconBlock/BeaconBlockHeader
107
- * @param blockId Block identifier.
108
- * Can be one of: "head" (canonical head in node's view), "genesis", "finalized", \<slot\>, \<hex encoded blockRoot with 0x prefix\>.
109
267
  */
110
- getBlockRoot(blockId: BlockId): Promise<ApiClientResponse<{
111
- [HttpStatusCode.OK]: {
112
- data: {
113
- root: Root;
114
- };
115
- executionOptimistic: ExecutionOptimistic;
116
- finalized: Finalized;
268
+ getBlockRoot: Endpoint<"GET", BlockArgs, {
269
+ params: {
270
+ block_id: string;
117
271
  };
118
- }, HttpStatusCode.BAD_REQUEST | HttpStatusCode.NOT_FOUND>>;
272
+ }, RootResponse, ExecutionOptimisticAndFinalizedMeta>;
119
273
  /**
120
274
  * Publish a signed block.
121
275
  * Instructs the beacon node to broadcast a newly signed beacon block to the beacon network,
@@ -125,105 +279,70 @@ export type Api = {
125
279
  * therefore validate the block internally, however blocks which fail the validation are still
126
280
  * broadcast but a different status code is returned (202)
127
281
  *
128
- * @param requestBody The `SignedBeaconBlock` object composed of `BeaconBlock` object (produced by beacon node) and validator signature.
129
- * @returns any The block was validated successfully and has been broadcast. It has also been integrated into the beacon node's database.
282
+ * Returns if the block was validated successfully and has been broadcast. It has also been integrated into the beacon node's database.
130
283
  */
131
- publishBlock(blockOrContents: allForks.SignedBeaconBlockOrContents): Promise<ApiClientResponse<{
132
- [HttpStatusCode.OK]: void;
133
- [HttpStatusCode.ACCEPTED]: void;
134
- }, HttpStatusCode.BAD_REQUEST | HttpStatusCode.SERVICE_UNAVAILABLE>>;
135
- publishBlockV2(blockOrContents: allForks.SignedBeaconBlockOrContents, opts?: {
284
+ publishBlock: Endpoint<"POST", {
285
+ signedBlockOrContents: SignedBeaconBlockOrContents;
286
+ }, {
287
+ body: unknown;
288
+ headers: {
289
+ [MetaHeader.Version]: string;
290
+ };
291
+ }, EmptyResponseData, EmptyMeta>;
292
+ publishBlockV2: Endpoint<"POST", {
293
+ signedBlockOrContents: SignedBeaconBlockOrContents;
136
294
  broadcastValidation?: BroadcastValidation;
137
- }): Promise<ApiClientResponse<{
138
- [HttpStatusCode.OK]: void;
139
- [HttpStatusCode.ACCEPTED]: void;
140
- }, HttpStatusCode.BAD_REQUEST | HttpStatusCode.SERVICE_UNAVAILABLE>>;
295
+ }, {
296
+ body: unknown;
297
+ headers: {
298
+ [MetaHeader.Version]: string;
299
+ };
300
+ query: {
301
+ broadcast_validation?: string;
302
+ };
303
+ }, EmptyResponseData, EmptyMeta>;
141
304
  /**
142
305
  * Publish a signed blinded block by submitting it to the mev relay and patching in the block
143
306
  * transactions beacon node gets in response.
144
307
  */
145
- publishBlindedBlock(blindedBlock: allForks.SignedBlindedBeaconBlock): Promise<ApiClientResponse<{
146
- [HttpStatusCode.OK]: void;
147
- [HttpStatusCode.ACCEPTED]: void;
148
- }, HttpStatusCode.BAD_REQUEST | HttpStatusCode.SERVICE_UNAVAILABLE>>;
149
- publishBlindedBlockV2(blindedBlockOrContents: allForks.SignedBlindedBeaconBlock, opts: {
150
- broadcastValidation?: BroadcastValidation;
151
- }): Promise<ApiClientResponse<{
152
- [HttpStatusCode.OK]: void;
153
- [HttpStatusCode.ACCEPTED]: void;
154
- }, HttpStatusCode.BAD_REQUEST | HttpStatusCode.SERVICE_UNAVAILABLE>>;
155
- /**
156
- * Get block BlobSidecar
157
- * Retrieves BlobSidecar included in requested block.
158
- * @param blockId Block identifier.
159
- * Can be one of: "head" (canonical head in node's view), "genesis", "finalized", \<slot\>, \<hex encoded blockRoot with 0x prefix\>.
160
- * @param indices Array of indices for blob sidecars to request for in the specified block. Returns all blob sidecars in the block if not specified.
161
- */
162
- getBlobSidecars(blockId: BlockId, indices?: number[]): Promise<ApiClientResponse<{
163
- [HttpStatusCode.OK]: {
164
- data: deneb.BlobSidecars;
165
- executionOptimistic: ExecutionOptimistic;
166
- finalized: Finalized;
167
- };
168
- }>>;
169
- };
170
- /**
171
- * Define javascript values for each route
172
- */
173
- export declare const routesData: RoutesData<Api>;
174
- type GetBlockReq = {
175
- params: {
176
- block_id: string;
177
- };
178
- headers: {
179
- accept?: string;
180
- };
181
- };
182
- type BlockIdOnlyReq = {
183
- params: {
184
- block_id: string;
185
- };
186
- };
187
- export type ReqTypes = {
188
- getBlock: GetBlockReq;
189
- getBlockV2: GetBlockReq;
190
- getBlockAttestations: BlockIdOnlyReq;
191
- getBlockHeader: BlockIdOnlyReq;
192
- getBlockHeaders: {
193
- query: {
194
- slot?: number;
195
- parent_root?: string;
196
- };
197
- };
198
- getBlockRoot: BlockIdOnlyReq;
199
- publishBlock: {
200
- body: unknown;
201
- };
202
- publishBlockV2: {
308
+ publishBlindedBlock: Endpoint<"POST", {
309
+ signedBlindedBlock: SignedBlindedBeaconBlock;
310
+ }, {
203
311
  body: unknown;
204
- query: {
205
- broadcast_validation?: string;
312
+ headers: {
313
+ [MetaHeader.Version]: string;
206
314
  };
207
- };
208
- publishBlindedBlock: {
209
- body: unknown;
210
- };
211
- publishBlindedBlockV2: {
315
+ }, EmptyResponseData, EmptyMeta>;
316
+ publishBlindedBlockV2: Endpoint<"POST", {
317
+ signedBlindedBlock: SignedBlindedBeaconBlock;
318
+ broadcastValidation?: BroadcastValidation;
319
+ }, {
212
320
  body: unknown;
321
+ headers: {
322
+ [MetaHeader.Version]: string;
323
+ };
213
324
  query: {
214
325
  broadcast_validation?: string;
215
326
  };
216
- };
217
- getBlobSidecars: {
327
+ }, EmptyResponseData, EmptyMeta>;
328
+ /**
329
+ * Get block BlobSidecar
330
+ * Retrieves BlobSidecar included in requested block.
331
+ */
332
+ getBlobSidecars: Endpoint<"GET", BlockArgs & {
333
+ /**
334
+ * Array of indices for blob sidecars to request for in the specified block.
335
+ * Returns all blob sidecars in the block if not specified.
336
+ */
337
+ indices?: number[];
338
+ }, {
218
339
  params: {
219
340
  block_id: string;
220
341
  };
221
342
  query: {
222
343
  indices?: number[];
223
344
  };
224
- };
345
+ }, deneb.BlobSidecars, ExecutionOptimisticFinalizedAndVersionMeta>;
225
346
  };
226
- export declare function getReqSerializers(config: ChainForkConfig): ReqSerializers<Api, ReqTypes>;
227
- export declare function getReturnTypes(): ReturnTypes<Api>;
228
- export {};
347
+ export declare function getDefinitions(config: ChainForkConfig): RouteDefinitions<Endpoints>;
229
348
  //# sourceMappingURL=block.d.ts.map