Skip to content

Commit

Permalink
Fix get exit validators (#407)
Browse files Browse the repository at this point in the history
  • Loading branch information
pablomendezroyo authored Nov 20, 2024
1 parent 699ab85 commit f35bff7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
18 changes: 11 additions & 7 deletions packages/brain/src/modules/apiServers/ui/calls/exitValidators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export async function getExitValidators({
signerApi: Web3SignerApi;
pubkeys: string[];
}): Promise<BeaconchainPoolVoluntaryExitsPostRequest[]> {
const validatorsExit = await _getExitValidators(beaconchainApi, signerApi, pubkeys);
const validatorsExit = await _getExitValidators({ beaconchainApi, signerApi, pubkeys });
logger.debug(validatorsExit);
return validatorsExit;
}
Expand All @@ -39,7 +39,7 @@ export async function exitValidators({
beaconchainApi: BeaconchainApi;
pubkeys: string[];
}): Promise<ValidatorExitExecute[]> {
const validatorsToExit = await _getExitValidators(beaconchainApi, signerApi, pubkeys);
const validatorsToExit = await _getExitValidators({ beaconchainApi, signerApi, pubkeys });
const exitValidatorsResponses: ValidatorExitExecute[] = [];
for (const validatorToExit of validatorsToExit) {
try {
Expand Down Expand Up @@ -78,11 +78,15 @@ export async function exitValidators({
* @param pubkeys The public keys of the validators to exit
* @returns The exit validators info signed
*/
async function _getExitValidators(
beaconchainApi: BeaconchainApi,
signerApi: Web3SignerApi,
pubkeys: string[]
): Promise<ValidatorExitGet[]> {
async function _getExitValidators({
beaconchainApi,
signerApi,
pubkeys
}: {
beaconchainApi: BeaconchainApi;
signerApi: Web3SignerApi;
pubkeys: string[];
}): Promise<ValidatorExitGet[]> {
// Get the current epoch from the beaconchain API to exit the validators
const currentEpoch = await beaconchainApi.getEpochHeader({ blockId: "head" });

Expand Down
6 changes: 4 additions & 2 deletions packages/brain/src/modules/apiServers/ui/calls/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ export const createRpcMethods = ({
await beaconchaFetchValidatorsInfo({ blockExplorerApi, pubkeys }),
deleteValidators: async (deleteRequest: Web3signerDeleteRequest) =>
await deleteValidators({ brainDb, reloadValidatorsCronTask, validatorApi, signerApi, deleteRequest }),
exitValidators: async (pubkeys: string[]) => await exitValidators({ pubkeys, beaconchainApi, signerApi }),
getExitValidators: async (pubkeys: string[]) => await getExitValidators({ beaconchainApi, signerApi, pubkeys }),
exitValidators: async ({ pubkeys }: { pubkeys: string[] }) =>
await exitValidators({ pubkeys, beaconchainApi, signerApi }),
getExitValidators: async ({ pubkeys }: { pubkeys: string[] }) =>
await getExitValidators({ beaconchainApi, signerApi, pubkeys }),
importValidators: async (postRequest: CustomImportRequest) =>
await importValidators({
postRequest,
Expand Down
4 changes: 2 additions & 2 deletions packages/brain/src/modules/apiServers/ui/calls/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export interface RpcMethods {
beaconchaFetchAllValidatorsInfo: (pubkeys: string[]) => Promise<BeaconchaGetResponse[]>;
beaconchaFetchValidatorsInfo: (pubkeys: string[]) => Promise<BeaconchaGetResponse>;
deleteValidators: (deleteRequest: Web3signerDeleteRequest) => Promise<Web3signerDeleteResponse>;
exitValidators: (pubkeys: string[]) => Promise<ValidatorExitExecute[]>;
getExitValidators: (pubkeys: string[]) => Promise<BeaconchainPoolVoluntaryExitsPostRequest[]>;
exitValidators: ({ pubkeys }: { pubkeys: string[] }) => Promise<ValidatorExitExecute[]>;
getExitValidators: ({ pubkeys }: { pubkeys: string[] }) => Promise<BeaconchainPoolVoluntaryExitsPostRequest[]>;
importValidators: (postRequest: CustomImportRequest) => Promise<Web3signerPostResponse>;
updateValidators: (
customValidatorUpdateRequest: CustomValidatorUpdateRequest[],
Expand Down

0 comments on commit f35bff7

Please sign in to comment.