@@ -53,6 +53,14 @@ export const ValidatorResponseType = new ContainerType({
5353 status : new StringType < ValidatorStatus > ( ) ,
5454 validator : ssz . phase0 . Validator ,
5555} ) ;
56+ export const ValidatorIdentityType = new ContainerType (
57+ {
58+ index : ssz . ValidatorIndex ,
59+ pubkey : ssz . BLSPubkey ,
60+ activationEpoch : ssz . UintNum64 ,
61+ } ,
62+ { jsonCase : "eth2" }
63+ ) ;
5664export const EpochCommitteeResponseType = new ContainerType ( {
5765 index : ssz . CommitteeIndex ,
5866 slot : ssz . Slot ,
@@ -73,6 +81,7 @@ export const EpochSyncCommitteeResponseType = new ContainerType(
7381 { jsonCase : "eth2" }
7482) ;
7583export const ValidatorResponseListType = ArrayOf ( ValidatorResponseType ) ;
84+ export const ValidatorIdentitiesType = ArrayOf ( ValidatorIdentityType ) ;
7685export const EpochCommitteeResponseListType = ArrayOf ( EpochCommitteeResponseType ) ;
7786export const ValidatorBalanceListType = ArrayOf ( ValidatorBalanceType ) ;
7887
@@ -84,6 +93,7 @@ export type ValidatorBalance = ValueOf<typeof ValidatorBalanceType>;
8493export type EpochSyncCommitteeResponse = ValueOf < typeof EpochSyncCommitteeResponseType > ;
8594
8695export type ValidatorResponseList = ValueOf < typeof ValidatorResponseListType > ;
96+ export type ValidatorIdentities = ValueOf < typeof ValidatorIdentitiesType > ;
8797export type EpochCommitteeResponseList = ValueOf < typeof EpochCommitteeResponseListType > ;
8898export type ValidatorBalanceList = ValueOf < typeof ValidatorBalanceListType > ;
8999
@@ -191,6 +201,26 @@ export type Endpoints = {
191201 ExecutionOptimisticAndFinalizedMeta
192202 > ;
193203
204+ /**
205+ * Get validator identities from state
206+ *
207+ * Returns filterable list of validators identities.
208+ *
209+ * Identities will be returned for all indices or public keys that match known validators. If an index or public key does not
210+ * match any known validator, no identity will be returned but this will not cause an error. There are no guarantees for the
211+ * returned data in terms of ordering.
212+ */
213+ postStateValidatorIdentities : Endpoint <
214+ "POST" ,
215+ StateArgs & {
216+ /** An array of values, with each value either a hex encoded public key (any bytes48 with 0x prefix) or a validator index */
217+ validatorIds ?: ValidatorId [ ] ;
218+ } ,
219+ { params : { state_id : string } ; body : string [ ] } ,
220+ ValidatorIdentities ,
221+ ExecutionOptimisticAndFinalizedMeta
222+ > ;
223+
194224 /**
195225 * Get validator balances from state
196226 * Returns filterable list of validator balances.
@@ -404,6 +434,28 @@ export function getDefinitions(_config: ChainForkConfig): RouteDefinitions<Endpo
404434 meta : ExecutionOptimisticAndFinalizedCodec ,
405435 } ,
406436 } ,
437+ postStateValidatorIdentities : {
438+ url : "/eth/v1/beacon/states/{state_id}/validator_identities" ,
439+ method : "POST" ,
440+ req : JsonOnlyReq ( {
441+ writeReqJson : ( { stateId, validatorIds} ) => ( {
442+ params : { state_id : stateId . toString ( ) } ,
443+ body : toValidatorIdsStr ( validatorIds ) || [ ] ,
444+ } ) ,
445+ parseReqJson : ( { params, body = [ ] } ) => ( {
446+ stateId : params . state_id ,
447+ validatorIds : fromValidatorIdsStr ( body ) ,
448+ } ) ,
449+ schema : {
450+ params : { state_id : Schema . StringRequired } ,
451+ body : Schema . UintOrStringArray ,
452+ } ,
453+ } ) ,
454+ resp : {
455+ data : ValidatorIdentitiesType ,
456+ meta : ExecutionOptimisticAndFinalizedCodec ,
457+ } ,
458+ } ,
407459 getStateValidatorBalances : {
408460 url : "/eth/v1/beacon/states/{state_id}/validator_balances" ,
409461 method : "GET" ,
0 commit comments