@lodestar/api 1.20.0-dev.f6d3bce802 → 1.20.0-dev.ff253a7e4b
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 +1 -1
- 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 +32 -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 +282 -164
- package/lib/beacon/routes/beacon/block.js +324 -116
- 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 +32 -95
- package/lib/beacon/routes/debug.js +87 -45
- package/lib/beacon/routes/debug.js.map +1 -1
- package/lib/beacon/routes/events.d.ts +20 -16
- package/lib/beacon/routes/events.js +39 -17
- 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 +33 -55
- package/lib/beacon/routes/lightclient.js +107 -47
- 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 +547 -320
- package/lib/beacon/routes/validator.js +494 -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 +24 -38
- package/lib/builder/routes.js +77 -33
- 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 +8 -6
- package/lib/index.js +4 -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 +35 -0
- package/lib/utils/client/response.js +166 -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 +8 -0
- package/lib/utils/fork.js +35 -0
- package/lib/utils/fork.js.map +1 -0
- package/lib/utils/headers.d.ts +37 -0
- package/lib/utils/headers.js +135 -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 +109 -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,146 +1,158 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { ContainerType, ValueOf } from "@chainsafe/ssz";
|
|
2
|
+
import { ChainForkConfig } from "@lodestar/config";
|
|
3
|
+
import { Epoch } from "@lodestar/types";
|
|
4
|
+
import { Endpoint, RouteDefinitions } from "../../../utils/index.js";
|
|
5
|
+
import { ExecutionOptimisticAndFinalizedMeta } from "../../../utils/metadata.js";
|
|
6
|
+
import { BlockArgs } from "./block.js";
|
|
6
7
|
import { ValidatorId } from "./state.js";
|
|
7
|
-
|
|
8
|
-
* True if the response references an unverified execution payload. Optimistic information may be invalidated at
|
|
9
|
-
* a later time. If the field is not present, assume the False value.
|
|
10
|
-
*/
|
|
11
|
-
export type ExecutionOptimistic = boolean;
|
|
12
|
-
/**
|
|
13
|
-
* True if the response references the finalized history of the chain, as determined by fork choice.
|
|
14
|
-
*/
|
|
15
|
-
export type Finalized = boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Rewards info for a single block. Every reward value is in Gwei.
|
|
18
|
-
*/
|
|
19
|
-
export type BlockRewards = {
|
|
8
|
+
declare const BlockRewardsType: ContainerType<{
|
|
20
9
|
/** Proposer of the block, the proposer index who receives these rewards */
|
|
21
|
-
proposerIndex:
|
|
10
|
+
proposerIndex: import("@chainsafe/ssz").UintNumberType;
|
|
22
11
|
/** Total block reward, equal to attestations + sync_aggregate + proposer_slashings + attester_slashings */
|
|
23
|
-
total:
|
|
12
|
+
total: import("@chainsafe/ssz").UintNumberType;
|
|
24
13
|
/** Block reward component due to included attestations */
|
|
25
|
-
attestations:
|
|
14
|
+
attestations: import("@chainsafe/ssz").UintNumberType;
|
|
26
15
|
/** Block reward component due to included sync_aggregate */
|
|
27
|
-
syncAggregate:
|
|
16
|
+
syncAggregate: import("@chainsafe/ssz").UintNumberType;
|
|
28
17
|
/** Block reward component due to included proposer_slashings */
|
|
29
|
-
proposerSlashings:
|
|
18
|
+
proposerSlashings: import("@chainsafe/ssz").UintNumberType;
|
|
30
19
|
/** Block reward component due to included attester_slashings */
|
|
31
|
-
attesterSlashings:
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
* Rewards for a single set of (ideal or actual depending on usage) attestations. Reward value is in Gwei
|
|
35
|
-
*/
|
|
36
|
-
type AttestationsReward = {
|
|
20
|
+
attesterSlashings: import("@chainsafe/ssz").UintNumberType;
|
|
21
|
+
}>;
|
|
22
|
+
declare const AttestationsRewardType: ContainerType<{
|
|
37
23
|
/** Reward for head vote. Could be negative to indicate penalty */
|
|
38
|
-
head:
|
|
24
|
+
head: import("@chainsafe/ssz").UintNumberType;
|
|
39
25
|
/** Reward for target vote. Could be negative to indicate penalty */
|
|
40
|
-
target:
|
|
26
|
+
target: import("@chainsafe/ssz").UintNumberType;
|
|
41
27
|
/** Reward for source vote. Could be negative to indicate penalty */
|
|
42
|
-
source:
|
|
28
|
+
source: import("@chainsafe/ssz").UintNumberType;
|
|
43
29
|
/** Inclusion delay reward (phase0 only) */
|
|
44
|
-
inclusionDelay:
|
|
30
|
+
inclusionDelay: import("@chainsafe/ssz").UintNumberType;
|
|
45
31
|
/** Inactivity penalty. Should be a negative number to indicate penalty */
|
|
46
|
-
inactivity:
|
|
47
|
-
}
|
|
32
|
+
inactivity: import("@chainsafe/ssz").UintNumberType;
|
|
33
|
+
}>;
|
|
34
|
+
declare const IdealAttestationsRewardsType: ContainerType<{
|
|
35
|
+
effectiveBalance: import("@chainsafe/ssz").UintNumberType;
|
|
36
|
+
/** Reward for head vote. Could be negative to indicate penalty */
|
|
37
|
+
head: import("@chainsafe/ssz").UintNumberType;
|
|
38
|
+
/** Reward for target vote. Could be negative to indicate penalty */
|
|
39
|
+
target: import("@chainsafe/ssz").UintNumberType;
|
|
40
|
+
/** Reward for source vote. Could be negative to indicate penalty */
|
|
41
|
+
source: import("@chainsafe/ssz").UintNumberType;
|
|
42
|
+
/** Inclusion delay reward (phase0 only) */
|
|
43
|
+
inclusionDelay: import("@chainsafe/ssz").UintNumberType;
|
|
44
|
+
/** Inactivity penalty. Should be a negative number to indicate penalty */
|
|
45
|
+
inactivity: import("@chainsafe/ssz").UintNumberType;
|
|
46
|
+
}>;
|
|
47
|
+
declare const TotalAttestationsRewardsType: ContainerType<{
|
|
48
|
+
validatorIndex: import("@chainsafe/ssz").UintNumberType;
|
|
49
|
+
/** Reward for head vote. Could be negative to indicate penalty */
|
|
50
|
+
head: import("@chainsafe/ssz").UintNumberType;
|
|
51
|
+
/** Reward for target vote. Could be negative to indicate penalty */
|
|
52
|
+
target: import("@chainsafe/ssz").UintNumberType;
|
|
53
|
+
/** Reward for source vote. Could be negative to indicate penalty */
|
|
54
|
+
source: import("@chainsafe/ssz").UintNumberType;
|
|
55
|
+
/** Inclusion delay reward (phase0 only) */
|
|
56
|
+
inclusionDelay: import("@chainsafe/ssz").UintNumberType;
|
|
57
|
+
/** Inactivity penalty. Should be a negative number to indicate penalty */
|
|
58
|
+
inactivity: import("@chainsafe/ssz").UintNumberType;
|
|
59
|
+
}>;
|
|
60
|
+
declare const AttestationsRewardsType: ContainerType<{
|
|
61
|
+
idealRewards: import("@chainsafe/ssz").ArrayType<import("@chainsafe/ssz").Type<import("@chainsafe/ssz").ValueOfFields<{
|
|
62
|
+
effectiveBalance: import("@chainsafe/ssz").UintNumberType;
|
|
63
|
+
/** Reward for head vote. Could be negative to indicate penalty */
|
|
64
|
+
head: import("@chainsafe/ssz").UintNumberType;
|
|
65
|
+
/** Reward for target vote. Could be negative to indicate penalty */
|
|
66
|
+
target: import("@chainsafe/ssz").UintNumberType;
|
|
67
|
+
/** Reward for source vote. Could be negative to indicate penalty */
|
|
68
|
+
source: import("@chainsafe/ssz").UintNumberType;
|
|
69
|
+
/** Inclusion delay reward (phase0 only) */
|
|
70
|
+
inclusionDelay: import("@chainsafe/ssz").UintNumberType;
|
|
71
|
+
/** Inactivity penalty. Should be a negative number to indicate penalty */
|
|
72
|
+
inactivity: import("@chainsafe/ssz").UintNumberType;
|
|
73
|
+
}>>, unknown, unknown>;
|
|
74
|
+
totalRewards: import("@chainsafe/ssz").ArrayType<import("@chainsafe/ssz").Type<import("@chainsafe/ssz").ValueOfFields<{
|
|
75
|
+
validatorIndex: import("@chainsafe/ssz").UintNumberType;
|
|
76
|
+
/** Reward for head vote. Could be negative to indicate penalty */
|
|
77
|
+
head: import("@chainsafe/ssz").UintNumberType;
|
|
78
|
+
/** Reward for target vote. Could be negative to indicate penalty */
|
|
79
|
+
target: import("@chainsafe/ssz").UintNumberType;
|
|
80
|
+
/** Reward for source vote. Could be negative to indicate penalty */
|
|
81
|
+
source: import("@chainsafe/ssz").UintNumberType;
|
|
82
|
+
/** Inclusion delay reward (phase0 only) */
|
|
83
|
+
inclusionDelay: import("@chainsafe/ssz").UintNumberType;
|
|
84
|
+
/** Inactivity penalty. Should be a negative number to indicate penalty */
|
|
85
|
+
inactivity: import("@chainsafe/ssz").UintNumberType;
|
|
86
|
+
}>>, unknown, unknown>;
|
|
87
|
+
}>;
|
|
88
|
+
declare const SyncCommitteeRewardsType: import("@chainsafe/ssz").ArrayType<import("@chainsafe/ssz").Type<import("@chainsafe/ssz").ValueOfFields<{
|
|
89
|
+
validatorIndex: import("@chainsafe/ssz").UintNumberType;
|
|
90
|
+
reward: import("@chainsafe/ssz").UintNumberType;
|
|
91
|
+
}>>, unknown, unknown>;
|
|
92
|
+
/**
|
|
93
|
+
* Rewards info for a single block. Every reward value is in Gwei.
|
|
94
|
+
*/
|
|
95
|
+
export type BlockRewards = ValueOf<typeof BlockRewardsType>;
|
|
96
|
+
/**
|
|
97
|
+
* Rewards for a single set of (ideal or actual depending on usage) attestations. Reward value is in Gwei
|
|
98
|
+
*/
|
|
99
|
+
export type AttestationsReward = ValueOf<typeof AttestationsRewardType>;
|
|
48
100
|
/**
|
|
49
101
|
* Rewards info for ideal attestations ie. Maximum rewards could be earned by making timely head, target and source vote.
|
|
50
102
|
* `effectiveBalance` is in Gwei
|
|
51
103
|
*/
|
|
52
|
-
export type IdealAttestationsReward =
|
|
53
|
-
effectiveBalance: number;
|
|
54
|
-
};
|
|
104
|
+
export type IdealAttestationsReward = ValueOf<typeof IdealAttestationsRewardsType>;
|
|
55
105
|
/**
|
|
56
106
|
* Rewards info for actual attestations
|
|
57
107
|
*/
|
|
58
|
-
export type TotalAttestationsReward =
|
|
59
|
-
|
|
60
|
-
};
|
|
61
|
-
export type AttestationsRewards = {
|
|
62
|
-
idealRewards: IdealAttestationsReward[];
|
|
63
|
-
totalRewards: TotalAttestationsReward[];
|
|
64
|
-
};
|
|
108
|
+
export type TotalAttestationsReward = ValueOf<typeof TotalAttestationsRewardsType>;
|
|
109
|
+
export type AttestationsRewards = ValueOf<typeof AttestationsRewardsType>;
|
|
65
110
|
/**
|
|
66
111
|
* Rewards info for sync committee participation. Every reward value is in Gwei.
|
|
67
112
|
* Note: In the case that block proposer is present in `SyncCommitteeRewards`, the reward value only reflects rewards for
|
|
68
113
|
* participating in sync committee. Please refer to `BlockRewards.syncAggregate` for rewards of proposer including sync committee
|
|
69
114
|
* outputs into their block
|
|
70
115
|
*/
|
|
71
|
-
export type SyncCommitteeRewards =
|
|
72
|
-
|
|
73
|
-
reward: number;
|
|
74
|
-
}[];
|
|
75
|
-
export type Api = {
|
|
116
|
+
export type SyncCommitteeRewards = ValueOf<typeof SyncCommitteeRewardsType>;
|
|
117
|
+
export type Endpoints = {
|
|
76
118
|
/**
|
|
77
119
|
* Get block rewards
|
|
78
120
|
* Returns the info of rewards received by the block proposer
|
|
79
|
-
*
|
|
80
|
-
* @param blockId Block identifier.
|
|
81
|
-
* Can be one of: "head" (canonical head in node's view), "genesis", "finalized", \<slot\>, \<hex encoded blockRoot with 0x prefix\>.
|
|
82
121
|
*/
|
|
83
|
-
getBlockRewards
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
executionOptimistic: ExecutionOptimistic;
|
|
87
|
-
finalized: Finalized;
|
|
122
|
+
getBlockRewards: Endpoint<"GET", BlockArgs, {
|
|
123
|
+
params: {
|
|
124
|
+
block_id: string;
|
|
88
125
|
};
|
|
89
|
-
},
|
|
126
|
+
}, BlockRewards, ExecutionOptimisticAndFinalizedMeta>;
|
|
90
127
|
/**
|
|
91
128
|
* Get attestations rewards
|
|
92
129
|
* Negative values indicate penalties. `inactivity` can only be either 0 or negative number since it is penalty only
|
|
93
|
-
*
|
|
94
|
-
* @param epoch The epoch to get rewards info from
|
|
95
|
-
* @param validatorIds List of validator indices or pubkeys to filter in
|
|
96
130
|
*/
|
|
97
|
-
getAttestationsRewards
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
131
|
+
getAttestationsRewards: Endpoint<"POST", {
|
|
132
|
+
/** The epoch to get rewards info from */
|
|
133
|
+
epoch: Epoch;
|
|
134
|
+
/** List of validator indices or pubkeys to filter in */
|
|
135
|
+
validatorIds?: ValidatorId[];
|
|
136
|
+
}, {
|
|
137
|
+
params: {
|
|
138
|
+
epoch: number;
|
|
102
139
|
};
|
|
103
|
-
|
|
140
|
+
body: string[];
|
|
141
|
+
}, AttestationsRewards, ExecutionOptimisticAndFinalizedMeta>;
|
|
104
142
|
/**
|
|
105
143
|
* Get sync committee rewards
|
|
106
144
|
* Returns participant reward value for each sync committee member at the given block.
|
|
107
|
-
*
|
|
108
|
-
* @param blockId Block identifier.
|
|
109
|
-
* Can be one of: "head" (canonical head in node's view), "genesis", "finalized", \<slot\>, \<hex encoded blockRoot with 0x prefix\>.
|
|
110
|
-
* @param validatorIds List of validator indices or pubkeys to filter in
|
|
111
145
|
*/
|
|
112
|
-
getSyncCommitteeRewards
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
finalized: Finalized;
|
|
117
|
-
};
|
|
118
|
-
}, HttpStatusCode.BAD_REQUEST | HttpStatusCode.NOT_FOUND>>;
|
|
119
|
-
};
|
|
120
|
-
/**
|
|
121
|
-
* Define javascript values for each route
|
|
122
|
-
*/
|
|
123
|
-
export declare const routesData: RoutesData<Api>;
|
|
124
|
-
export type ReqTypes = {
|
|
125
|
-
getBlockRewards: {
|
|
126
|
-
params: {
|
|
127
|
-
block_id: string;
|
|
128
|
-
};
|
|
129
|
-
};
|
|
130
|
-
getAttestationsRewards: {
|
|
131
|
-
params: {
|
|
132
|
-
epoch: number;
|
|
133
|
-
};
|
|
134
|
-
body: ValidatorId[];
|
|
135
|
-
};
|
|
136
|
-
getSyncCommitteeRewards: {
|
|
146
|
+
getSyncCommitteeRewards: Endpoint<"POST", BlockArgs & {
|
|
147
|
+
/** List of validator indices or pubkeys to filter in */
|
|
148
|
+
validatorIds?: ValidatorId[];
|
|
149
|
+
}, {
|
|
137
150
|
params: {
|
|
138
151
|
block_id: string;
|
|
139
152
|
};
|
|
140
|
-
body:
|
|
141
|
-
}
|
|
153
|
+
body: string[];
|
|
154
|
+
}, SyncCommitteeRewards, ExecutionOptimisticAndFinalizedMeta>;
|
|
142
155
|
};
|
|
143
|
-
export declare function
|
|
144
|
-
export declare function getReturnTypes(): ReturnTypes<Api>;
|
|
156
|
+
export declare function getDefinitions(_config: ChainForkConfig): RouteDefinitions<Endpoints>;
|
|
145
157
|
export {};
|
|
146
158
|
//# sourceMappingURL=rewards.d.ts.map
|
|
@@ -1,77 +1,112 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
1
2
|
import { ContainerType } from "@chainsafe/ssz";
|
|
2
3
|
import { ssz } from "@lodestar/types";
|
|
3
|
-
import { Schema
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
import { Schema } from "../../../utils/index.js";
|
|
5
|
+
import { fromValidatorIdsStr, toValidatorIdsStr } from "../../../utils/serdes.js";
|
|
6
|
+
import { ArrayOf, JsonOnlyReq } from "../../../utils/codecs.js";
|
|
7
|
+
import { ExecutionOptimisticAndFinalizedCodec } from "../../../utils/metadata.js";
|
|
8
|
+
// See /packages/api/src/routes/index.ts for reasoning and instructions to add new routes
|
|
9
|
+
const BlockRewardsType = new ContainerType({
|
|
10
|
+
/** Proposer of the block, the proposer index who receives these rewards */
|
|
11
|
+
proposerIndex: ssz.ValidatorIndex,
|
|
12
|
+
/** Total block reward, equal to attestations + sync_aggregate + proposer_slashings + attester_slashings */
|
|
13
|
+
total: ssz.UintNum64,
|
|
14
|
+
/** Block reward component due to included attestations */
|
|
15
|
+
attestations: ssz.UintNum64,
|
|
16
|
+
/** Block reward component due to included sync_aggregate */
|
|
17
|
+
syncAggregate: ssz.UintNum64,
|
|
18
|
+
/** Block reward component due to included proposer_slashings */
|
|
19
|
+
proposerSlashings: ssz.UintNum64,
|
|
20
|
+
/** Block reward component due to included attester_slashings */
|
|
21
|
+
attesterSlashings: ssz.UintNum64,
|
|
22
|
+
}, { jsonCase: "eth2" });
|
|
23
|
+
const AttestationsRewardType = new ContainerType({
|
|
24
|
+
/** Reward for head vote. Could be negative to indicate penalty */
|
|
25
|
+
head: ssz.UintNum64,
|
|
26
|
+
/** Reward for target vote. Could be negative to indicate penalty */
|
|
27
|
+
target: ssz.UintNum64,
|
|
28
|
+
/** Reward for source vote. Could be negative to indicate penalty */
|
|
29
|
+
source: ssz.UintNum64,
|
|
30
|
+
/** Inclusion delay reward (phase0 only) */
|
|
31
|
+
inclusionDelay: ssz.UintNum64,
|
|
32
|
+
/** Inactivity penalty. Should be a negative number to indicate penalty */
|
|
33
|
+
inactivity: ssz.UintNum64,
|
|
34
|
+
}, { jsonCase: "eth2" });
|
|
35
|
+
const IdealAttestationsRewardsType = new ContainerType({
|
|
36
|
+
...AttestationsRewardType.fields,
|
|
37
|
+
effectiveBalance: ssz.UintNum64,
|
|
38
|
+
}, { jsonCase: "eth2" });
|
|
39
|
+
const TotalAttestationsRewardsType = new ContainerType({
|
|
40
|
+
...AttestationsRewardType.fields,
|
|
41
|
+
validatorIndex: ssz.ValidatorIndex,
|
|
42
|
+
}, { jsonCase: "eth2" });
|
|
43
|
+
const AttestationsRewardsType = new ContainerType({
|
|
44
|
+
idealRewards: ArrayOf(IdealAttestationsRewardsType),
|
|
45
|
+
totalRewards: ArrayOf(TotalAttestationsRewardsType),
|
|
46
|
+
}, { jsonCase: "eth2" });
|
|
47
|
+
const SyncCommitteeRewardsType = ArrayOf(new ContainerType({
|
|
48
|
+
validatorIndex: ssz.ValidatorIndex,
|
|
49
|
+
reward: ssz.UintNum64,
|
|
50
|
+
}, { jsonCase: "eth2" }));
|
|
51
|
+
export function getDefinitions(_config) {
|
|
14
52
|
return {
|
|
15
53
|
getBlockRewards: {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
54
|
+
url: "/eth/v1/beacon/rewards/blocks/{block_id}",
|
|
55
|
+
method: "GET",
|
|
56
|
+
req: {
|
|
57
|
+
writeReq: ({ blockId }) => ({ params: { block_id: blockId.toString() } }),
|
|
58
|
+
parseReq: ({ params }) => ({ blockId: params.block_id }),
|
|
59
|
+
schema: { params: { block_id: Schema.StringRequired } },
|
|
60
|
+
},
|
|
61
|
+
resp: {
|
|
62
|
+
data: BlockRewardsType,
|
|
63
|
+
meta: ExecutionOptimisticAndFinalizedCodec,
|
|
64
|
+
},
|
|
19
65
|
},
|
|
20
66
|
getAttestationsRewards: {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
67
|
+
url: "/eth/v1/beacon/rewards/attestations/{epoch}",
|
|
68
|
+
method: "POST",
|
|
69
|
+
req: JsonOnlyReq({
|
|
70
|
+
writeReqJson: ({ epoch, validatorIds }) => ({
|
|
71
|
+
params: { epoch },
|
|
72
|
+
body: toValidatorIdsStr(validatorIds) || [],
|
|
73
|
+
}),
|
|
74
|
+
parseReqJson: ({ params, body }) => ({
|
|
75
|
+
epoch: params.epoch,
|
|
76
|
+
validatorIds: fromValidatorIdsStr(body),
|
|
77
|
+
}),
|
|
78
|
+
schema: {
|
|
79
|
+
params: { epoch: Schema.UintRequired },
|
|
80
|
+
body: Schema.UintOrStringArray,
|
|
81
|
+
},
|
|
82
|
+
}),
|
|
83
|
+
resp: {
|
|
84
|
+
data: AttestationsRewardsType,
|
|
85
|
+
meta: ExecutionOptimisticAndFinalizedCodec,
|
|
26
86
|
},
|
|
27
87
|
},
|
|
28
88
|
getSyncCommitteeRewards: {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
89
|
+
url: "/eth/v1/beacon/rewards/sync_committee/{block_id}",
|
|
90
|
+
method: "POST",
|
|
91
|
+
req: JsonOnlyReq({
|
|
92
|
+
writeReqJson: ({ blockId, validatorIds }) => ({
|
|
93
|
+
params: { block_id: blockId.toString() },
|
|
94
|
+
body: toValidatorIdsStr(validatorIds) || [],
|
|
95
|
+
}),
|
|
96
|
+
parseReqJson: ({ params, body }) => ({
|
|
97
|
+
blockId: params.block_id,
|
|
98
|
+
validatorIds: fromValidatorIdsStr(body),
|
|
99
|
+
}),
|
|
100
|
+
schema: {
|
|
101
|
+
params: { block_id: Schema.StringRequired },
|
|
102
|
+
body: Schema.UintOrStringArray,
|
|
103
|
+
},
|
|
104
|
+
}),
|
|
105
|
+
resp: {
|
|
106
|
+
data: SyncCommitteeRewardsType,
|
|
107
|
+
meta: ExecutionOptimisticAndFinalizedCodec,
|
|
34
108
|
},
|
|
35
109
|
},
|
|
36
110
|
};
|
|
37
111
|
}
|
|
38
|
-
export function getReturnTypes() {
|
|
39
|
-
const BlockRewardsResponse = new ContainerType({
|
|
40
|
-
proposerIndex: ssz.ValidatorIndex,
|
|
41
|
-
total: ssz.UintNum64,
|
|
42
|
-
attestations: ssz.UintNum64,
|
|
43
|
-
syncAggregate: ssz.UintNum64,
|
|
44
|
-
proposerSlashings: ssz.UintNum64,
|
|
45
|
-
attesterSlashings: ssz.UintNum64,
|
|
46
|
-
}, { jsonCase: "eth2" });
|
|
47
|
-
const IdealAttestationsRewardsResponse = new ContainerType({
|
|
48
|
-
head: ssz.UintNum64,
|
|
49
|
-
target: ssz.UintNum64,
|
|
50
|
-
source: ssz.UintNum64,
|
|
51
|
-
inclusionDelay: ssz.UintNum64,
|
|
52
|
-
inactivity: ssz.UintNum64,
|
|
53
|
-
effectiveBalance: ssz.UintNum64,
|
|
54
|
-
}, { jsonCase: "eth2" });
|
|
55
|
-
const TotalAttestationsRewardsResponse = new ContainerType({
|
|
56
|
-
head: ssz.UintNum64,
|
|
57
|
-
target: ssz.UintNum64,
|
|
58
|
-
source: ssz.UintNum64,
|
|
59
|
-
inclusionDelay: ssz.UintNum64,
|
|
60
|
-
inactivity: ssz.UintNum64,
|
|
61
|
-
validatorIndex: ssz.ValidatorIndex,
|
|
62
|
-
}, { jsonCase: "eth2" });
|
|
63
|
-
const AttestationsRewardsResponse = new ContainerType({
|
|
64
|
-
idealRewards: ArrayOf(IdealAttestationsRewardsResponse),
|
|
65
|
-
totalRewards: ArrayOf(TotalAttestationsRewardsResponse),
|
|
66
|
-
}, { jsonCase: "eth2" });
|
|
67
|
-
const SyncCommitteeRewardsResponse = new ContainerType({
|
|
68
|
-
validatorIndex: ssz.ValidatorIndex,
|
|
69
|
-
reward: ssz.UintNum64,
|
|
70
|
-
}, { jsonCase: "eth2" });
|
|
71
|
-
return {
|
|
72
|
-
getBlockRewards: WithFinalized(ContainerDataExecutionOptimistic(BlockRewardsResponse)),
|
|
73
|
-
getAttestationsRewards: WithFinalized(ContainerDataExecutionOptimistic(AttestationsRewardsResponse)),
|
|
74
|
-
getSyncCommitteeRewards: WithFinalized(ContainerDataExecutionOptimistic(ArrayOf(SyncCommitteeRewardsResponse))),
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
112
|
//# sourceMappingURL=rewards.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rewards.js","sourceRoot":"","sources":["../../../../src/beacon/routes/beacon/rewards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,
|
|
1
|
+
{"version":3,"file":"rewards.js","sourceRoot":"","sources":["../../../../src/beacon/routes/beacon/rewards.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,OAAO,EAAC,aAAa,EAAU,MAAM,gBAAgB,CAAC;AAEtD,OAAO,EAAQ,GAAG,EAAC,MAAM,iBAAiB,CAAC;AAE3C,OAAO,EAAC,MAAM,EAA6B,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAC,mBAAmB,EAAE,iBAAiB,EAAC,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAC,OAAO,EAAE,WAAW,EAAC,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAC,oCAAoC,EAAsC,MAAM,4BAA4B,CAAC;AAIrH,yFAAyF;AAEzF,MAAM,gBAAgB,GAAG,IAAI,aAAa,CACxC;IACE,2EAA2E;IAC3E,aAAa,EAAE,GAAG,CAAC,cAAc;IACjC,2GAA2G;IAC3G,KAAK,EAAE,GAAG,CAAC,SAAS;IACpB,0DAA0D;IAC1D,YAAY,EAAE,GAAG,CAAC,SAAS;IAC3B,4DAA4D;IAC5D,aAAa,EAAE,GAAG,CAAC,SAAS;IAC5B,gEAAgE;IAChE,iBAAiB,EAAE,GAAG,CAAC,SAAS;IAChC,gEAAgE;IAChE,iBAAiB,EAAE,GAAG,CAAC,SAAS;CACjC,EACD,EAAC,QAAQ,EAAE,MAAM,EAAC,CACnB,CAAC;AAEF,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