At this time, is it possible for me to do so when the BPs have not been elected? I need this for a block explorer I'm building using eosjs.
1 Answer
Yes, it is possible with eosjs.
You can create an instance of Eos
with a given config
and then do getTableRows
with the given parameters. You might find the api footprint here. Also check the github repository for more info about the config parameters.
Here is an example how I do it at EOSIO BP alarm:
eos = new Eos(config)
eos.populateBlockProducers().then((result) => {
console.log(result)
}, this.handleError)
eos.getTableRows({
"json": true,
"scope": 'eosio',
"code": 'eosio',
"table": "producers",
"limit": 500
})
function populateBlockProducers() {
return eos.getTableRows({
"json": true,
"scope": 'eosio',
"code": 'eosio',
"table": "producers",
"limit": 500
})
}
function handleError(error) {}