A little bird made me notice that I started explaining more complicate features of SteemJs although I haven't shown how to vote yet.
It is a very easy process knowing which you can design for example a voting slider for minnows (This is how SteemPlus started ;) ). Anyways, let's get to it and as usual, check the documentation
steem.broadcast.vote(wif, voter, author, permlink, weight, function(err, result) {
console.log(err, result);
});
Simply use this as the following:
wif
is the private posting key, that you can find under the Permissions tab of your wallet. Click on show the private key and copy paste it here.voter
is the account corresponding to that wif key, the person voting.author
is the author of the blog (or comment) you wish to vote for.permlink
: be careful here, it's not the entire url but only the last part of it, after the last/
weight
, the weight goes to two decimals so multiply your percentage by 100 : 99.99%= 9999. This corresponds to the percentage at which you are actually voting.
Okay, that was a bit too easy so let's also see how to get specifically the votes for a post. Use it in the same manner than above, and it will return the list of votes, their authors, weights and r_shares.
steem.api.getActiveVotes(author, permlink, function(err, result) {
console.log(err, result);
});
You can also get the last upvotes from a specific account by using this function:
steem.api.getAccountVotes(voter, function(err, result) {
console.log(err, result);
});
voter
stands from the account you wish to look out. It will return the list of the last votes.
That was a quick episode. Stay tuned for next one ;)
Hope this helps!
Posted on Utopian.io - Rewarding Open Source Contributors
Thank you for the contribution. It has been approved.
You can contact us on Discord.
[utopian-moderator]
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Hey @stoodkev I am @utopian-io. I have just upvoted you!
Achievements
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit