Skip to content
On this page

Getting Validator Info Ethereum

The getValidator namespace contains method used for getting validator info. The unique method to the getValidator namespace is:

  • closeValidatorsStat(): Returns the number of validators expected to stop.
  • getPendingValidatorCount(): Returns number of validators prepared for deposit.
  • getPendingValidator(index): By using an index, retrieve the pending validator public key. Please note that the list of pending validators is dynamic, and the ordering may be unstable.
  • getValidatorCount(): Returns the total number of known validators. Validators can be in one of the following statuses: pending, deposited, or exited. Exited validators will be replaced by new pending validators to optimize memory usage.
  • getValidator(index): Returns validator pubkey and status.

Get Close Validators Stat

ts
// Import SDK
import { Ethereum } from '@everstake/wallet-sdk';

// Return number of expected to stop validators
const result = await Ethereum.closeValidatorsStat();
console.log(result); // 5

Get Pending Validator Count

ts
// Import SDK
import { Ethereum } from '@everstake/wallet-sdk';

// Returns num of validators prepared for deposit
const result = await Ethereum.getPendingValidatorCount();
console.log(result); // 5

Get Pending Validator

ts
// Import SDK
import { Ethereum } from '@everstake/wallet-sdk';

const index = 0;

// By index return pending validator pubkey. List of pending validators is dinamic so ordering unstable
const result = await Ethereum.getPendingValidator(index);
console.log(result); 
// 0x905d5e630840ea9112c2b8f562018e4ad799cf3e40ca03d20fec04e9393aee592655650d83abb01c11df5ce1849d36a7

Get Validator Count

ts
// Import SDK
import { Ethereum } from '@everstake/wallet-sdk';

// Return total num of known validators. 
// Validator can be in one of statuses: pending, deposited, exited. 
// Exited validators will be rewrited by new pending validators to optimize memory usage
const result = await Ethereum.getValidatorCount();
console.log(result); // 10

Get Validator

ts
// Import SDK
import { Ethereum } from '@everstake/wallet-sdk';

// Return validator pubkey and status
const result = await Ethereum.getValidatorCount();
console.log(result); // see the response below

relult = {
    pubkey: '0x905d5e630840ea9112c2b8f562018e4ad799cf3e40ca03d20fec04e9393aee592655650d83abb01c11df5ce1849d36a7',
    status: 'unknown' || 'pending' || 'deposited',
}