1

Reading through this: https://polkadot.js.org/docs/api/start/api.query.multi/ It states "It should be trivially extendable to subscribe to the validators, track which one have entered or left". How is this possible? I thought that something like this would work but it doesn't

api.query.staking.validators.multi((validators) => {console.log(validators)});

1
  • I’m voting to close this question because it's too old and lacks of detail.
    – AurevoirXavier
    Commented Jun 5 at 7:15

1 Answer 1

0

You can subscribe without multi as well. For example:

await api.query.system.events(events =>
    events.forEach(({event}) => console.log(event.toHuman())))

Perhaps this is what you are looking for:

await api.query.session.validators(validators => 
    console.table(validators.map(validator => validator.toHuman())))

Not the answer you're looking for? Browse other questions tagged or ask your own question.