@lodestar/api 1.17.0-dev.1f18ec475b → 1.17.0-dev.36f50cf083
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.
|
@@ -14,7 +14,7 @@ export * as rewards from "./rewards.js";
|
|
|
14
14
|
export { BroadcastValidation } from "./block.js";
|
|
15
15
|
export type { BlockId, BlockHeaderResponse } from "./block.js";
|
|
16
16
|
export type { AttestationFilters } from "./pool.js";
|
|
17
|
-
export type { BlockRewards } from "./rewards.js";
|
|
17
|
+
export type { BlockRewards, SyncCommitteeRewards } from "./rewards.js";
|
|
18
18
|
export type { StateId, ValidatorId, ValidatorStatus, ValidatorFilters, CommitteesFilters, FinalityCheckpoints, ValidatorResponse, ValidatorBalance, EpochCommitteeResponse, EpochSyncCommitteeResponse, } from "./state.js";
|
|
19
19
|
export type Api = block.Api & pool.Api & state.Api & rewards.Api & {
|
|
20
20
|
getGenesis(): Promise<ApiClientResponse<{
|
|
@@ -38,6 +38,17 @@ export declare function getReqSerializers(config: ChainForkConfig): {
|
|
|
38
38
|
block_id: string;
|
|
39
39
|
};
|
|
40
40
|
}>;
|
|
41
|
+
getSyncCommitteeRewards: import("../../../utils/types.js").ReqSerializer<(blockId: block.BlockId, validatorIds?: state.ValidatorId[] | undefined) => Promise<ApiClientResponse<{
|
|
42
|
+
200: {
|
|
43
|
+
data: rewards.SyncCommitteeRewards;
|
|
44
|
+
executionOptimistic: boolean;
|
|
45
|
+
};
|
|
46
|
+
}, HttpStatusCode.BAD_REQUEST | HttpStatusCode.NOT_FOUND>>, {
|
|
47
|
+
params: {
|
|
48
|
+
block_id: string;
|
|
49
|
+
};
|
|
50
|
+
body: state.ValidatorId[];
|
|
51
|
+
}>;
|
|
41
52
|
getStateRoot: import("../../../utils/types.js").ReqSerializer<(stateId: state.StateId) => Promise<ApiClientResponse<{
|
|
42
53
|
200: {
|
|
43
54
|
data: {
|
|
@@ -3,6 +3,7 @@ import { RoutesData, ReturnTypes, ReqSerializers } from "../../../utils/index.js
|
|
|
3
3
|
import { HttpStatusCode } from "../../../utils/client/httpStatusCode.js";
|
|
4
4
|
import { ApiClientResponse } from "../../../interfaces.js";
|
|
5
5
|
import { BlockId } from "./block.js";
|
|
6
|
+
import { ValidatorId } from "./state.js";
|
|
6
7
|
/**
|
|
7
8
|
* True if the response references an unverified execution payload. Optimistic information may be invalidated at
|
|
8
9
|
* a later time. If the field is not present, assume the False value.
|
|
@@ -25,6 +26,16 @@ export type BlockRewards = {
|
|
|
25
26
|
/** Block reward component due to included attester_slashings */
|
|
26
27
|
attesterSlashings: number;
|
|
27
28
|
};
|
|
29
|
+
/**
|
|
30
|
+
* Rewards info for sync committee participation. Every reward value is in Gwei.
|
|
31
|
+
* Note: In the case that block proposer is present in `SyncCommitteeRewards`, the reward value only reflects rewards for
|
|
32
|
+
* participating in sync committee. Please refer to `BlockRewards.syncAggregate` for rewards of proposer including sync committee
|
|
33
|
+
* outputs into their block
|
|
34
|
+
*/
|
|
35
|
+
export type SyncCommitteeRewards = {
|
|
36
|
+
validatorIndex: ValidatorIndex;
|
|
37
|
+
reward: number;
|
|
38
|
+
}[];
|
|
28
39
|
export type Api = {
|
|
29
40
|
/**
|
|
30
41
|
* Get block rewards
|
|
@@ -39,6 +50,20 @@ export type Api = {
|
|
|
39
50
|
executionOptimistic: ExecutionOptimistic;
|
|
40
51
|
};
|
|
41
52
|
}, HttpStatusCode.BAD_REQUEST | HttpStatusCode.NOT_FOUND>>;
|
|
53
|
+
/**
|
|
54
|
+
* Get sync committee rewards
|
|
55
|
+
* Returns participant reward value for each sync committee member at the given block.
|
|
56
|
+
*
|
|
57
|
+
* @param blockId Block identifier.
|
|
58
|
+
* Can be one of: "head" (canonical head in node's view), "genesis", "finalized", \<slot\>, \<hex encoded blockRoot with 0x prefix\>.
|
|
59
|
+
* @param validatorIds List of validator indices or pubkeys to filter in
|
|
60
|
+
*/
|
|
61
|
+
getSyncCommitteeRewards(blockId: BlockId, validatorIds?: ValidatorId[]): Promise<ApiClientResponse<{
|
|
62
|
+
[HttpStatusCode.OK]: {
|
|
63
|
+
data: SyncCommitteeRewards;
|
|
64
|
+
executionOptimistic: ExecutionOptimistic;
|
|
65
|
+
};
|
|
66
|
+
}, HttpStatusCode.BAD_REQUEST | HttpStatusCode.NOT_FOUND>>;
|
|
42
67
|
};
|
|
43
68
|
/**
|
|
44
69
|
* Define javascript values for each route
|
|
@@ -50,6 +75,12 @@ export type ReqTypes = {
|
|
|
50
75
|
block_id: string;
|
|
51
76
|
};
|
|
52
77
|
};
|
|
78
|
+
getSyncCommitteeRewards: {
|
|
79
|
+
params: {
|
|
80
|
+
block_id: string;
|
|
81
|
+
};
|
|
82
|
+
body: ValidatorId[];
|
|
83
|
+
};
|
|
53
84
|
};
|
|
54
85
|
export declare function getReqSerializers(): ReqSerializers<Api, ReqTypes>;
|
|
55
86
|
export declare function getReturnTypes(): ReturnTypes<Api>;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { ContainerType } from "@chainsafe/ssz";
|
|
2
2
|
import { ssz } from "@lodestar/types";
|
|
3
|
-
import { Schema, ContainerDataExecutionOptimistic, } from "../../../utils/index.js";
|
|
3
|
+
import { Schema, ContainerDataExecutionOptimistic, ArrayOf, } from "../../../utils/index.js";
|
|
4
4
|
import { HttpStatusCode } from "../../../utils/client/httpStatusCode.js";
|
|
5
5
|
/**
|
|
6
6
|
* Define javascript values for each route
|
|
7
7
|
*/
|
|
8
8
|
export const routesData = {
|
|
9
9
|
getBlockRewards: { url: "/eth/v1/beacon/rewards/blocks/{block_id}", method: "GET" },
|
|
10
|
+
getSyncCommitteeRewards: { url: "/eth/v1/beacon/rewards/sync_committee/{block_id}", method: "POST" },
|
|
10
11
|
};
|
|
11
12
|
export function getReqSerializers() {
|
|
12
13
|
return {
|
|
@@ -15,6 +16,14 @@ export function getReqSerializers() {
|
|
|
15
16
|
parseReq: ({ params }) => [params.block_id],
|
|
16
17
|
schema: { params: { block_id: Schema.StringRequired } },
|
|
17
18
|
},
|
|
19
|
+
getSyncCommitteeRewards: {
|
|
20
|
+
writeReq: (block_id, validatorIds) => ({ params: { block_id: String(block_id) }, body: validatorIds || [] }),
|
|
21
|
+
parseReq: ({ params, body }) => [params.block_id, body],
|
|
22
|
+
schema: {
|
|
23
|
+
params: { block_id: Schema.StringRequired },
|
|
24
|
+
body: Schema.UintOrStringArray,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
18
27
|
};
|
|
19
28
|
}
|
|
20
29
|
export function getReturnTypes() {
|
|
@@ -26,8 +35,13 @@ export function getReturnTypes() {
|
|
|
26
35
|
proposerSlashings: ssz.UintNum64,
|
|
27
36
|
attesterSlashings: ssz.UintNum64,
|
|
28
37
|
}, { jsonCase: "eth2" });
|
|
38
|
+
const SyncCommitteeRewardsResponse = new ContainerType({
|
|
39
|
+
validatorIndex: ssz.ValidatorIndex,
|
|
40
|
+
reward: ssz.UintNum64,
|
|
41
|
+
}, { jsonCase: "eth2" });
|
|
29
42
|
return {
|
|
30
43
|
getBlockRewards: ContainerDataExecutionOptimistic(BlockRewardsResponse),
|
|
44
|
+
getSyncCommitteeRewards: ContainerDataExecutionOptimistic(ArrayOf(SyncCommitteeRewardsResponse)),
|
|
31
45
|
};
|
|
32
46
|
}
|
|
33
47
|
//# 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,EAAC,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAC,GAAG,EAAiB,MAAM,iBAAiB,CAAC;AAEpD,OAAO,EAGL,MAAM,EAEN,gCAAgC,
|
|
1
|
+
{"version":3,"file":"rewards.js","sourceRoot":"","sources":["../../../../src/beacon/routes/beacon/rewards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAC7C,OAAO,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C;AAED,MAAM,UAAU,cAAc;IAC5B,MAAM,oBAAoB,GAAG,IAAI,aAAa,CAC5C;QACE,aAAa,EAAE,GAAG,CAAC,cAAc;QACjC,KAAK,EAAE,GAAG,CAAC,SAAS;QACpB,YAAY,EAAE,GAAG,CAAC,SAAS;QAC3B,aAAa,EAAE,GAAG,CAAC,SAAS;QAC5B,iBAAiB,EAAE,GAAG,CAAC,SAAS;QAChC,iBAAiB,EAAE,GAAG,CAAC,SAAS;KACjC,EACD,EAAC,QAAQ,EAAE,MAAM,EAAC,CACnB,CAAC;IAEF,MAAM,4BAA4B,GAAG,IAAI,aAAa,CACpD;QACE,cAAc,EAAE,GAAG,CAAC,cAAc;QAClC,MAAM,EAAE,GAAG,CAAC,SAAS;KACtB,EACD,EAAC,QAAQ,EAAE,MAAM,EAAC,CACnB,CAAC;IAEF,OAAO;QACL,eAAe,EAAE,gCAAgC,CAAC,oBAAoB,CAAC;QACvE,uBAAuB,EAAE,gCAAgC,CAAC,OAAO,CAAC,4BAA4B,CAAC,CAAC;KACjG,CAAC;AACJ,CAAC"}
|
|
@@ -37,7 +37,7 @@ export type ValidatorBalance = {
|
|
|
37
37
|
export type EpochCommitteeResponse = {
|
|
38
38
|
index: CommitteeIndex;
|
|
39
39
|
slot: Slot;
|
|
40
|
-
validators: ValidatorIndex
|
|
40
|
+
validators: ArrayLike<ValidatorIndex>;
|
|
41
41
|
};
|
|
42
42
|
export type EpochSyncCommitteeResponse = {
|
|
43
43
|
/** all of the validator indices in the current sync committee */
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"bugs": {
|
|
12
12
|
"url": "https://github.com/ChainSafe/lodestar/issues"
|
|
13
13
|
},
|
|
14
|
-
"version": "1.17.0-dev.
|
|
14
|
+
"version": "1.17.0-dev.36f50cf083",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
@@ -68,11 +68,11 @@
|
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"@chainsafe/persistent-merkle-tree": "^0.6.1",
|
|
71
|
-
"@chainsafe/ssz": "^0.14.
|
|
72
|
-
"@lodestar/config": "1.17.0-dev.
|
|
73
|
-
"@lodestar/params": "1.17.0-dev.
|
|
74
|
-
"@lodestar/types": "1.17.0-dev.
|
|
75
|
-
"@lodestar/utils": "1.17.0-dev.
|
|
71
|
+
"@chainsafe/ssz": "^0.14.3",
|
|
72
|
+
"@lodestar/config": "1.17.0-dev.36f50cf083",
|
|
73
|
+
"@lodestar/params": "1.17.0-dev.36f50cf083",
|
|
74
|
+
"@lodestar/types": "1.17.0-dev.36f50cf083",
|
|
75
|
+
"@lodestar/utils": "1.17.0-dev.36f50cf083",
|
|
76
76
|
"eventsource": "^2.0.2",
|
|
77
77
|
"qs": "^6.11.1"
|
|
78
78
|
},
|
|
@@ -89,5 +89,5 @@
|
|
|
89
89
|
"api",
|
|
90
90
|
"blockchain"
|
|
91
91
|
],
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "a887b465775c2fa9fe74bfbb82512b1c5c87fde0"
|
|
93
93
|
}
|