Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Full Validator list endpoint #1005

Closed
TarikGul opened this issue Aug 2, 2022 · 1 comment
Closed

[Feature] Full Validator list endpoint #1005

TarikGul opened this issue Aug 2, 2022 · 1 comment
Assignees
Labels
I8 - Enhancement Additional feature request Q1 - Easy Issue is easy, good newcomer issue

Comments

@TarikGul
Copy link
Member

TarikGul commented Aug 2, 2022

/pallets/staking/validators

Description

Should return a list of all the validators. This requires retrieving all the entries and mapping out the AccountId keys from storage.

const validators = await api.query.staking.validators.entries();
const keys = validators.forEach(([key]) => {
  console.log('key arguments:', key.args.map((k) => k.toHuman()));
});

Example JSON response from the endpoint:

{
    validators: [
        `162DmeD1MHpWQhv8NPz7zbUEfCyTfG4Tuqz7P7852KiY2wXz`,
        `13pYWKctR5s8vQuyZt3pxQXue4SRH9coyAS9S9z5HtogAnhs `,
        ...
    ]
}
@TarikGul TarikGul added I8 - Enhancement Additional feature request Q1 - Easy Issue is easy, good newcomer issue labels Aug 2, 2022
@Imod7
Copy link
Contributor

Imod7 commented Aug 23, 2022

Another related endpoint to the one mentioned in this issue and maybe interesting to have is one that shows
"The list of nominators per validator"

For example under an endpoint like :
/pallets/staking/validators/validatorAddress

This idea comes from seeing related questions in the Substrate Stack Exchange like the ones mentioned below :

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I8 - Enhancement Additional feature request Q1 - Easy Issue is easy, good newcomer issue
Projects
None yet
Development

No branches or pull requests

2 participants