steem-js
steem-js copied to clipboard
Get all voters from a defined Witness
I'm looking for an API call in order to get all the people that vote for a given Witness in Node JS.
I've looked over : getAccountVotes() method, but it returns the Witness voted by the given account.
I'm also trying getWitnesses() using IDs like this (also tried with "19404" like a String ) :
steem.api.getWitnesses([19404], function(err, result) { console.log(err, result); });
But it's returning :
null [ null ]
Is someone has an idea on how I can do that using API calls or any other way to do it ?
You can use
steem.api.getWitnessByAccount(accountName, function(err, result) { console.log(err, result); });
This will return an object that can be filtered the data you need.
No it doesn't? Other than the 'votes' field, there is nothing that will show voter accounts.
You can use:
steem.api.call('database_api.list_witness_votes',{start:["curie",""], limit:100, order:"by_witness_account"},function(err, result){console.log(err, result);})
In this command, we check who voted for curie, starting from "", with a limit of 100 votes.
The maximum limit is 1000. Then if you need more you have to query again starting from the last vote you got. For instance start:["curie","jga"] starts from the jga's vote.