@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.
- package/README.md +2 -2
- 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 +6 -3
- package/lib/beacon/client/index.js +2 -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 +277 -168
- package/lib/beacon/routes/beacon/block.js +308 -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 +35 -75
- 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 +9 -6
- 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,10 +1,13 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
1
2
|
import { ContainerType, fromHexString, toHexString } from "@chainsafe/ssz";
|
|
2
|
-
import {
|
|
3
|
-
import { ssz,
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { isForkBlobs } from "@lodestar/params";
|
|
4
|
+
import { ssz, ProducedBlockSource, stringType, } from "@lodestar/types";
|
|
5
|
+
import { Schema } from "../../utils/index.js";
|
|
6
|
+
import { fromGraffitiHex, toBoolean, toGraffitiHex } from "../../utils/serdes.js";
|
|
7
|
+
import { getExecutionForkTypes, toForkName } from "../../utils/fork.js";
|
|
8
|
+
import { ArrayOf, EmptyMetaCodec, EmptyResponseCodec, JsonOnlyReq, WithMeta, WithVersion, } from "../../utils/codecs.js";
|
|
9
|
+
import { ExecutionOptimisticAndDependentRootCodec, ExecutionOptimisticCodec, MetaHeader, VersionCodec, VersionType, } from "../../utils/metadata.js";
|
|
10
|
+
// See /packages/api/src/routes/index.ts for reasoning and instructions to add new routes
|
|
8
11
|
export var BuilderSelection;
|
|
9
12
|
(function (BuilderSelection) {
|
|
10
13
|
BuilderSelection["Default"] = "default";
|
|
@@ -16,260 +19,512 @@ export var BuilderSelection;
|
|
|
16
19
|
/** Only builds execution block*/
|
|
17
20
|
BuilderSelection["ExecutionOnly"] = "executiononly";
|
|
18
21
|
})(BuilderSelection || (BuilderSelection = {}));
|
|
22
|
+
export const ProduceBlockV3MetaType = new ContainerType({
|
|
23
|
+
...VersionType.fields,
|
|
24
|
+
/** Specifies whether the response contains full or blinded block */
|
|
25
|
+
executionPayloadBlinded: ssz.Boolean,
|
|
26
|
+
/** Execution payload value in Wei */
|
|
27
|
+
executionPayloadValue: ssz.UintBn64,
|
|
28
|
+
/** Consensus rewards paid to the proposer for this block, in Wei */
|
|
29
|
+
consensusBlockValue: ssz.UintBn64,
|
|
30
|
+
}, { jsonCase: "eth2" });
|
|
31
|
+
export const BlockContentsType = new ContainerType({
|
|
32
|
+
block: ssz.deneb.BeaconBlock,
|
|
33
|
+
kzgProofs: ssz.deneb.KZGProofs,
|
|
34
|
+
blobs: ssz.deneb.Blobs,
|
|
35
|
+
}, { jsonCase: "eth2" });
|
|
36
|
+
export const AttesterDutyType = new ContainerType({
|
|
37
|
+
/** The validator's public key, uniquely identifying them */
|
|
38
|
+
pubkey: ssz.BLSPubkey,
|
|
39
|
+
/** Index of validator in validator registry */
|
|
40
|
+
validatorIndex: ssz.ValidatorIndex,
|
|
41
|
+
/** Index of the committee */
|
|
42
|
+
committeeIndex: ssz.CommitteeIndex,
|
|
43
|
+
/** Number of validators in committee */
|
|
44
|
+
committeeLength: ssz.UintNum64,
|
|
45
|
+
/** Number of committees at the provided slot */
|
|
46
|
+
committeesAtSlot: ssz.UintNum64,
|
|
47
|
+
/** Index of validator in committee */
|
|
48
|
+
validatorCommitteeIndex: ssz.UintNum64,
|
|
49
|
+
/** The slot at which the validator must attest */
|
|
50
|
+
slot: ssz.Slot,
|
|
51
|
+
}, { jsonCase: "eth2" });
|
|
52
|
+
export const ProposerDutyType = new ContainerType({
|
|
53
|
+
slot: ssz.Slot,
|
|
54
|
+
validatorIndex: ssz.ValidatorIndex,
|
|
55
|
+
pubkey: ssz.BLSPubkey,
|
|
56
|
+
}, { jsonCase: "eth2" });
|
|
57
|
+
/**
|
|
58
|
+
* From https://github.com/ethereum/beacon-APIs/pull/134
|
|
59
|
+
*/
|
|
60
|
+
export const SyncDutyType = new ContainerType({
|
|
61
|
+
pubkey: ssz.BLSPubkey,
|
|
62
|
+
/** Index of validator in validator registry. */
|
|
63
|
+
validatorIndex: ssz.ValidatorIndex,
|
|
64
|
+
/** The indices of the validator in the sync committee. */
|
|
65
|
+
validatorSyncCommitteeIndices: ArrayOf(ssz.CommitteeIndex),
|
|
66
|
+
}, { jsonCase: "eth2" });
|
|
67
|
+
export const BeaconCommitteeSubscriptionType = new ContainerType({
|
|
68
|
+
validatorIndex: ssz.ValidatorIndex,
|
|
69
|
+
committeeIndex: ssz.CommitteeIndex,
|
|
70
|
+
committeesAtSlot: ssz.Slot,
|
|
71
|
+
slot: ssz.Slot,
|
|
72
|
+
isAggregator: ssz.Boolean,
|
|
73
|
+
}, { jsonCase: "eth2" });
|
|
74
|
+
/**
|
|
75
|
+
* From https://github.com/ethereum/beacon-APIs/pull/136
|
|
76
|
+
*/
|
|
77
|
+
export const SyncCommitteeSubscriptionType = new ContainerType({
|
|
78
|
+
validatorIndex: ssz.ValidatorIndex,
|
|
79
|
+
syncCommitteeIndices: ArrayOf(ssz.CommitteeIndex),
|
|
80
|
+
untilEpoch: ssz.Epoch,
|
|
81
|
+
}, { jsonCase: "eth2" });
|
|
82
|
+
export const ProposerPreparationDataType = new ContainerType({
|
|
83
|
+
validatorIndex: ssz.ValidatorIndex,
|
|
84
|
+
feeRecipient: stringType,
|
|
85
|
+
}, { jsonCase: "eth2" });
|
|
19
86
|
/**
|
|
20
|
-
*
|
|
87
|
+
* From https://github.com/ethereum/beacon-APIs/pull/224
|
|
21
88
|
*/
|
|
22
|
-
export const
|
|
23
|
-
|
|
24
|
-
getProposerDuties: { url: "/eth/v1/validator/duties/proposer/{epoch}", method: "GET" },
|
|
25
|
-
getSyncCommitteeDuties: { url: "/eth/v1/validator/duties/sync/{epoch}", method: "POST" },
|
|
26
|
-
produceBlock: { url: "/eth/v1/validator/blocks/{slot}", method: "GET" },
|
|
27
|
-
produceBlockV2: { url: "/eth/v2/validator/blocks/{slot}", method: "GET" },
|
|
28
|
-
produceBlockV3: { url: "/eth/v3/validator/blocks/{slot}", method: "GET" },
|
|
29
|
-
produceBlindedBlock: { url: "/eth/v1/validator/blinded_blocks/{slot}", method: "GET" },
|
|
30
|
-
produceAttestationData: { url: "/eth/v1/validator/attestation_data", method: "GET" },
|
|
31
|
-
produceSyncCommitteeContribution: { url: "/eth/v1/validator/sync_committee_contribution", method: "GET" },
|
|
32
|
-
getAggregatedAttestation: { url: "/eth/v1/validator/aggregate_attestation", method: "GET" },
|
|
33
|
-
publishAggregateAndProofs: { url: "/eth/v1/validator/aggregate_and_proofs", method: "POST" },
|
|
34
|
-
publishContributionAndProofs: { url: "/eth/v1/validator/contribution_and_proofs", method: "POST" },
|
|
35
|
-
prepareBeaconCommitteeSubnet: { url: "/eth/v1/validator/beacon_committee_subscriptions", method: "POST" },
|
|
36
|
-
prepareSyncCommitteeSubnets: { url: "/eth/v1/validator/sync_committee_subscriptions", method: "POST" },
|
|
37
|
-
prepareBeaconProposer: { url: "/eth/v1/validator/prepare_beacon_proposer", method: "POST" },
|
|
38
|
-
submitBeaconCommitteeSelections: { url: "/eth/v1/validator/beacon_committee_selections", method: "POST" },
|
|
39
|
-
submitSyncCommitteeSelections: { url: "/eth/v1/validator/sync_committee_selections", method: "POST" },
|
|
40
|
-
getLiveness: { url: "/eth/v1/validator/liveness/{epoch}", method: "POST" },
|
|
41
|
-
registerValidator: { url: "/eth/v1/validator/register_validator", method: "POST" },
|
|
42
|
-
};
|
|
43
|
-
const BeaconCommitteeSelection = new ContainerType({
|
|
89
|
+
export const BeaconCommitteeSelectionType = new ContainerType({
|
|
90
|
+
/** Index of the validator */
|
|
44
91
|
validatorIndex: ssz.ValidatorIndex,
|
|
92
|
+
/** The slot at which a validator is assigned to attest */
|
|
45
93
|
slot: ssz.Slot,
|
|
94
|
+
/** The `slot_signature` calculated by the validator for the upcoming attestation slot */
|
|
46
95
|
selectionProof: ssz.BLSSignature,
|
|
47
96
|
}, { jsonCase: "eth2" });
|
|
48
|
-
|
|
97
|
+
/**
|
|
98
|
+
* From https://github.com/ethereum/beacon-APIs/pull/224
|
|
99
|
+
*/
|
|
100
|
+
export const SyncCommitteeSelectionType = new ContainerType({
|
|
101
|
+
/** Index of the validator */
|
|
49
102
|
validatorIndex: ssz.ValidatorIndex,
|
|
103
|
+
/** The slot at which validator is assigned to produce a sync committee contribution */
|
|
50
104
|
slot: ssz.Slot,
|
|
105
|
+
/** SubcommitteeIndex to which the validator is assigned */
|
|
51
106
|
subcommitteeIndex: ssz.SubcommitteeIndex,
|
|
107
|
+
/** The `slot_signature` calculated by the validator for the upcoming sync committee slot */
|
|
52
108
|
selectionProof: ssz.BLSSignature,
|
|
53
109
|
}, { jsonCase: "eth2" });
|
|
54
|
-
export
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
graffiti: toGraffitiHex(graffiti),
|
|
73
|
-
fee_recipient: opts?.feeRecipient,
|
|
74
|
-
...(skipRandaoVerification && { skip_randao_verification: "" }),
|
|
75
|
-
builder_selection: opts?.builderSelection,
|
|
76
|
-
builder_boost_factor: opts?.builderBoostFactor?.toString(),
|
|
77
|
-
strict_fee_recipient_check: opts?.strictFeeRecipientCheck,
|
|
78
|
-
blinded_local: opts?.blindedLocal,
|
|
79
|
-
},
|
|
80
|
-
}),
|
|
81
|
-
parseReq: ({ params, query }) => [
|
|
82
|
-
params.slot,
|
|
83
|
-
fromHexString(query.randao_reveal),
|
|
84
|
-
fromGraffitiHex(query.graffiti),
|
|
85
|
-
parseSkipRandaoVerification(query.skip_randao_verification),
|
|
86
|
-
{
|
|
87
|
-
feeRecipient: query.fee_recipient,
|
|
88
|
-
builderSelection: query.builder_selection,
|
|
89
|
-
builderBoostFactor: parseBuilderBoostFactor(query.builder_boost_factor),
|
|
90
|
-
strictFeeRecipientCheck: query.strict_fee_recipient_check,
|
|
91
|
-
blindedLocal: query.blinded_local,
|
|
92
|
-
},
|
|
93
|
-
],
|
|
94
|
-
schema: {
|
|
95
|
-
params: { slot: Schema.UintRequired },
|
|
96
|
-
query: {
|
|
97
|
-
randao_reveal: Schema.StringRequired,
|
|
98
|
-
graffiti: Schema.String,
|
|
99
|
-
fee_recipient: Schema.String,
|
|
100
|
-
skip_randao_verification: Schema.String,
|
|
101
|
-
builder_selection: Schema.String,
|
|
102
|
-
builder_boost_factor: Schema.String,
|
|
103
|
-
strict_fee_recipient_check: Schema.Boolean,
|
|
104
|
-
blinded_local: Schema.Boolean,
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
};
|
|
110
|
+
export const LivenessResponseDataType = new ContainerType({
|
|
111
|
+
index: ssz.ValidatorIndex,
|
|
112
|
+
isLive: ssz.Boolean,
|
|
113
|
+
}, { jsonCase: "eth2" });
|
|
114
|
+
export const ValidatorIndicesType = ArrayOf(ssz.ValidatorIndex);
|
|
115
|
+
export const AttesterDutyListType = ArrayOf(AttesterDutyType);
|
|
116
|
+
export const ProposerDutyListType = ArrayOf(ProposerDutyType);
|
|
117
|
+
export const SyncDutyListType = ArrayOf(SyncDutyType);
|
|
118
|
+
export const SignedAggregateAndProofListType = ArrayOf(ssz.phase0.SignedAggregateAndProof);
|
|
119
|
+
export const SignedContributionAndProofListType = ArrayOf(ssz.altair.SignedContributionAndProof);
|
|
120
|
+
export const BeaconCommitteeSubscriptionListType = ArrayOf(BeaconCommitteeSubscriptionType);
|
|
121
|
+
export const SyncCommitteeSubscriptionListType = ArrayOf(SyncCommitteeSubscriptionType);
|
|
122
|
+
export const ProposerPreparationDataListType = ArrayOf(ProposerPreparationDataType);
|
|
123
|
+
export const BeaconCommitteeSelectionListType = ArrayOf(BeaconCommitteeSelectionType);
|
|
124
|
+
export const SyncCommitteeSelectionListType = ArrayOf(SyncCommitteeSelectionType);
|
|
125
|
+
export const LivenessResponseDataListType = ArrayOf(LivenessResponseDataType);
|
|
126
|
+
export const SignedValidatorRegistrationV1ListType = ArrayOf(ssz.bellatrix.SignedValidatorRegistrationV1);
|
|
127
|
+
export function getDefinitions(_config) {
|
|
108
128
|
return {
|
|
109
129
|
getAttesterDuties: {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
params: { epoch:
|
|
114
|
-
body:
|
|
130
|
+
url: "/eth/v1/validator/duties/attester/{epoch}",
|
|
131
|
+
method: "POST",
|
|
132
|
+
req: {
|
|
133
|
+
writeReqJson: ({ epoch, indices }) => ({ params: { epoch }, body: ValidatorIndicesType.toJson(indices) }),
|
|
134
|
+
parseReqJson: ({ params, body }) => ({ epoch: params.epoch, indices: ValidatorIndicesType.fromJson(body) }),
|
|
135
|
+
writeReqSsz: ({ epoch, indices }) => ({ params: { epoch }, body: ValidatorIndicesType.serialize(indices) }),
|
|
136
|
+
parseReqSsz: ({ params, body }) => ({ epoch: params.epoch, indices: ValidatorIndicesType.deserialize(body) }),
|
|
137
|
+
schema: {
|
|
138
|
+
params: { epoch: Schema.UintRequired },
|
|
139
|
+
body: Schema.StringArray,
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
resp: {
|
|
143
|
+
data: AttesterDutyListType,
|
|
144
|
+
meta: ExecutionOptimisticAndDependentRootCodec,
|
|
115
145
|
},
|
|
116
146
|
},
|
|
117
147
|
getProposerDuties: {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
148
|
+
url: "/eth/v1/validator/duties/proposer/{epoch}",
|
|
149
|
+
method: "GET",
|
|
150
|
+
req: {
|
|
151
|
+
writeReq: ({ epoch }) => ({ params: { epoch } }),
|
|
152
|
+
parseReq: ({ params }) => ({ epoch: params.epoch }),
|
|
153
|
+
schema: {
|
|
154
|
+
params: { epoch: Schema.UintRequired },
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
resp: {
|
|
158
|
+
data: ProposerDutyListType,
|
|
159
|
+
meta: ExecutionOptimisticAndDependentRootCodec,
|
|
122
160
|
},
|
|
123
161
|
},
|
|
124
162
|
getSyncCommitteeDuties: {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
params: { epoch:
|
|
129
|
-
body:
|
|
163
|
+
url: "/eth/v1/validator/duties/sync/{epoch}",
|
|
164
|
+
method: "POST",
|
|
165
|
+
req: {
|
|
166
|
+
writeReqJson: ({ epoch, indices }) => ({ params: { epoch }, body: ValidatorIndicesType.toJson(indices) }),
|
|
167
|
+
parseReqJson: ({ params, body }) => ({ epoch: params.epoch, indices: ValidatorIndicesType.fromJson(body) }),
|
|
168
|
+
writeReqSsz: ({ epoch, indices }) => ({ params: { epoch }, body: ValidatorIndicesType.serialize(indices) }),
|
|
169
|
+
parseReqSsz: ({ params, body }) => ({ epoch: params.epoch, indices: ValidatorIndicesType.deserialize(body) }),
|
|
170
|
+
schema: {
|
|
171
|
+
params: { epoch: Schema.UintRequired },
|
|
172
|
+
body: Schema.StringArray,
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
resp: {
|
|
176
|
+
data: SyncDutyListType,
|
|
177
|
+
meta: ExecutionOptimisticCodec,
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
produceBlockV2: {
|
|
181
|
+
url: "/eth/v2/validator/blocks/{slot}",
|
|
182
|
+
method: "GET",
|
|
183
|
+
req: {
|
|
184
|
+
writeReq: ({ slot, randaoReveal, graffiti, feeRecipient, builderSelection, strictFeeRecipientCheck }) => ({
|
|
185
|
+
params: { slot },
|
|
186
|
+
query: {
|
|
187
|
+
randao_reveal: toHexString(randaoReveal),
|
|
188
|
+
graffiti: toGraffitiHex(graffiti),
|
|
189
|
+
fee_recipient: feeRecipient,
|
|
190
|
+
builder_selection: builderSelection,
|
|
191
|
+
strict_fee_recipient_check: strictFeeRecipientCheck,
|
|
192
|
+
},
|
|
193
|
+
}),
|
|
194
|
+
parseReq: ({ params, query }) => ({
|
|
195
|
+
slot: params.slot,
|
|
196
|
+
randaoReveal: fromHexString(query.randao_reveal),
|
|
197
|
+
graffiti: fromGraffitiHex(query.graffiti),
|
|
198
|
+
feeRecipient: query.fee_recipient,
|
|
199
|
+
builderSelection: query.builder_selection,
|
|
200
|
+
strictFeeRecipientCheck: query.strict_fee_recipient_check,
|
|
201
|
+
}),
|
|
202
|
+
schema: {
|
|
203
|
+
params: { slot: Schema.UintRequired },
|
|
204
|
+
query: {
|
|
205
|
+
randao_reveal: Schema.StringRequired,
|
|
206
|
+
graffiti: Schema.String,
|
|
207
|
+
fee_recipient: Schema.String,
|
|
208
|
+
builder_selection: Schema.String,
|
|
209
|
+
strict_fee_recipient_check: Schema.Boolean,
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
resp: {
|
|
214
|
+
data: WithVersion((fork) => (isForkBlobs(fork) ? BlockContentsType : ssz[fork].BeaconBlock)),
|
|
215
|
+
meta: VersionCodec,
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
produceBlockV3: {
|
|
219
|
+
url: "/eth/v3/validator/blocks/{slot}",
|
|
220
|
+
method: "GET",
|
|
221
|
+
req: {
|
|
222
|
+
writeReq: ({ slot, randaoReveal, graffiti, skipRandaoVerification, feeRecipient, builderSelection, builderBoostFactor, strictFeeRecipientCheck, blindedLocal, }) => ({
|
|
223
|
+
params: { slot },
|
|
224
|
+
query: {
|
|
225
|
+
randao_reveal: toHexString(randaoReveal),
|
|
226
|
+
graffiti: toGraffitiHex(graffiti),
|
|
227
|
+
skip_randao_verification: writeSkipRandaoVerification(skipRandaoVerification),
|
|
228
|
+
fee_recipient: feeRecipient,
|
|
229
|
+
builder_selection: builderSelection,
|
|
230
|
+
builder_boost_factor: builderBoostFactor?.toString(),
|
|
231
|
+
strict_fee_recipient_check: strictFeeRecipientCheck,
|
|
232
|
+
blinded_local: blindedLocal,
|
|
233
|
+
},
|
|
234
|
+
}),
|
|
235
|
+
parseReq: ({ params, query }) => ({
|
|
236
|
+
slot: params.slot,
|
|
237
|
+
randaoReveal: fromHexString(query.randao_reveal),
|
|
238
|
+
graffiti: fromGraffitiHex(query.graffiti),
|
|
239
|
+
skipRandaoVerification: parseSkipRandaoVerification(query.skip_randao_verification),
|
|
240
|
+
feeRecipient: query.fee_recipient,
|
|
241
|
+
builderSelection: query.builder_selection,
|
|
242
|
+
builderBoostFactor: parseBuilderBoostFactor(query.builder_boost_factor),
|
|
243
|
+
strictFeeRecipientCheck: query.strict_fee_recipient_check,
|
|
244
|
+
blindedLocal: query.blinded_local,
|
|
245
|
+
}),
|
|
246
|
+
schema: {
|
|
247
|
+
params: { slot: Schema.UintRequired },
|
|
248
|
+
query: {
|
|
249
|
+
randao_reveal: Schema.StringRequired,
|
|
250
|
+
graffiti: Schema.String,
|
|
251
|
+
skip_randao_verification: Schema.String,
|
|
252
|
+
fee_recipient: Schema.String,
|
|
253
|
+
builder_selection: Schema.String,
|
|
254
|
+
builder_boost_factor: Schema.String,
|
|
255
|
+
strict_fee_recipient_check: Schema.Boolean,
|
|
256
|
+
blinded_local: Schema.Boolean,
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
resp: {
|
|
261
|
+
data: WithMeta(({ version, executionPayloadBlinded }) => (executionPayloadBlinded
|
|
262
|
+
? getExecutionForkTypes(version).BlindedBeaconBlock
|
|
263
|
+
: isForkBlobs(version)
|
|
264
|
+
? BlockContentsType
|
|
265
|
+
: ssz[version].BeaconBlock)),
|
|
266
|
+
meta: {
|
|
267
|
+
toJson: (meta) => ({
|
|
268
|
+
...ProduceBlockV3MetaType.toJson(meta),
|
|
269
|
+
execution_payload_source: meta.executionPayloadSource,
|
|
270
|
+
}),
|
|
271
|
+
fromJson: (val) => {
|
|
272
|
+
const { executionPayloadBlinded, ...meta } = ProduceBlockV3MetaType.fromJson(val);
|
|
273
|
+
// Extract source from the data and assign defaults in the spec compliant manner if not present
|
|
274
|
+
const executionPayloadSource = val.execution_payload_source ??
|
|
275
|
+
(executionPayloadBlinded === true ? ProducedBlockSource.builder : ProducedBlockSource.engine);
|
|
276
|
+
return { ...meta, executionPayloadBlinded, executionPayloadSource };
|
|
277
|
+
},
|
|
278
|
+
toHeadersObject: (meta) => ({
|
|
279
|
+
[MetaHeader.Version]: meta.version,
|
|
280
|
+
[MetaHeader.ExecutionPayloadBlinded]: meta.executionPayloadBlinded.toString(),
|
|
281
|
+
[MetaHeader.ExecutionPayloadSource]: meta.executionPayloadSource.toString(),
|
|
282
|
+
[MetaHeader.ExecutionPayloadValue]: meta.executionPayloadValue.toString(),
|
|
283
|
+
[MetaHeader.ConsensusBlockValue]: meta.consensusBlockValue.toString(),
|
|
284
|
+
}),
|
|
285
|
+
fromHeaders: (headers) => {
|
|
286
|
+
const executionPayloadBlinded = toBoolean(headers.getRequired(MetaHeader.ExecutionPayloadBlinded));
|
|
287
|
+
// Extract source from the headers and assign defaults in a spec compliant manner if not present
|
|
288
|
+
const executionPayloadSource = headers.get(MetaHeader.ExecutionPayloadSource) ??
|
|
289
|
+
(executionPayloadBlinded === true ? ProducedBlockSource.builder : ProducedBlockSource.engine);
|
|
290
|
+
return {
|
|
291
|
+
version: toForkName(headers.getRequired(MetaHeader.Version)),
|
|
292
|
+
executionPayloadBlinded,
|
|
293
|
+
executionPayloadSource,
|
|
294
|
+
executionPayloadValue: BigInt(headers.getRequired(MetaHeader.ExecutionPayloadValue)),
|
|
295
|
+
consensusBlockValue: BigInt(headers.getRequired(MetaHeader.ConsensusBlockValue)),
|
|
296
|
+
};
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
produceBlindedBlock: {
|
|
302
|
+
url: "/eth/v1/validator/blinded_blocks/{slot}",
|
|
303
|
+
method: "GET",
|
|
304
|
+
req: {
|
|
305
|
+
writeReq: ({ slot, randaoReveal, graffiti }) => ({
|
|
306
|
+
params: { slot },
|
|
307
|
+
query: { randao_reveal: toHexString(randaoReveal), graffiti: toGraffitiHex(graffiti) },
|
|
308
|
+
}),
|
|
309
|
+
parseReq: ({ params, query }) => ({
|
|
310
|
+
slot: params.slot,
|
|
311
|
+
randaoReveal: fromHexString(query.randao_reveal),
|
|
312
|
+
graffiti: fromGraffitiHex(query.graffiti),
|
|
313
|
+
}),
|
|
314
|
+
schema: {
|
|
315
|
+
params: { slot: Schema.UintRequired },
|
|
316
|
+
query: {
|
|
317
|
+
randao_reveal: Schema.StringRequired,
|
|
318
|
+
graffiti: Schema.String,
|
|
319
|
+
},
|
|
320
|
+
},
|
|
321
|
+
},
|
|
322
|
+
resp: {
|
|
323
|
+
data: WithVersion((fork) => getExecutionForkTypes(fork).BlindedBeaconBlock),
|
|
324
|
+
meta: VersionCodec,
|
|
130
325
|
},
|
|
131
326
|
},
|
|
132
|
-
produceBlock: produceBlockV3,
|
|
133
|
-
produceBlockV2: produceBlockV3,
|
|
134
|
-
produceBlockV3,
|
|
135
|
-
produceBlindedBlock: produceBlockV3,
|
|
136
327
|
produceAttestationData: {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
328
|
+
url: "/eth/v1/validator/attestation_data",
|
|
329
|
+
method: "GET",
|
|
330
|
+
req: {
|
|
331
|
+
writeReq: ({ committeeIndex, slot }) => ({ query: { slot, committee_index: committeeIndex } }),
|
|
332
|
+
parseReq: ({ query }) => ({ committeeIndex: query.committee_index, slot: query.slot }),
|
|
333
|
+
schema: {
|
|
334
|
+
query: { slot: Schema.UintRequired, committee_index: Schema.UintRequired },
|
|
335
|
+
},
|
|
336
|
+
},
|
|
337
|
+
resp: {
|
|
338
|
+
data: ssz.phase0.AttestationData,
|
|
339
|
+
meta: EmptyMetaCodec,
|
|
141
340
|
},
|
|
142
341
|
},
|
|
143
342
|
produceSyncCommitteeContribution: {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
343
|
+
url: "/eth/v1/validator/sync_committee_contribution",
|
|
344
|
+
method: "GET",
|
|
345
|
+
req: {
|
|
346
|
+
writeReq: ({ slot, subcommitteeIndex, beaconBlockRoot }) => ({
|
|
347
|
+
query: { slot, subcommittee_index: subcommitteeIndex, beacon_block_root: toHexString(beaconBlockRoot) },
|
|
348
|
+
}),
|
|
349
|
+
parseReq: ({ query }) => ({
|
|
350
|
+
slot: query.slot,
|
|
351
|
+
subcommitteeIndex: query.subcommittee_index,
|
|
352
|
+
beaconBlockRoot: fromHexString(query.beacon_block_root),
|
|
353
|
+
}),
|
|
354
|
+
schema: {
|
|
355
|
+
query: {
|
|
356
|
+
slot: Schema.UintRequired,
|
|
357
|
+
subcommittee_index: Schema.UintRequired,
|
|
358
|
+
beacon_block_root: Schema.StringRequired,
|
|
359
|
+
},
|
|
153
360
|
},
|
|
154
361
|
},
|
|
362
|
+
resp: {
|
|
363
|
+
data: ssz.altair.SyncCommitteeContribution,
|
|
364
|
+
meta: EmptyMetaCodec,
|
|
365
|
+
},
|
|
155
366
|
},
|
|
156
367
|
getAggregatedAttestation: {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
368
|
+
url: "/eth/v1/validator/aggregate_attestation",
|
|
369
|
+
method: "GET",
|
|
370
|
+
req: {
|
|
371
|
+
writeReq: ({ attestationDataRoot, slot }) => ({
|
|
372
|
+
query: { attestation_data_root: toHexString(attestationDataRoot), slot },
|
|
373
|
+
}),
|
|
374
|
+
parseReq: ({ query }) => ({ attestationDataRoot: fromHexString(query.attestation_data_root), slot: query.slot }),
|
|
375
|
+
schema: {
|
|
376
|
+
query: { attestation_data_root: Schema.StringRequired, slot: Schema.UintRequired },
|
|
377
|
+
},
|
|
378
|
+
},
|
|
379
|
+
resp: {
|
|
380
|
+
data: ssz.phase0.Attestation,
|
|
381
|
+
meta: EmptyMetaCodec,
|
|
382
|
+
},
|
|
383
|
+
},
|
|
384
|
+
publishAggregateAndProofs: {
|
|
385
|
+
url: "/eth/v1/validator/aggregate_and_proofs",
|
|
386
|
+
method: "POST",
|
|
387
|
+
req: {
|
|
388
|
+
writeReqJson: ({ signedAggregateAndProofs }) => ({
|
|
389
|
+
body: SignedAggregateAndProofListType.toJson(signedAggregateAndProofs),
|
|
390
|
+
}),
|
|
391
|
+
parseReqJson: ({ body }) => ({ signedAggregateAndProofs: SignedAggregateAndProofListType.fromJson(body) }),
|
|
392
|
+
writeReqSsz: ({ signedAggregateAndProofs }) => ({
|
|
393
|
+
body: SignedAggregateAndProofListType.serialize(signedAggregateAndProofs),
|
|
394
|
+
}),
|
|
395
|
+
parseReqSsz: ({ body }) => ({ signedAggregateAndProofs: SignedAggregateAndProofListType.deserialize(body) }),
|
|
396
|
+
schema: {
|
|
397
|
+
body: Schema.ObjectArray,
|
|
398
|
+
},
|
|
399
|
+
},
|
|
400
|
+
resp: EmptyResponseCodec,
|
|
401
|
+
},
|
|
402
|
+
publishContributionAndProofs: {
|
|
403
|
+
url: "/eth/v1/validator/contribution_and_proofs",
|
|
404
|
+
method: "POST",
|
|
405
|
+
req: {
|
|
406
|
+
writeReqJson: ({ contributionAndProofs }) => ({
|
|
407
|
+
body: SignedContributionAndProofListType.toJson(contributionAndProofs),
|
|
408
|
+
}),
|
|
409
|
+
parseReqJson: ({ body }) => ({ contributionAndProofs: SignedContributionAndProofListType.fromJson(body) }),
|
|
410
|
+
writeReqSsz: ({ contributionAndProofs }) => ({
|
|
411
|
+
body: SignedContributionAndProofListType.serialize(contributionAndProofs),
|
|
412
|
+
}),
|
|
413
|
+
parseReqSsz: ({ body }) => ({ contributionAndProofs: SignedContributionAndProofListType.deserialize(body) }),
|
|
414
|
+
schema: {
|
|
415
|
+
body: Schema.ObjectArray,
|
|
416
|
+
},
|
|
161
417
|
},
|
|
418
|
+
resp: EmptyResponseCodec,
|
|
419
|
+
},
|
|
420
|
+
prepareBeaconCommitteeSubnet: {
|
|
421
|
+
url: "/eth/v1/validator/beacon_committee_subscriptions",
|
|
422
|
+
method: "POST",
|
|
423
|
+
req: {
|
|
424
|
+
writeReqJson: ({ subscriptions }) => ({ body: BeaconCommitteeSubscriptionListType.toJson(subscriptions) }),
|
|
425
|
+
parseReqJson: ({ body }) => ({ subscriptions: BeaconCommitteeSubscriptionListType.fromJson(body) }),
|
|
426
|
+
writeReqSsz: ({ subscriptions }) => ({ body: BeaconCommitteeSubscriptionListType.serialize(subscriptions) }),
|
|
427
|
+
parseReqSsz: ({ body }) => ({ subscriptions: BeaconCommitteeSubscriptionListType.deserialize(body) }),
|
|
428
|
+
schema: { body: Schema.ObjectArray },
|
|
429
|
+
},
|
|
430
|
+
resp: EmptyResponseCodec,
|
|
431
|
+
},
|
|
432
|
+
prepareSyncCommitteeSubnets: {
|
|
433
|
+
url: "/eth/v1/validator/sync_committee_subscriptions",
|
|
434
|
+
method: "POST",
|
|
435
|
+
req: {
|
|
436
|
+
writeReqJson: ({ subscriptions }) => ({ body: SyncCommitteeSubscriptionListType.toJson(subscriptions) }),
|
|
437
|
+
parseReqJson: ({ body }) => ({ subscriptions: SyncCommitteeSubscriptionListType.fromJson(body) }),
|
|
438
|
+
writeReqSsz: ({ subscriptions }) => ({ body: SyncCommitteeSubscriptionListType.serialize(subscriptions) }),
|
|
439
|
+
parseReqSsz: ({ body }) => ({ subscriptions: SyncCommitteeSubscriptionListType.deserialize(body) }),
|
|
440
|
+
schema: { body: Schema.ObjectArray },
|
|
441
|
+
},
|
|
442
|
+
resp: EmptyResponseCodec,
|
|
162
443
|
},
|
|
163
|
-
publishAggregateAndProofs: reqOnlyBody(ArrayOf(ssz.phase0.SignedAggregateAndProof), Schema.ObjectArray),
|
|
164
|
-
publishContributionAndProofs: reqOnlyBody(ArrayOf(ssz.altair.SignedContributionAndProof), Schema.ObjectArray),
|
|
165
|
-
prepareBeaconCommitteeSubnet: reqOnlyBody(ArrayOf(BeaconCommitteeSubscription), Schema.ObjectArray),
|
|
166
|
-
prepareSyncCommitteeSubnets: reqOnlyBody(ArrayOf(SyncCommitteeSubscription), Schema.ObjectArray),
|
|
167
444
|
prepareBeaconProposer: {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
445
|
+
url: "/eth/v1/validator/prepare_beacon_proposer",
|
|
446
|
+
method: "POST",
|
|
447
|
+
req: JsonOnlyReq({
|
|
448
|
+
writeReqJson: ({ proposers }) => ({ body: ProposerPreparationDataListType.toJson(proposers) }),
|
|
449
|
+
parseReqJson: ({ body }) => ({ proposers: ProposerPreparationDataListType.fromJson(body) }),
|
|
450
|
+
schema: { body: Schema.ObjectArray },
|
|
451
|
+
}),
|
|
452
|
+
resp: EmptyResponseCodec,
|
|
173
453
|
},
|
|
174
454
|
submitBeaconCommitteeSelections: {
|
|
175
|
-
|
|
176
|
-
|
|
455
|
+
url: "/eth/v1/validator/beacon_committee_selections",
|
|
456
|
+
method: "POST",
|
|
457
|
+
req: {
|
|
458
|
+
writeReqJson: ({ selections }) => ({ body: BeaconCommitteeSelectionListType.toJson(selections) }),
|
|
459
|
+
parseReqJson: ({ body }) => ({ selections: BeaconCommitteeSelectionListType.fromJson(body) }),
|
|
460
|
+
writeReqSsz: ({ selections }) => ({ body: BeaconCommitteeSelectionListType.serialize(selections) }),
|
|
461
|
+
parseReqSsz: ({ body }) => ({ selections: BeaconCommitteeSelectionListType.deserialize(body) }),
|
|
462
|
+
schema: {
|
|
463
|
+
body: Schema.ObjectArray,
|
|
464
|
+
},
|
|
465
|
+
},
|
|
466
|
+
resp: {
|
|
467
|
+
data: BeaconCommitteeSelectionListType,
|
|
468
|
+
meta: EmptyMetaCodec,
|
|
469
|
+
},
|
|
177
470
|
},
|
|
178
471
|
submitSyncCommitteeSelections: {
|
|
179
|
-
|
|
180
|
-
|
|
472
|
+
url: "/eth/v1/validator/sync_committee_selections",
|
|
473
|
+
method: "POST",
|
|
474
|
+
req: {
|
|
475
|
+
writeReqJson: ({ selections }) => ({ body: SyncCommitteeSelectionListType.toJson(selections) }),
|
|
476
|
+
parseReqJson: ({ body }) => ({ selections: SyncCommitteeSelectionListType.fromJson(body) }),
|
|
477
|
+
writeReqSsz: ({ selections }) => ({ body: SyncCommitteeSelectionListType.serialize(selections) }),
|
|
478
|
+
parseReqSsz: ({ body }) => ({ selections: SyncCommitteeSelectionListType.deserialize(body) }),
|
|
479
|
+
schema: {
|
|
480
|
+
body: Schema.ObjectArray,
|
|
481
|
+
},
|
|
482
|
+
},
|
|
483
|
+
resp: {
|
|
484
|
+
data: SyncCommitteeSelectionListType,
|
|
485
|
+
meta: EmptyMetaCodec,
|
|
486
|
+
},
|
|
181
487
|
},
|
|
182
488
|
getLiveness: {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
params: { epoch:
|
|
187
|
-
body:
|
|
489
|
+
url: "/eth/v1/validator/liveness/{epoch}",
|
|
490
|
+
method: "POST",
|
|
491
|
+
req: {
|
|
492
|
+
writeReqJson: ({ epoch, indices }) => ({ params: { epoch }, body: ValidatorIndicesType.toJson(indices) }),
|
|
493
|
+
parseReqJson: ({ params, body }) => ({ epoch: params.epoch, indices: ValidatorIndicesType.fromJson(body) }),
|
|
494
|
+
writeReqSsz: ({ epoch, indices }) => ({ params: { epoch }, body: ValidatorIndicesType.serialize(indices) }),
|
|
495
|
+
parseReqSsz: ({ params, body }) => ({ epoch: params.epoch, indices: ValidatorIndicesType.deserialize(body) }),
|
|
496
|
+
schema: {
|
|
497
|
+
params: { epoch: Schema.UintRequired },
|
|
498
|
+
body: Schema.StringArray,
|
|
499
|
+
},
|
|
188
500
|
},
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
export function getReturnTypes() {
|
|
194
|
-
const rootHexType = new StringType();
|
|
195
|
-
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
196
|
-
const WithDependentRootExecutionOptimistic = (dataType) => new ContainerType({
|
|
197
|
-
executionOptimistic: ssz.Boolean,
|
|
198
|
-
data: dataType,
|
|
199
|
-
dependentRoot: rootHexType,
|
|
200
|
-
}, { jsonCase: "eth2" });
|
|
201
|
-
const AttesterDuty = new ContainerType({
|
|
202
|
-
pubkey: ssz.BLSPubkey,
|
|
203
|
-
validatorIndex: ssz.ValidatorIndex,
|
|
204
|
-
committeeIndex: ssz.CommitteeIndex,
|
|
205
|
-
committeeLength: ssz.UintNum64,
|
|
206
|
-
committeesAtSlot: ssz.UintNum64,
|
|
207
|
-
validatorCommitteeIndex: ssz.UintNum64,
|
|
208
|
-
slot: ssz.Slot,
|
|
209
|
-
}, { jsonCase: "eth2" });
|
|
210
|
-
const ProposerDuty = new ContainerType({
|
|
211
|
-
slot: ssz.Slot,
|
|
212
|
-
validatorIndex: ssz.ValidatorIndex,
|
|
213
|
-
pubkey: ssz.BLSPubkey,
|
|
214
|
-
}, { jsonCase: "eth2" });
|
|
215
|
-
const SyncDuty = new ContainerType({
|
|
216
|
-
pubkey: ssz.BLSPubkey,
|
|
217
|
-
validatorIndex: ssz.ValidatorIndex,
|
|
218
|
-
validatorSyncCommitteeIndices: ArrayOf(ssz.UintNum64),
|
|
219
|
-
}, { jsonCase: "eth2" });
|
|
220
|
-
const produceBlockOrContents = WithBlockValues(WithVersion((fork) => isForkBlobs(fork) ? allForksBlockContentsResSerializer(fork) : ssz[fork].BeaconBlock));
|
|
221
|
-
const produceBlindedBlock = WithBlockValues(WithVersion((fork) => ssz.allForksBlinded[isForkExecution(fork) ? fork : ForkName.bellatrix].BeaconBlock));
|
|
222
|
-
return {
|
|
223
|
-
getAttesterDuties: WithDependentRootExecutionOptimistic(ArrayOf(AttesterDuty)),
|
|
224
|
-
getProposerDuties: WithDependentRootExecutionOptimistic(ArrayOf(ProposerDuty)),
|
|
225
|
-
getSyncCommitteeDuties: ContainerDataExecutionOptimistic(ArrayOf(SyncDuty)),
|
|
226
|
-
produceBlock: ContainerData(ssz.phase0.BeaconBlock),
|
|
227
|
-
produceBlockV2: produceBlockOrContents,
|
|
228
|
-
produceBlockV3: {
|
|
229
|
-
toJson: (data) => {
|
|
230
|
-
if (data.executionPayloadBlinded) {
|
|
231
|
-
return {
|
|
232
|
-
execution_payload_blinded: true,
|
|
233
|
-
execution_payload_source: data.executionPayloadSource,
|
|
234
|
-
...produceBlindedBlock.toJson(data),
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
else {
|
|
238
|
-
return {
|
|
239
|
-
execution_payload_blinded: false,
|
|
240
|
-
execution_payload_source: data.executionPayloadSource,
|
|
241
|
-
...produceBlockOrContents.toJson(data),
|
|
242
|
-
};
|
|
243
|
-
}
|
|
501
|
+
resp: {
|
|
502
|
+
data: LivenessResponseDataListType,
|
|
503
|
+
meta: EmptyMetaCodec,
|
|
244
504
|
},
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
return { executionPayloadBlinded, executionPayloadSource, ...produceBlockOrContents.fromJson(data) };
|
|
258
|
-
}
|
|
505
|
+
},
|
|
506
|
+
registerValidator: {
|
|
507
|
+
url: "/eth/v1/validator/register_validator",
|
|
508
|
+
method: "POST",
|
|
509
|
+
req: {
|
|
510
|
+
writeReqJson: ({ registrations }) => ({ body: SignedValidatorRegistrationV1ListType.toJson(registrations) }),
|
|
511
|
+
parseReqJson: ({ body }) => ({ registrations: SignedValidatorRegistrationV1ListType.fromJson(body) }),
|
|
512
|
+
writeReqSsz: ({ registrations }) => ({ body: SignedValidatorRegistrationV1ListType.serialize(registrations) }),
|
|
513
|
+
parseReqSsz: ({ body }) => ({ registrations: SignedValidatorRegistrationV1ListType.deserialize(body) }),
|
|
514
|
+
schema: {
|
|
515
|
+
body: Schema.ObjectArray,
|
|
516
|
+
},
|
|
259
517
|
},
|
|
518
|
+
resp: EmptyResponseCodec,
|
|
260
519
|
},
|
|
261
|
-
produceBlindedBlock,
|
|
262
|
-
produceAttestationData: ContainerData(ssz.phase0.AttestationData),
|
|
263
|
-
produceSyncCommitteeContribution: ContainerData(ssz.altair.SyncCommitteeContribution),
|
|
264
|
-
getAggregatedAttestation: ContainerData(ssz.phase0.Attestation),
|
|
265
|
-
submitBeaconCommitteeSelections: ContainerData(ArrayOf(BeaconCommitteeSelection)),
|
|
266
|
-
submitSyncCommitteeSelections: ContainerData(ArrayOf(SyncCommitteeSelection)),
|
|
267
|
-
getLiveness: jsonType("snake"),
|
|
268
520
|
};
|
|
269
521
|
}
|
|
270
522
|
function parseBuilderBoostFactor(builderBoostFactorInput) {
|
|
271
523
|
return builderBoostFactorInput !== undefined ? BigInt(builderBoostFactorInput) : undefined;
|
|
272
524
|
}
|
|
525
|
+
function writeSkipRandaoVerification(skipRandaoVerification) {
|
|
526
|
+
return skipRandaoVerification === true ? "" : undefined;
|
|
527
|
+
}
|
|
273
528
|
function parseSkipRandaoVerification(skipRandaoVerification) {
|
|
274
529
|
return skipRandaoVerification !== undefined && skipRandaoVerification === "";
|
|
275
530
|
}
|