@lodestar/api 1.35.0-dev.39be8f0882 → 1.35.0-dev.3d8b04e1a0

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 (170) hide show
  1. package/lib/beacon/client/index.js.map +1 -1
  2. package/lib/beacon/index.d.ts +1 -1
  3. package/lib/beacon/index.js.map +1 -1
  4. package/lib/beacon/routes/beacon/index.d.ts +3 -3
  5. package/lib/beacon/routes/beacon/index.js.map +1 -1
  6. package/lib/beacon/routes/beacon/rewards.js.map +1 -1
  7. package/lib/beacon/routes/events.js.map +1 -1
  8. package/lib/beacon/routes/index.js.map +1 -1
  9. package/lib/beacon/server/index.d.ts +1 -1
  10. package/lib/beacon/server/index.js.map +1 -1
  11. package/lib/builder/index.js.map +1 -1
  12. package/lib/builder/routes.js.map +1 -1
  13. package/lib/builder/server/index.d.ts +1 -1
  14. package/lib/index.d.ts +6 -6
  15. package/lib/index.js +3 -3
  16. package/lib/index.js.map +1 -1
  17. package/lib/keymanager/index.d.ts +2 -2
  18. package/lib/keymanager/index.js +2 -1
  19. package/lib/keymanager/index.js.map +1 -1
  20. package/lib/keymanager/server/index.d.ts +1 -1
  21. package/lib/utils/client/httpClient.d.ts +2 -1
  22. package/lib/utils/client/httpClient.js +2 -1
  23. package/lib/utils/client/httpClient.js.map +1 -1
  24. package/lib/utils/client/index.d.ts +1 -1
  25. package/lib/utils/client/index.js +1 -1
  26. package/lib/utils/client/index.js.map +1 -1
  27. package/lib/utils/server/route.js.map +1 -1
  28. package/package.json +11 -17
  29. package/lib/beacon/client/beacon.d.ts.map +0 -1
  30. package/lib/beacon/client/config.d.ts.map +0 -1
  31. package/lib/beacon/client/debug.d.ts.map +0 -1
  32. package/lib/beacon/client/events.d.ts.map +0 -1
  33. package/lib/beacon/client/index.d.ts.map +0 -1
  34. package/lib/beacon/client/lightclient.d.ts.map +0 -1
  35. package/lib/beacon/client/lodestar.d.ts.map +0 -1
  36. package/lib/beacon/client/node.d.ts.map +0 -1
  37. package/lib/beacon/client/proof.d.ts.map +0 -1
  38. package/lib/beacon/client/validator.d.ts.map +0 -1
  39. package/lib/beacon/index.d.ts.map +0 -1
  40. package/lib/beacon/routes/beacon/block.d.ts.map +0 -1
  41. package/lib/beacon/routes/beacon/index.d.ts.map +0 -1
  42. package/lib/beacon/routes/beacon/pool.d.ts.map +0 -1
  43. package/lib/beacon/routes/beacon/rewards.d.ts.map +0 -1
  44. package/lib/beacon/routes/beacon/state.d.ts.map +0 -1
  45. package/lib/beacon/routes/config.d.ts.map +0 -1
  46. package/lib/beacon/routes/debug.d.ts.map +0 -1
  47. package/lib/beacon/routes/events.d.ts.map +0 -1
  48. package/lib/beacon/routes/index.d.ts.map +0 -1
  49. package/lib/beacon/routes/lightclient.d.ts.map +0 -1
  50. package/lib/beacon/routes/lodestar.d.ts.map +0 -1
  51. package/lib/beacon/routes/node.d.ts.map +0 -1
  52. package/lib/beacon/routes/proof.d.ts.map +0 -1
  53. package/lib/beacon/routes/validator.d.ts.map +0 -1
  54. package/lib/beacon/server/beacon.d.ts.map +0 -1
  55. package/lib/beacon/server/config.d.ts.map +0 -1
  56. package/lib/beacon/server/debug.d.ts.map +0 -1
  57. package/lib/beacon/server/events.d.ts.map +0 -1
  58. package/lib/beacon/server/index.d.ts.map +0 -1
  59. package/lib/beacon/server/lightclient.d.ts.map +0 -1
  60. package/lib/beacon/server/lodestar.d.ts.map +0 -1
  61. package/lib/beacon/server/node.d.ts.map +0 -1
  62. package/lib/beacon/server/proof.d.ts.map +0 -1
  63. package/lib/beacon/server/validator.d.ts.map +0 -1
  64. package/lib/builder/client.d.ts.map +0 -1
  65. package/lib/builder/index.d.ts.map +0 -1
  66. package/lib/builder/routes.d.ts.map +0 -1
  67. package/lib/builder/server/index.d.ts.map +0 -1
  68. package/lib/index.d.ts.map +0 -1
  69. package/lib/keymanager/client.d.ts.map +0 -1
  70. package/lib/keymanager/index.d.ts.map +0 -1
  71. package/lib/keymanager/routes.d.ts.map +0 -1
  72. package/lib/keymanager/server/index.d.ts.map +0 -1
  73. package/lib/server/index.d.ts.map +0 -1
  74. package/lib/utils/client/error.d.ts.map +0 -1
  75. package/lib/utils/client/eventSource.d.ts.map +0 -1
  76. package/lib/utils/client/format.d.ts.map +0 -1
  77. package/lib/utils/client/httpClient.d.ts.map +0 -1
  78. package/lib/utils/client/index.d.ts.map +0 -1
  79. package/lib/utils/client/method.d.ts.map +0 -1
  80. package/lib/utils/client/metrics.d.ts.map +0 -1
  81. package/lib/utils/client/request.d.ts.map +0 -1
  82. package/lib/utils/client/response.d.ts.map +0 -1
  83. package/lib/utils/codecs.d.ts.map +0 -1
  84. package/lib/utils/fork.d.ts.map +0 -1
  85. package/lib/utils/headers.d.ts.map +0 -1
  86. package/lib/utils/httpStatusCode.d.ts.map +0 -1
  87. package/lib/utils/index.d.ts.map +0 -1
  88. package/lib/utils/metadata.d.ts.map +0 -1
  89. package/lib/utils/schema.d.ts.map +0 -1
  90. package/lib/utils/serdes.d.ts.map +0 -1
  91. package/lib/utils/server/error.d.ts.map +0 -1
  92. package/lib/utils/server/handler.d.ts.map +0 -1
  93. package/lib/utils/server/index.d.ts.map +0 -1
  94. package/lib/utils/server/method.d.ts.map +0 -1
  95. package/lib/utils/server/parser.d.ts.map +0 -1
  96. package/lib/utils/server/route.d.ts.map +0 -1
  97. package/lib/utils/types.d.ts.map +0 -1
  98. package/lib/utils/urlFormat.d.ts.map +0 -1
  99. package/lib/utils/wireFormat.d.ts.map +0 -1
  100. package/src/beacon/client/beacon.ts +0 -12
  101. package/src/beacon/client/config.ts +0 -12
  102. package/src/beacon/client/debug.ts +0 -12
  103. package/src/beacon/client/events.ts +0 -69
  104. package/src/beacon/client/index.ts +0 -46
  105. package/src/beacon/client/lightclient.ts +0 -12
  106. package/src/beacon/client/lodestar.ts +0 -12
  107. package/src/beacon/client/node.ts +0 -12
  108. package/src/beacon/client/proof.ts +0 -12
  109. package/src/beacon/client/validator.ts +0 -12
  110. package/src/beacon/index.ts +0 -24
  111. package/src/beacon/routes/beacon/block.ts +0 -602
  112. package/src/beacon/routes/beacon/index.ts +0 -66
  113. package/src/beacon/routes/beacon/pool.ts +0 -503
  114. package/src/beacon/routes/beacon/rewards.ts +0 -216
  115. package/src/beacon/routes/beacon/state.ts +0 -588
  116. package/src/beacon/routes/config.ts +0 -114
  117. package/src/beacon/routes/debug.ts +0 -231
  118. package/src/beacon/routes/events.ts +0 -337
  119. package/src/beacon/routes/index.ts +0 -33
  120. package/src/beacon/routes/lightclient.ts +0 -241
  121. package/src/beacon/routes/lodestar.ts +0 -456
  122. package/src/beacon/routes/node.ts +0 -286
  123. package/src/beacon/routes/proof.ts +0 -79
  124. package/src/beacon/routes/validator.ts +0 -1014
  125. package/src/beacon/server/beacon.ts +0 -7
  126. package/src/beacon/server/config.ts +0 -7
  127. package/src/beacon/server/debug.ts +0 -7
  128. package/src/beacon/server/events.ts +0 -73
  129. package/src/beacon/server/index.ts +0 -55
  130. package/src/beacon/server/lightclient.ts +0 -7
  131. package/src/beacon/server/lodestar.ts +0 -7
  132. package/src/beacon/server/node.ts +0 -7
  133. package/src/beacon/server/proof.ts +0 -7
  134. package/src/beacon/server/validator.ts +0 -7
  135. package/src/builder/client.ts +0 -9
  136. package/src/builder/index.ts +0 -26
  137. package/src/builder/routes.ts +0 -227
  138. package/src/builder/server/index.ts +0 -19
  139. package/src/index.ts +0 -19
  140. package/src/keymanager/client.ts +0 -9
  141. package/src/keymanager/index.ts +0 -39
  142. package/src/keymanager/routes.ts +0 -699
  143. package/src/keymanager/server/index.ts +0 -19
  144. package/src/server/index.ts +0 -2
  145. package/src/utils/client/error.ts +0 -10
  146. package/src/utils/client/eventSource.ts +0 -7
  147. package/src/utils/client/format.ts +0 -22
  148. package/src/utils/client/httpClient.ts +0 -444
  149. package/src/utils/client/index.ts +0 -6
  150. package/src/utils/client/method.ts +0 -50
  151. package/src/utils/client/metrics.ts +0 -9
  152. package/src/utils/client/request.ts +0 -113
  153. package/src/utils/client/response.ts +0 -205
  154. package/src/utils/codecs.ts +0 -143
  155. package/src/utils/fork.ts +0 -44
  156. package/src/utils/headers.ts +0 -173
  157. package/src/utils/httpStatusCode.ts +0 -392
  158. package/src/utils/index.ts +0 -3
  159. package/src/utils/metadata.ts +0 -170
  160. package/src/utils/schema.ts +0 -141
  161. package/src/utils/serdes.ts +0 -120
  162. package/src/utils/server/error.ts +0 -9
  163. package/src/utils/server/handler.ts +0 -149
  164. package/src/utils/server/index.ts +0 -5
  165. package/src/utils/server/method.ts +0 -38
  166. package/src/utils/server/parser.ts +0 -15
  167. package/src/utils/server/route.ts +0 -45
  168. package/src/utils/types.ts +0 -161
  169. package/src/utils/urlFormat.ts +0 -112
  170. package/src/utils/wireFormat.ts +0 -24
@@ -1,216 +0,0 @@
1
- import {ContainerType, ValueOf} from "@chainsafe/ssz";
2
- import {ChainForkConfig} from "@lodestar/config";
3
- import {Epoch, ssz} from "@lodestar/types";
4
- import {ArrayOf, JsonOnlyReq} from "../../../utils/codecs.js";
5
- import {Endpoint, RouteDefinitions, Schema} from "../../../utils/index.js";
6
- import {ExecutionOptimisticAndFinalizedCodec, ExecutionOptimisticAndFinalizedMeta} from "../../../utils/metadata.js";
7
- import {fromValidatorIdsStr, toValidatorIdsStr} from "../../../utils/serdes.js";
8
- import {BlockArgs} from "./block.js";
9
- import {ValidatorId} from "./state.js";
10
-
11
- const BlockRewardsType = new ContainerType(
12
- {
13
- /** Proposer of the block, the proposer index who receives these rewards */
14
- proposerIndex: ssz.ValidatorIndex,
15
- /** Total block reward, equal to attestations + sync_aggregate + proposer_slashings + attester_slashings */
16
- total: ssz.UintNum64,
17
- /** Block reward component due to included attestations */
18
- attestations: ssz.UintNum64,
19
- /** Block reward component due to included sync_aggregate */
20
- syncAggregate: ssz.UintNum64,
21
- /** Block reward component due to included proposer_slashings */
22
- proposerSlashings: ssz.UintNum64,
23
- /** Block reward component due to included attester_slashings */
24
- attesterSlashings: ssz.UintNum64,
25
- },
26
- {jsonCase: "eth2"}
27
- );
28
-
29
- const AttestationsRewardType = new ContainerType(
30
- {
31
- /** Reward for head vote. Could be negative to indicate penalty */
32
- head: ssz.UintNum64,
33
- /** Reward for target vote. Could be negative to indicate penalty */
34
- target: ssz.UintNum64,
35
- /** Reward for source vote. Could be negative to indicate penalty */
36
- source: ssz.UintNum64,
37
- /** Inclusion delay reward (phase0 only) */
38
- inclusionDelay: ssz.UintNum64,
39
- /** Inactivity penalty. Should be a negative number to indicate penalty */
40
- inactivity: ssz.UintNum64,
41
- },
42
- {jsonCase: "eth2"}
43
- );
44
-
45
- const IdealAttestationsRewardsType = new ContainerType(
46
- {
47
- ...AttestationsRewardType.fields,
48
- effectiveBalance: ssz.UintNum64,
49
- },
50
- {jsonCase: "eth2"}
51
- );
52
-
53
- const TotalAttestationsRewardsType = new ContainerType(
54
- {
55
- ...AttestationsRewardType.fields,
56
- validatorIndex: ssz.ValidatorIndex,
57
- },
58
- {jsonCase: "eth2"}
59
- );
60
-
61
- const AttestationsRewardsType = new ContainerType(
62
- {
63
- idealRewards: ArrayOf(IdealAttestationsRewardsType),
64
- totalRewards: ArrayOf(TotalAttestationsRewardsType),
65
- },
66
- {jsonCase: "eth2"}
67
- );
68
-
69
- const SyncCommitteeRewardsType = ArrayOf(
70
- new ContainerType(
71
- {
72
- validatorIndex: ssz.ValidatorIndex,
73
- reward: ssz.UintNum64,
74
- },
75
- {jsonCase: "eth2"}
76
- )
77
- );
78
-
79
- /**
80
- * Rewards info for a single block. Every reward value is in Gwei.
81
- */
82
- export type BlockRewards = ValueOf<typeof BlockRewardsType>;
83
-
84
- /**
85
- * Rewards for a single set of (ideal or actual depending on usage) attestations. Reward value is in Gwei
86
- */
87
- export type AttestationsReward = ValueOf<typeof AttestationsRewardType>;
88
-
89
- /**
90
- * Rewards info for ideal attestations ie. Maximum rewards could be earned by making timely head, target and source vote.
91
- * `effectiveBalance` is in Gwei
92
- */
93
- export type IdealAttestationsReward = ValueOf<typeof IdealAttestationsRewardsType>;
94
-
95
- /**
96
- * Rewards info for actual attestations
97
- */
98
- export type TotalAttestationsReward = ValueOf<typeof TotalAttestationsRewardsType>;
99
-
100
- export type AttestationsRewards = ValueOf<typeof AttestationsRewardsType>;
101
-
102
- /**
103
- * Rewards info for sync committee participation. Every reward value is in Gwei.
104
- * Note: In the case that block proposer is present in `SyncCommitteeRewards`, the reward value only reflects rewards for
105
- * participating in sync committee. Please refer to `BlockRewards.syncAggregate` for rewards of proposer including sync committee
106
- * outputs into their block
107
- */
108
- export type SyncCommitteeRewards = ValueOf<typeof SyncCommitteeRewardsType>;
109
-
110
- export type Endpoints = {
111
- /**
112
- * Get block rewards
113
- * Returns the info of rewards received by the block proposer
114
- */
115
- getBlockRewards: Endpoint<
116
- "GET",
117
- BlockArgs,
118
- {params: {block_id: string}},
119
- BlockRewards,
120
- ExecutionOptimisticAndFinalizedMeta
121
- >;
122
-
123
- /**
124
- * Get attestations rewards
125
- * Negative values indicate penalties. `inactivity` can only be either 0 or negative number since it is penalty only
126
- */
127
- getAttestationsRewards: Endpoint<
128
- "POST",
129
- {
130
- /** The epoch to get rewards info from */
131
- epoch: Epoch;
132
- /** List of validator indices or pubkeys to filter in */
133
- validatorIds?: ValidatorId[];
134
- },
135
- {params: {epoch: number}; body: string[]},
136
- AttestationsRewards,
137
- ExecutionOptimisticAndFinalizedMeta
138
- >;
139
-
140
- /**
141
- * Get sync committee rewards
142
- * Returns participant reward value for each sync committee member at the given block.
143
- */
144
- getSyncCommitteeRewards: Endpoint<
145
- "POST",
146
- BlockArgs & {
147
- /** List of validator indices or pubkeys to filter in */
148
- validatorIds?: ValidatorId[];
149
- },
150
- {params: {block_id: string}; body: string[]},
151
- SyncCommitteeRewards,
152
- ExecutionOptimisticAndFinalizedMeta
153
- >;
154
- };
155
-
156
- export function getDefinitions(_config: ChainForkConfig): RouteDefinitions<Endpoints> {
157
- return {
158
- getBlockRewards: {
159
- url: "/eth/v1/beacon/rewards/blocks/{block_id}",
160
- method: "GET",
161
- req: {
162
- writeReq: ({blockId}) => ({params: {block_id: blockId.toString()}}),
163
- parseReq: ({params}) => ({blockId: params.block_id}),
164
- schema: {params: {block_id: Schema.StringRequired}},
165
- },
166
- resp: {
167
- data: BlockRewardsType,
168
- meta: ExecutionOptimisticAndFinalizedCodec,
169
- },
170
- },
171
- getAttestationsRewards: {
172
- url: "/eth/v1/beacon/rewards/attestations/{epoch}",
173
- method: "POST",
174
- req: JsonOnlyReq({
175
- writeReqJson: ({epoch, validatorIds}) => ({
176
- params: {epoch},
177
- body: toValidatorIdsStr(validatorIds) || [],
178
- }),
179
- parseReqJson: ({params, body}) => ({
180
- epoch: params.epoch,
181
- validatorIds: fromValidatorIdsStr(body),
182
- }),
183
- schema: {
184
- params: {epoch: Schema.UintRequired},
185
- body: Schema.UintOrStringArray,
186
- },
187
- }),
188
- resp: {
189
- data: AttestationsRewardsType,
190
- meta: ExecutionOptimisticAndFinalizedCodec,
191
- },
192
- },
193
- getSyncCommitteeRewards: {
194
- url: "/eth/v1/beacon/rewards/sync_committee/{block_id}",
195
- method: "POST",
196
- req: JsonOnlyReq({
197
- writeReqJson: ({blockId, validatorIds}) => ({
198
- params: {block_id: blockId.toString()},
199
- body: toValidatorIdsStr(validatorIds) || [],
200
- }),
201
- parseReqJson: ({params, body}) => ({
202
- blockId: params.block_id,
203
- validatorIds: fromValidatorIdsStr(body),
204
- }),
205
- schema: {
206
- params: {block_id: Schema.StringRequired},
207
- body: Schema.UintOrStringArray,
208
- },
209
- }),
210
- resp: {
211
- data: SyncCommitteeRewardsType,
212
- meta: ExecutionOptimisticAndFinalizedCodec,
213
- },
214
- },
215
- };
216
- }