@lodestar/api 1.20.0-dev.c1532773c2 → 1.20.0-dev.f20ec4efe8

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