@lodestar/api 1.20.0-dev.14855ea72f → 1.20.0-dev.1aba391b1b
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.
- package/README.md +10 -17
- package/lib/beacon/client/beacon.d.ts +4 -3
- package/lib/beacon/client/beacon.js +3 -36
- package/lib/beacon/client/beacon.js.map +1 -1
- package/lib/beacon/client/config.d.ts +4 -3
- package/lib/beacon/client/config.js +3 -6
- package/lib/beacon/client/config.js.map +1 -1
- package/lib/beacon/client/debug.d.ts +4 -3
- package/lib/beacon/client/debug.js +4 -45
- package/lib/beacon/client/debug.js.map +1 -1
- package/lib/beacon/client/events.d.ts +5 -2
- package/lib/beacon/client/events.js +33 -35
- package/lib/beacon/client/events.js.map +1 -1
- package/lib/beacon/client/index.d.ts +8 -3
- package/lib/beacon/client/index.js +3 -2
- package/lib/beacon/client/index.js.map +1 -1
- package/lib/beacon/client/lightclient.d.ts +4 -3
- package/lib/beacon/client/lightclient.js +4 -7
- package/lib/beacon/client/lightclient.js.map +1 -1
- package/lib/beacon/client/lodestar.d.ts +4 -3
- package/lib/beacon/client/lodestar.js +4 -7
- package/lib/beacon/client/lodestar.js.map +1 -1
- package/lib/beacon/client/node.d.ts +4 -3
- package/lib/beacon/client/node.js +4 -7
- package/lib/beacon/client/node.js.map +1 -1
- package/lib/beacon/client/proof.d.ts +5 -4
- package/lib/beacon/client/proof.js +5 -61
- package/lib/beacon/client/proof.js.map +1 -1
- package/lib/beacon/client/validator.d.ts +4 -3
- package/lib/beacon/client/validator.js +4 -7
- package/lib/beacon/client/validator.js.map +1 -1
- package/lib/beacon/index.d.ts +5 -5
- package/lib/beacon/index.js.map +1 -1
- package/lib/beacon/routes/beacon/block.d.ts +286 -167
- package/lib/beacon/routes/beacon/block.js +317 -117
- package/lib/beacon/routes/beacon/block.js.map +1 -1
- package/lib/beacon/routes/beacon/index.d.ts +6 -588
- package/lib/beacon/routes/beacon/index.js +16 -26
- package/lib/beacon/routes/beacon/index.js.map +1 -1
- package/lib/beacon/routes/beacon/pool.d.ts +155 -117
- package/lib/beacon/routes/beacon/pool.js +146 -42
- package/lib/beacon/routes/beacon/pool.js.map +1 -1
- package/lib/beacon/routes/beacon/rewards.d.ts +113 -101
- package/lib/beacon/routes/beacon/rewards.js +98 -63
- package/lib/beacon/routes/beacon/rewards.js.map +1 -1
- package/lib/beacon/routes/beacon/state.d.ts +172 -226
- package/lib/beacon/routes/beacon/state.js +204 -126
- package/lib/beacon/routes/beacon/state.js.map +1 -1
- package/lib/beacon/routes/config.d.ts +21 -36
- package/lib/beacon/routes/config.js +45 -24
- package/lib/beacon/routes/config.js.map +1 -1
- package/lib/beacon/routes/debug.d.ts +22 -104
- package/lib/beacon/routes/debug.js +53 -45
- package/lib/beacon/routes/debug.js.map +1 -1
- package/lib/beacon/routes/events.d.ts +24 -20
- package/lib/beacon/routes/events.js +40 -18
- package/lib/beacon/routes/events.js.map +1 -1
- package/lib/beacon/routes/index.d.ts +19 -19
- package/lib/beacon/routes/index.js +1 -0
- package/lib/beacon/routes/index.js.map +1 -1
- package/lib/beacon/routes/lightclient.d.ts +34 -56
- package/lib/beacon/routes/lightclient.js +108 -48
- package/lib/beacon/routes/lightclient.js.map +1 -1
- package/lib/beacon/routes/lodestar.d.ts +74 -148
- package/lib/beacon/routes/lodestar.js +126 -77
- package/lib/beacon/routes/lodestar.js.map +1 -1
- package/lib/beacon/routes/node.d.ts +48 -82
- package/lib/beacon/routes/node.js +90 -57
- package/lib/beacon/routes/node.js.map +1 -1
- package/lib/beacon/routes/proof.d.ts +25 -31
- package/lib/beacon/routes/proof.js +44 -24
- package/lib/beacon/routes/proof.js.map +1 -1
- package/lib/beacon/routes/validator.d.ts +524 -325
- package/lib/beacon/routes/validator.js +468 -213
- package/lib/beacon/routes/validator.js.map +1 -1
- package/lib/beacon/server/beacon.d.ts +3 -4
- package/lib/beacon/server/beacon.js +4 -57
- package/lib/beacon/server/beacon.js.map +1 -1
- package/lib/beacon/server/config.d.ts +3 -4
- package/lib/beacon/server/config.js +4 -5
- package/lib/beacon/server/config.js.map +1 -1
- package/lib/beacon/server/debug.d.ts +3 -4
- package/lib/beacon/server/debug.js +4 -54
- package/lib/beacon/server/debug.js.map +1 -1
- package/lib/beacon/server/events.d.ts +4 -4
- package/lib/beacon/server/events.js +17 -23
- package/lib/beacon/server/events.js.map +1 -1
- package/lib/beacon/server/index.d.ts +7 -8
- package/lib/beacon/server/index.js +13 -14
- package/lib/beacon/server/index.js.map +1 -1
- package/lib/beacon/server/lightclient.d.ts +3 -4
- package/lib/beacon/server/lightclient.js +4 -5
- package/lib/beacon/server/lightclient.js.map +1 -1
- package/lib/beacon/server/lodestar.d.ts +3 -4
- package/lib/beacon/server/lodestar.js +4 -5
- package/lib/beacon/server/lodestar.js.map +1 -1
- package/lib/beacon/server/node.d.ts +3 -4
- package/lib/beacon/server/node.js +4 -18
- package/lib/beacon/server/node.js.map +1 -1
- package/lib/beacon/server/proof.d.ts +3 -4
- package/lib/beacon/server/proof.js +4 -36
- package/lib/beacon/server/proof.js.map +1 -1
- package/lib/beacon/server/validator.d.ts +3 -4
- package/lib/beacon/server/validator.js +4 -21
- package/lib/beacon/server/validator.js.map +1 -1
- package/lib/builder/client.d.ts +4 -6
- package/lib/builder/client.js +3 -9
- package/lib/builder/client.js.map +1 -1
- package/lib/builder/index.d.ts +8 -5
- package/lib/builder/index.js +4 -1
- package/lib/builder/index.js.map +1 -1
- package/lib/builder/routes.d.ts +25 -39
- package/lib/builder/routes.js +78 -34
- package/lib/builder/routes.js.map +1 -1
- package/lib/builder/server/index.d.ts +6 -6
- package/lib/builder/server/index.js +7 -8
- package/lib/builder/server/index.js.map +1 -1
- package/lib/index.d.ts +9 -6
- package/lib/index.js +5 -4
- package/lib/index.js.map +1 -1
- package/lib/keymanager/client.d.ts +4 -3
- package/lib/keymanager/client.js +4 -7
- package/lib/keymanager/client.js.map +1 -1
- package/lib/keymanager/index.d.ts +5 -4
- package/lib/keymanager/index.js +1 -1
- package/lib/keymanager/index.js.map +1 -1
- package/lib/keymanager/routes.d.ts +155 -177
- package/lib/keymanager/routes.js +236 -123
- package/lib/keymanager/routes.js.map +1 -1
- package/lib/keymanager/server/index.d.ts +6 -6
- package/lib/keymanager/server/index.js +7 -8
- package/lib/keymanager/server/index.js.map +1 -1
- package/lib/server/index.d.ts +2 -0
- package/lib/server/index.js +3 -0
- package/lib/server/index.js.map +1 -0
- package/lib/utils/client/error.d.ts +6 -0
- package/lib/utils/client/error.js +8 -0
- package/lib/utils/client/error.js.map +1 -0
- package/lib/utils/client/httpClient.d.ts +38 -76
- package/lib/utils/client/httpClient.js +201 -153
- package/lib/utils/client/httpClient.js.map +1 -1
- package/lib/utils/client/index.d.ts +6 -2
- package/lib/utils/client/index.js +6 -2
- package/lib/utils/client/index.js.map +1 -1
- package/lib/utils/client/method.d.ts +11 -0
- package/lib/utils/client/method.js +27 -0
- package/lib/utils/client/method.js.map +1 -0
- package/lib/utils/client/request.d.ts +33 -0
- package/lib/utils/client/request.js +66 -0
- package/lib/utils/client/request.js.map +1 -0
- package/lib/utils/client/response.d.ts +36 -0
- package/lib/utils/client/response.js +167 -0
- package/lib/utils/client/response.js.map +1 -0
- package/lib/utils/codecs.d.ts +28 -0
- package/lib/utils/codecs.js +105 -0
- package/lib/utils/codecs.js.map +1 -0
- package/lib/utils/fork.d.ts +7 -0
- package/lib/utils/fork.js +29 -0
- package/lib/utils/fork.js.map +1 -0
- package/lib/utils/headers.d.ts +37 -0
- package/lib/utils/headers.js +134 -0
- package/lib/utils/headers.js.map +1 -0
- package/lib/utils/httpStatusCode.js.map +1 -0
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/index.js +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/metadata.d.ts +88 -0
- package/lib/utils/metadata.js +126 -0
- package/lib/utils/metadata.js.map +1 -0
- package/lib/utils/schema.d.ts +31 -17
- package/lib/utils/schema.js +18 -6
- package/lib/utils/schema.js.map +1 -1
- package/lib/utils/serdes.d.ts +3 -0
- package/lib/utils/serdes.js +13 -0
- package/lib/utils/serdes.js.map +1 -1
- package/lib/utils/server/{errors.d.ts → error.d.ts} +2 -2
- package/lib/utils/server/{errors.js → error.js} +1 -1
- package/lib/utils/server/error.js.map +1 -0
- package/lib/utils/server/handler.d.ts +11 -0
- package/lib/utils/server/handler.js +115 -0
- package/lib/utils/server/handler.js.map +1 -0
- package/lib/utils/server/index.d.ts +5 -4
- package/lib/utils/server/index.js +5 -4
- package/lib/utils/server/index.js.map +1 -1
- package/lib/utils/server/method.d.ts +35 -0
- package/lib/utils/server/method.js +2 -0
- package/lib/utils/server/method.js.map +1 -0
- package/lib/utils/server/parser.d.ts +3 -0
- package/lib/utils/server/parser.js +20 -0
- package/lib/utils/server/parser.js.map +1 -0
- package/lib/utils/server/route.d.ts +20 -0
- package/lib/utils/server/route.js +19 -0
- package/lib/utils/server/route.js.map +1 -0
- package/lib/utils/types.d.ts +116 -104
- package/lib/utils/types.js +2 -155
- package/lib/utils/types.js.map +1 -1
- package/lib/utils/urlFormat.d.ts +2 -2
- package/lib/utils/urlFormat.js +3 -3
- package/lib/utils/urlFormat.js.map +1 -1
- package/lib/utils/wireFormat.d.ts +8 -0
- package/lib/utils/wireFormat.js +23 -0
- package/lib/utils/wireFormat.js.map +1 -0
- package/package.json +10 -7
- package/lib/interfaces.d.ts +0 -44
- package/lib/interfaces.js +0 -2
- package/lib/interfaces.js.map +0 -1
- package/lib/utils/acceptHeader.d.ts +0 -9
- package/lib/utils/acceptHeader.js +0 -62
- package/lib/utils/acceptHeader.js.map +0 -1
- package/lib/utils/client/client.d.ts +0 -29
- package/lib/utils/client/client.js +0 -88
- package/lib/utils/client/client.js.map +0 -1
- package/lib/utils/client/httpStatusCode.js.map +0 -1
- package/lib/utils/routes.d.ts +0 -6
- package/lib/utils/routes.js +0 -31
- package/lib/utils/routes.js.map +0 -1
- package/lib/utils/server/errors.js.map +0 -1
- package/lib/utils/server/genericJsonServer.d.ts +0 -13
- package/lib/utils/server/genericJsonServer.js +0 -32
- package/lib/utils/server/genericJsonServer.js.map +0 -1
- package/lib/utils/server/registerRoute.d.ts +0 -3
- package/lib/utils/server/registerRoute.js +0 -13
- package/lib/utils/server/registerRoute.js.map +0 -1
- package/lib/utils/server/types.d.ts +0 -22
- package/lib/utils/server/types.js +0 -2
- package/lib/utils/server/types.js.map +0 -1
- /package/lib/utils/{client/httpStatusCode.d.ts → httpStatusCode.d.ts} +0 -0
- /package/lib/utils/{client/httpStatusCode.js → httpStatusCode.js} +0 -0
|
@@ -1,160 +1,238 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
1
2
|
import { ContainerType } from "@chainsafe/ssz";
|
|
3
|
+
import { MAX_VALIDATORS_PER_COMMITTEE } from "@lodestar/params";
|
|
2
4
|
import { ssz, StringType } from "@lodestar/types";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
5
|
+
import { Schema } from "../../../utils/index.js";
|
|
6
|
+
import { ArrayOf, JsonOnlyReq } from "../../../utils/codecs.js";
|
|
7
|
+
import { ExecutionOptimisticAndFinalizedCodec } from "../../../utils/metadata.js";
|
|
8
|
+
import { fromValidatorIdsStr, toValidatorIdsStr } from "../../../utils/serdes.js";
|
|
9
|
+
import { WireFormat } from "../../../utils/wireFormat.js";
|
|
10
|
+
import { RootResponseType } from "./block.js";
|
|
11
|
+
export const RandaoResponseType = new ContainerType({
|
|
12
|
+
randao: ssz.Root,
|
|
13
|
+
});
|
|
14
|
+
export const FinalityCheckpointsType = new ContainerType({
|
|
15
|
+
previousJustified: ssz.phase0.Checkpoint,
|
|
16
|
+
currentJustified: ssz.phase0.Checkpoint,
|
|
17
|
+
finalized: ssz.phase0.Checkpoint,
|
|
18
|
+
}, { jsonCase: "eth2" });
|
|
19
|
+
export const ValidatorResponseType = new ContainerType({
|
|
20
|
+
index: ssz.ValidatorIndex,
|
|
21
|
+
balance: ssz.UintNum64,
|
|
22
|
+
status: new StringType(),
|
|
23
|
+
validator: ssz.phase0.Validator,
|
|
24
|
+
});
|
|
25
|
+
export const EpochCommitteeResponseType = new ContainerType({
|
|
26
|
+
index: ssz.CommitteeIndex,
|
|
27
|
+
slot: ssz.Slot,
|
|
28
|
+
validators: ArrayOf(ssz.ValidatorIndex, MAX_VALIDATORS_PER_COMMITTEE),
|
|
29
|
+
});
|
|
30
|
+
export const ValidatorBalanceType = new ContainerType({
|
|
31
|
+
index: ssz.ValidatorIndex,
|
|
32
|
+
balance: ssz.UintNum64,
|
|
33
|
+
});
|
|
34
|
+
export const EpochSyncCommitteeResponseType = new ContainerType({
|
|
35
|
+
/** All of the validator indices in the current sync committee */
|
|
36
|
+
validators: ArrayOf(ssz.ValidatorIndex),
|
|
37
|
+
// TODO: This property will likely be deprecated
|
|
38
|
+
/** Subcommittee slices of the current sync committee */
|
|
39
|
+
validatorAggregates: ArrayOf(ArrayOf(ssz.ValidatorIndex)),
|
|
40
|
+
}, { jsonCase: "eth2" });
|
|
41
|
+
export const ValidatorResponseListType = ArrayOf(ValidatorResponseType);
|
|
42
|
+
export const EpochCommitteeResponseListType = ArrayOf(EpochCommitteeResponseType);
|
|
43
|
+
export const ValidatorBalanceListType = ArrayOf(ValidatorBalanceType);
|
|
44
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
45
|
+
const stateIdOnlyReq = {
|
|
46
|
+
writeReq: ({ stateId }) => ({ params: { state_id: stateId.toString() } }),
|
|
47
|
+
parseReq: ({ params }) => ({ stateId: params.state_id }),
|
|
48
|
+
schema: { params: { state_id: Schema.StringRequired } },
|
|
21
49
|
};
|
|
22
|
-
export function
|
|
23
|
-
const stateIdOnlyReq = {
|
|
24
|
-
writeReq: (state_id) => ({ params: { state_id: String(state_id) } }),
|
|
25
|
-
parseReq: ({ params }) => [params.state_id],
|
|
26
|
-
schema: { params: { state_id: Schema.StringRequired } },
|
|
27
|
-
};
|
|
50
|
+
export function getDefinitions(_config) {
|
|
28
51
|
return {
|
|
29
52
|
getEpochCommittees: {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
53
|
+
url: "/eth/v1/beacon/states/{state_id}/committees",
|
|
54
|
+
method: "GET",
|
|
55
|
+
req: {
|
|
56
|
+
writeReq: ({ stateId, epoch, index, slot }) => ({
|
|
57
|
+
params: { state_id: stateId.toString() },
|
|
58
|
+
query: { epoch, index, slot },
|
|
59
|
+
}),
|
|
60
|
+
parseReq: ({ params, query }) => ({
|
|
61
|
+
stateId: params.state_id,
|
|
62
|
+
epoch: query.epoch,
|
|
63
|
+
index: query.index,
|
|
64
|
+
slot: query.slot,
|
|
65
|
+
}),
|
|
66
|
+
schema: {
|
|
67
|
+
params: { state_id: Schema.StringRequired },
|
|
68
|
+
query: { slot: Schema.Uint, epoch: Schema.Uint, index: Schema.Uint },
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
resp: {
|
|
72
|
+
data: EpochCommitteeResponseListType,
|
|
73
|
+
meta: ExecutionOptimisticAndFinalizedCodec,
|
|
35
74
|
},
|
|
36
75
|
},
|
|
37
76
|
getEpochSyncCommittees: {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
params: { state_id:
|
|
42
|
-
|
|
77
|
+
url: "/eth/v1/beacon/states/{state_id}/sync_committees",
|
|
78
|
+
method: "GET",
|
|
79
|
+
req: {
|
|
80
|
+
writeReq: ({ stateId, epoch }) => ({ params: { state_id: stateId.toString() }, query: { epoch } }),
|
|
81
|
+
parseReq: ({ params, query }) => ({ stateId: params.state_id, epoch: query.epoch }),
|
|
82
|
+
schema: {
|
|
83
|
+
params: { state_id: Schema.StringRequired },
|
|
84
|
+
query: { epoch: Schema.Uint },
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
resp: {
|
|
88
|
+
data: EpochSyncCommitteeResponseType,
|
|
89
|
+
meta: ExecutionOptimisticAndFinalizedCodec,
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
getStateFinalityCheckpoints: {
|
|
93
|
+
url: "/eth/v1/beacon/states/{state_id}/finality_checkpoints",
|
|
94
|
+
method: "GET",
|
|
95
|
+
req: stateIdOnlyReq,
|
|
96
|
+
resp: {
|
|
97
|
+
data: FinalityCheckpointsType,
|
|
98
|
+
meta: ExecutionOptimisticAndFinalizedCodec,
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
getStateFork: {
|
|
102
|
+
url: "/eth/v1/beacon/states/{state_id}/fork",
|
|
103
|
+
method: "GET",
|
|
104
|
+
req: stateIdOnlyReq,
|
|
105
|
+
resp: {
|
|
106
|
+
data: ssz.phase0.Fork,
|
|
107
|
+
meta: ExecutionOptimisticAndFinalizedCodec,
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
getStateRoot: {
|
|
111
|
+
url: "/eth/v1/beacon/states/{state_id}/root",
|
|
112
|
+
method: "GET",
|
|
113
|
+
req: stateIdOnlyReq,
|
|
114
|
+
resp: {
|
|
115
|
+
data: RootResponseType,
|
|
116
|
+
meta: ExecutionOptimisticAndFinalizedCodec,
|
|
43
117
|
},
|
|
44
118
|
},
|
|
45
|
-
getStateFinalityCheckpoints: stateIdOnlyReq,
|
|
46
|
-
getStateFork: stateIdOnlyReq,
|
|
47
|
-
getStateRoot: stateIdOnlyReq,
|
|
48
119
|
getStateRandao: {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
params: { state_id:
|
|
53
|
-
|
|
120
|
+
url: "/eth/v1/beacon/states/{state_id}/randao",
|
|
121
|
+
method: "GET",
|
|
122
|
+
req: {
|
|
123
|
+
writeReq: ({ stateId, epoch }) => ({ params: { state_id: stateId.toString() }, query: { epoch } }),
|
|
124
|
+
parseReq: ({ params, query }) => ({ stateId: params.state_id, epoch: query.epoch }),
|
|
125
|
+
schema: {
|
|
126
|
+
params: { state_id: Schema.StringRequired },
|
|
127
|
+
query: { epoch: Schema.Uint },
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
resp: {
|
|
131
|
+
data: RandaoResponseType,
|
|
132
|
+
meta: ExecutionOptimisticAndFinalizedCodec,
|
|
54
133
|
},
|
|
55
134
|
},
|
|
56
135
|
getStateValidator: {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
params: { state_id:
|
|
136
|
+
url: "/eth/v1/beacon/states/{state_id}/validators/{validator_id}",
|
|
137
|
+
method: "GET",
|
|
138
|
+
req: {
|
|
139
|
+
writeReq: ({ stateId, validatorId }) => ({ params: { state_id: stateId.toString(), validator_id: validatorId } }),
|
|
140
|
+
parseReq: ({ params }) => ({ stateId: params.state_id, validatorId: params.validator_id }),
|
|
141
|
+
schema: {
|
|
142
|
+
params: { state_id: Schema.StringRequired, validator_id: Schema.StringRequired },
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
resp: {
|
|
146
|
+
onlySupport: WireFormat.json,
|
|
147
|
+
data: ValidatorResponseType,
|
|
148
|
+
meta: ExecutionOptimisticAndFinalizedCodec,
|
|
61
149
|
},
|
|
62
150
|
},
|
|
63
151
|
getStateValidators: {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
152
|
+
url: "/eth/v1/beacon/states/{state_id}/validators",
|
|
153
|
+
method: "GET",
|
|
154
|
+
req: {
|
|
155
|
+
writeReq: ({ stateId, validatorIds: id, statuses }) => ({
|
|
156
|
+
params: { state_id: stateId.toString() },
|
|
157
|
+
query: { id, status: statuses },
|
|
158
|
+
}),
|
|
159
|
+
parseReq: ({ params, query }) => ({ stateId: params.state_id, validatorIds: query.id, statuses: query.status }),
|
|
160
|
+
schema: {
|
|
161
|
+
params: { state_id: Schema.StringRequired },
|
|
162
|
+
query: { id: Schema.UintOrStringArray, status: Schema.StringArray },
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
resp: {
|
|
166
|
+
onlySupport: WireFormat.json,
|
|
167
|
+
data: ValidatorResponseListType,
|
|
168
|
+
meta: ExecutionOptimisticAndFinalizedCodec,
|
|
69
169
|
},
|
|
70
170
|
},
|
|
71
171
|
postStateValidators: {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
172
|
+
url: "/eth/v1/beacon/states/{state_id}/validators",
|
|
173
|
+
method: "POST",
|
|
174
|
+
req: JsonOnlyReq({
|
|
175
|
+
writeReqJson: ({ stateId, validatorIds, statuses }) => ({
|
|
176
|
+
params: { state_id: stateId.toString() },
|
|
177
|
+
body: {
|
|
178
|
+
ids: toValidatorIdsStr(validatorIds),
|
|
179
|
+
statuses,
|
|
180
|
+
},
|
|
181
|
+
}),
|
|
182
|
+
parseReqJson: ({ params, body = {} }) => ({
|
|
183
|
+
stateId: params.state_id,
|
|
184
|
+
validatorIds: fromValidatorIdsStr(body.ids),
|
|
185
|
+
statuses: body.statuses,
|
|
186
|
+
}),
|
|
187
|
+
schema: {
|
|
188
|
+
params: { state_id: Schema.StringRequired },
|
|
189
|
+
body: Schema.Object,
|
|
77
190
|
},
|
|
78
191
|
}),
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
status: body.statuses,
|
|
84
|
-
},
|
|
85
|
-
],
|
|
86
|
-
schema: {
|
|
87
|
-
params: { state_id: Schema.StringRequired },
|
|
88
|
-
body: Schema.Object,
|
|
192
|
+
resp: {
|
|
193
|
+
onlySupport: WireFormat.json,
|
|
194
|
+
data: ValidatorResponseListType,
|
|
195
|
+
meta: ExecutionOptimisticAndFinalizedCodec,
|
|
89
196
|
},
|
|
90
197
|
},
|
|
91
198
|
getStateValidatorBalances: {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
params: { state_id:
|
|
96
|
-
|
|
199
|
+
url: "/eth/v1/beacon/states/{state_id}/validator_balances",
|
|
200
|
+
method: "GET",
|
|
201
|
+
req: {
|
|
202
|
+
writeReq: ({ stateId, validatorIds }) => ({ params: { state_id: stateId.toString() }, query: { id: validatorIds } }),
|
|
203
|
+
parseReq: ({ params, query }) => ({ stateId: params.state_id, validatorIds: query.id }),
|
|
204
|
+
schema: {
|
|
205
|
+
params: { state_id: Schema.StringRequired },
|
|
206
|
+
query: { id: Schema.UintOrStringArray },
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
resp: {
|
|
210
|
+
data: ValidatorBalanceListType,
|
|
211
|
+
meta: ExecutionOptimisticAndFinalizedCodec,
|
|
97
212
|
},
|
|
98
213
|
},
|
|
99
214
|
postStateValidatorBalances: {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
215
|
+
url: "/eth/v1/beacon/states/{state_id}/validator_balances",
|
|
216
|
+
method: "POST",
|
|
217
|
+
req: JsonOnlyReq({
|
|
218
|
+
writeReqJson: ({ stateId, validatorIds }) => ({
|
|
219
|
+
params: { state_id: stateId.toString() },
|
|
220
|
+
body: toValidatorIdsStr(validatorIds) || [],
|
|
221
|
+
}),
|
|
222
|
+
parseReqJson: ({ params, body = [] }) => ({
|
|
223
|
+
stateId: params.state_id,
|
|
224
|
+
validatorIds: fromValidatorIdsStr(body),
|
|
225
|
+
}),
|
|
226
|
+
schema: {
|
|
227
|
+
params: { state_id: Schema.StringRequired },
|
|
228
|
+
body: Schema.UintOrStringArray,
|
|
229
|
+
},
|
|
103
230
|
}),
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
],
|
|
108
|
-
schema: {
|
|
109
|
-
params: { state_id: Schema.StringRequired },
|
|
110
|
-
body: Schema.UintOrStringArray,
|
|
231
|
+
resp: {
|
|
232
|
+
data: ValidatorBalanceListType,
|
|
233
|
+
meta: ExecutionOptimisticAndFinalizedCodec,
|
|
111
234
|
},
|
|
112
235
|
},
|
|
113
236
|
};
|
|
114
237
|
}
|
|
115
|
-
export function getReturnTypes() {
|
|
116
|
-
const RootContainer = new ContainerType({
|
|
117
|
-
root: ssz.Root,
|
|
118
|
-
});
|
|
119
|
-
const RandaoContainer = new ContainerType({
|
|
120
|
-
randao: ssz.Root,
|
|
121
|
-
});
|
|
122
|
-
const FinalityCheckpoints = new ContainerType({
|
|
123
|
-
previousJustified: ssz.phase0.Checkpoint,
|
|
124
|
-
currentJustified: ssz.phase0.Checkpoint,
|
|
125
|
-
finalized: ssz.phase0.Checkpoint,
|
|
126
|
-
}, { jsonCase: "eth2" });
|
|
127
|
-
const ValidatorResponse = new ContainerType({
|
|
128
|
-
index: ssz.ValidatorIndex,
|
|
129
|
-
balance: ssz.UintNum64,
|
|
130
|
-
status: new StringType(),
|
|
131
|
-
validator: ssz.phase0.Validator,
|
|
132
|
-
}, { jsonCase: "eth2" });
|
|
133
|
-
const ValidatorBalance = new ContainerType({
|
|
134
|
-
index: ssz.ValidatorIndex,
|
|
135
|
-
balance: ssz.UintNum64,
|
|
136
|
-
}, { jsonCase: "eth2" });
|
|
137
|
-
const EpochCommitteeResponse = new ContainerType({
|
|
138
|
-
index: ssz.CommitteeIndex,
|
|
139
|
-
slot: ssz.Slot,
|
|
140
|
-
validators: ssz.phase0.CommitteeIndices,
|
|
141
|
-
}, { jsonCase: "eth2" });
|
|
142
|
-
const EpochSyncCommitteesResponse = new ContainerType({
|
|
143
|
-
validators: ArrayOf(ssz.ValidatorIndex),
|
|
144
|
-
validatorAggregates: ArrayOf(ArrayOf(ssz.ValidatorIndex)),
|
|
145
|
-
}, { jsonCase: "eth2" });
|
|
146
|
-
return {
|
|
147
|
-
getStateRoot: WithFinalized(ContainerDataExecutionOptimistic(RootContainer)),
|
|
148
|
-
getStateFork: WithFinalized(ContainerDataExecutionOptimistic(ssz.phase0.Fork)),
|
|
149
|
-
getStateRandao: WithFinalized(ContainerDataExecutionOptimistic(RandaoContainer)),
|
|
150
|
-
getStateFinalityCheckpoints: WithFinalized(ContainerDataExecutionOptimistic(FinalityCheckpoints)),
|
|
151
|
-
getStateValidators: WithFinalized(ContainerDataExecutionOptimistic(ArrayOf(ValidatorResponse))),
|
|
152
|
-
postStateValidators: WithFinalized(ContainerDataExecutionOptimistic(ArrayOf(ValidatorResponse))),
|
|
153
|
-
getStateValidator: WithFinalized(ContainerDataExecutionOptimistic(ValidatorResponse)),
|
|
154
|
-
getStateValidatorBalances: WithFinalized(ContainerDataExecutionOptimistic(ArrayOf(ValidatorBalance))),
|
|
155
|
-
postStateValidatorBalances: WithFinalized(ContainerDataExecutionOptimistic(ArrayOf(ValidatorBalance))),
|
|
156
|
-
getEpochCommittees: WithFinalized(ContainerDataExecutionOptimistic(ArrayOf(EpochCommitteeResponse))),
|
|
157
|
-
getEpochSyncCommittees: WithFinalized(ContainerDataExecutionOptimistic(EpochSyncCommitteesResponse)),
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
238
|
//# sourceMappingURL=state.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../../../src/beacon/routes/beacon/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../../../src/beacon/routes/beacon/state.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,OAAO,EAAC,aAAa,EAAU,MAAM,gBAAgB,CAAC;AAEtD,OAAO,EAAC,4BAA4B,EAAC,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAsC,GAAG,EAAW,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAC9F,OAAO,EAA2C,MAAM,EAAC,MAAM,yBAAyB,CAAC;AACzF,OAAO,EAAC,OAAO,EAAE,WAAW,EAAC,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAC,oCAAoC,EAAsC,MAAM,4BAA4B,CAAC;A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iBAAiB;iBAC/B;aACF,CAAC;YACF,IAAI,EAAE;gBACJ,IAAI,EAAE,wBAAwB;gBAC9B,IAAI,EAAE,oCAAoC;aAC3C;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,33 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { ContainerType, ValueOf } from "@chainsafe/ssz";
|
|
2
|
+
import { ChainForkConfig } from "@lodestar/config";
|
|
3
|
+
import { EmptyArgs, EmptyMeta, EmptyRequest } from "../../utils/codecs.js";
|
|
4
|
+
import { Endpoint, RouteDefinitions } from "../../utils/index.js";
|
|
5
|
+
export declare const DepositContractType: ContainerType<{
|
|
6
|
+
chainId: import("@chainsafe/ssz").UintNumberType;
|
|
7
|
+
address: import("@lodestar/types/lib/utils/executionAddress.js").ExecutionAddressType;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const ForkListType: import("@chainsafe/ssz").ArrayType<import("@chainsafe/ssz").Type<import("@chainsafe/ssz").ValueOfFields<{
|
|
10
|
+
previousVersion: import("@chainsafe/ssz").ByteVectorType;
|
|
11
|
+
currentVersion: import("@chainsafe/ssz").ByteVectorType;
|
|
12
|
+
epoch: import("@chainsafe/ssz").UintNumberType;
|
|
13
|
+
}>>, unknown, unknown>;
|
|
14
|
+
export type DepositContract = ValueOf<typeof DepositContractType>;
|
|
15
|
+
export type ForkList = ValueOf<typeof ForkListType>;
|
|
16
|
+
export type Spec = Record<string, string>;
|
|
17
|
+
export type Endpoints = {
|
|
13
18
|
/**
|
|
14
19
|
* Get deposit contract address.
|
|
15
20
|
* Retrieve Eth1 deposit contract address and chain ID.
|
|
16
21
|
*/
|
|
17
|
-
getDepositContract
|
|
18
|
-
[HttpStatusCode.OK]: {
|
|
19
|
-
data: DepositContract;
|
|
20
|
-
};
|
|
21
|
-
}>>;
|
|
22
|
+
getDepositContract: Endpoint<"GET", EmptyArgs, EmptyRequest, DepositContract, EmptyMeta>;
|
|
22
23
|
/**
|
|
23
24
|
* Get scheduled upcoming forks.
|
|
24
25
|
* Retrieve all scheduled upcoming forks this node is aware of.
|
|
25
26
|
*/
|
|
26
|
-
getForkSchedule
|
|
27
|
-
[HttpStatusCode.OK]: {
|
|
28
|
-
data: phase0.Fork[];
|
|
29
|
-
};
|
|
30
|
-
}>>;
|
|
27
|
+
getForkSchedule: Endpoint<"GET", EmptyArgs, EmptyRequest, ForkList, EmptyMeta>;
|
|
31
28
|
/**
|
|
32
29
|
* Retrieve specification configuration used on this node. The configuration should include:
|
|
33
30
|
* - Constants for all hard forks known by the beacon node, for example the [phase 0](https://github.com/ethereum/consensus-specs/blob/v1.1.10/specs/phase0/beacon-chain.md#constants) and [altair](https://github.com/ethereum/consensus-specs/blob/v1.1.10/specs/altair/beacon-chain.md#constants) values
|
|
@@ -38,19 +35,7 @@ export type Api = {
|
|
|
38
35
|
* - any value starting with 0x in the spec is returned as a hex string
|
|
39
36
|
* - numeric values are returned as a quoted integer
|
|
40
37
|
*/
|
|
41
|
-
getSpec
|
|
42
|
-
[HttpStatusCode.OK]: {
|
|
43
|
-
data: Record<string, string>;
|
|
44
|
-
};
|
|
45
|
-
}>>;
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* Define javascript values for each route
|
|
49
|
-
*/
|
|
50
|
-
export declare const routesData: RoutesData<Api>;
|
|
51
|
-
export type ReqTypes = {
|
|
52
|
-
[K in keyof Api]: ReqEmpty;
|
|
38
|
+
getSpec: Endpoint<"GET", EmptyArgs, EmptyRequest, Spec, EmptyMeta>;
|
|
53
39
|
};
|
|
54
|
-
export declare function
|
|
55
|
-
export declare function getReturnTypes(): ReturnTypes<Api>;
|
|
40
|
+
export declare function getDefinitions(_config: ChainForkConfig): RouteDefinitions<Endpoints>;
|
|
56
41
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1,29 +1,50 @@
|
|
|
1
|
-
import { ByteVectorType, ContainerType } from "@chainsafe/ssz";
|
|
2
|
-
import { ssz } from "@lodestar/types";
|
|
3
|
-
import { mapValues } from "@lodestar/utils";
|
|
4
|
-
import { ArrayOf, reqEmpty, sameType, ContainerData, } from "../../utils/index.js";
|
|
5
|
-
import { HttpStatusCode } from "../../utils/client/httpStatusCode.js";
|
|
6
|
-
/**
|
|
7
|
-
* Define javascript values for each route
|
|
8
|
-
*/
|
|
9
|
-
export const routesData = {
|
|
10
|
-
getDepositContract: { url: "/eth/v1/config/deposit_contract", method: "GET" },
|
|
11
|
-
getForkSchedule: { url: "/eth/v1/config/fork_schedule", method: "GET" },
|
|
12
|
-
getSpec: { url: "/eth/v1/config/spec", method: "GET" },
|
|
13
|
-
};
|
|
14
|
-
export function getReqSerializers() {
|
|
15
|
-
return mapValues(routesData, () => reqEmpty);
|
|
16
|
-
}
|
|
17
1
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
2
|
+
import { ContainerType } from "@chainsafe/ssz";
|
|
3
|
+
import { ssz } from "@lodestar/types";
|
|
4
|
+
import { ArrayOf, EmptyRequestCodec, EmptyMetaCodec, JsonOnlyResp, } from "../../utils/codecs.js";
|
|
5
|
+
// See /packages/api/src/routes/index.ts for reasoning and instructions to add new routes
|
|
6
|
+
export const DepositContractType = new ContainerType({
|
|
7
|
+
chainId: ssz.UintNum64,
|
|
8
|
+
address: ssz.ExecutionAddress,
|
|
9
|
+
}, { jsonCase: "eth2" });
|
|
10
|
+
export const ForkListType = ArrayOf(ssz.phase0.Fork);
|
|
11
|
+
export function getDefinitions(_config) {
|
|
23
12
|
return {
|
|
24
|
-
getDepositContract:
|
|
25
|
-
|
|
26
|
-
|
|
13
|
+
getDepositContract: {
|
|
14
|
+
url: "/eth/v1/config/deposit_contract",
|
|
15
|
+
method: "GET",
|
|
16
|
+
req: EmptyRequestCodec,
|
|
17
|
+
resp: {
|
|
18
|
+
data: DepositContractType,
|
|
19
|
+
meta: EmptyMetaCodec,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
getForkSchedule: {
|
|
23
|
+
url: "/eth/v1/config/fork_schedule",
|
|
24
|
+
method: "GET",
|
|
25
|
+
req: EmptyRequestCodec,
|
|
26
|
+
resp: {
|
|
27
|
+
data: ForkListType,
|
|
28
|
+
meta: EmptyMetaCodec,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
getSpec: {
|
|
32
|
+
url: "/eth/v1/config/spec",
|
|
33
|
+
method: "GET",
|
|
34
|
+
req: EmptyRequestCodec,
|
|
35
|
+
resp: JsonOnlyResp({
|
|
36
|
+
data: {
|
|
37
|
+
toJson: (data) => data,
|
|
38
|
+
fromJson: (data) => {
|
|
39
|
+
if (typeof data !== "object" || data === null) {
|
|
40
|
+
throw Error("JSON must be of type object");
|
|
41
|
+
}
|
|
42
|
+
return data;
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
meta: EmptyMetaCodec,
|
|
46
|
+
}),
|
|
47
|
+
},
|
|
27
48
|
};
|
|
28
49
|
}
|
|
29
50
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/beacon/routes/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/beacon/routes/config.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,OAAO,EAAC,aAAa,EAAU,MAAM,gBAAgB,CAAC;AAEtD,OAAO,EAAC,GAAG,EAAC,MAAM,iBAAiB,CAAC;AACpC,OAAO,EACL,OAAO,EAEP,iBAAiB,EAEjB,cAAc,EAEd,YAAY,GACb,MAAM,uBAAuB,CAAC;AAG/B,yFAAyF;AAEzF,MAAM,CAAC,MAAM,m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