cn_get_voters
v0.2.9
Published
Returns array of {address, #votes} for all the voters of a given candidate/SR on the Tron blockchain
Downloads
3
Maintainers
Readme
cn_get_voters
Get the list of { address, number_votes } for a given SR (Super Representant) or candidate on the Tron Blockchain
Installation
npm install cn_get_voters
Usage
Add this
npm install --save cn_list_voters
cn_get_voters uses Promises:
var cn_list = require("cn_list_voters");
var voters_list = cn_list.getVoters('TDGy2M9qWBepSHDEutWWxWd1JZfmAed3BP');
voters_list.then( function(data){
console.log("Candidate: " + data.candidate);
console.log("Total votes: " + data.total_votes );
console.log("Number of voters: " + data.num_voters );
console.log(data.list);
} );
Available properties for data
param
- candidate: The SR/candidate address
- total_votes: Total number of votes at the moment of the execution of the script
- num_voters: Number of address voting that SR/candidate, at the moment of the execution of the script
- list: Array containing javascript objects {address, number_votes} Example:
[{ address: 'TUBN16b7beL6b7bXUHeL7bd2DPDf6eqhEW', votes: 250 },
{ address: 'TRs6NpvZs6CD2ZsrU76CZsiebaEcKdz2kF', votes: 5010 },
{ address: 'TNZf7Q5SmhRQJSmC4GhRSmYZJmmBUd7wpY', votes: 497461 },
{ address: 'TMTUBy8J6cvNkJ6PVacvJ6G2MUPTPRB93u', votes: 24625 },
{ address: 'TMQWERNiQS5FhiQZZ1S5iQ4Cgf5zf6NhLi', votes: 208 },
{ address: 'TSYu6GHS8TyHXS8MXVTyS8uDQhsGXpsCYC', votes: 2774 }]
- csv: Returns exactly the same information as list but in comma separated value (csv) format, so you can easily import into MySQL, etc..
TUBN16b7beL6b7bXUHeL7bd2DPDf6eqhEW,250
TRs6NpvZs6CD2ZsrU76CZsiebaEcKdz2kF,5010
TNZf7Q5SmhRQJSmC4GhRSmYZJmmBUd7wpY,497461
TMTUBy8J6cvNkJ6PVacvJ6G2MUPTPRB93u,24625
TMQWERNiQS5FhiQZZ1S5iQ4Cgf5zf6NhLi,208
TSYu6GHS8TyHXS8MXVTyS8uDQhsGXpsCYC,2774
Credits
Community Node
CommunityNode is a Tron SuperRepresentant candidate
https://tronscan.org/#/address/TDGy2M9qWBepSHDEutWWxWd1JZfmAed3BP/voters
Telegram: https://t.me/CommunityNode