0.0.7 • Published 5 years ago

tronvotes v0.0.7

Weekly downloads
9
License
ISC
Repository
-
Last release
5 years ago

tronvotes

Returns information for all the voters of a given candidate/SR on the Tron blockchain, in different formats: as CSV, as array {address, #votes}, etc..

Installation

npm install tronvotes

Usage

Since all the network calls are asynchronous, tronvotes uses Promises:

var tv = require("tronvotes");
var voters = tv.getVoters('TDGy2M9qWBepSHDEutWWxWd1JZfmAed3BP'); 

voters.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

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago

0.0.0

5 years ago