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 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())))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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