Steem.js Update: Vote method added (tutorial inside)

in #steemjs8 years ago

What's up?

Now you can easy vote with Steem.js NPM package. Here is the tutorial:

var steem = require('steem');

steem.broadcast.vote(username, password, author, permlink, weight, function(err, result) {
    console.log(err, result);
});

Quite difficult right? If you like it, upvote this article and I will use this money to incentive contributors to contribute on Open Source Steem projects.

It was not an easy task to make the encryption working thank to Kaptain Krayola @kaptainkrayola who help for generate a signature with steemit.com code.

Stay tuned I will soon do an update with post/comment, downvote, follow/mute methods.

Best

Sort:  

Excellent additional, thanks!

Awesome work - glad to be a part of this project!

Awesome work @fabien! I am thinking about creating a website that will automatically make my posts a steemit.com post and allow people to upvote/downvote/comment on my site with it appearing on steemit.com as well.

Hi Fabien,

I was trying 0.3.9, but when I tried this simple code:

var steem = require('steem');

steem.api.getAccounts(['asch'], function(err, result) {
console.log(err, result);
});

I got this Syntax error:

When I try that same code on https://tonicdev.com/npm/steem everything works fine!

When I install 0.3.7, the code also works fine locally. Then when I go back to 0.3.9, I get the same error again.

Anyone has this same issue? Or is it just me?

OK, problem solved. I was still using NodeJS v0.12.7. After installing NodeJS v4.5.0. This problem was gone. Sorry for the panic ;-)

Solid blog. I was about to post a similair post. I've bene asking myself. Do people actually check the Trustworthiness of the crypto they invest in or do they just blindly see money money money? :-) Besides coinmarketcap.com there is: https://www.coincheckup.com. I'm using this site that gives in depth reports on every tradable cryto in the market.

Question about username & password parameters, I assume these are the account_name and posting_key of the account you want to cast the vote?

Actually its the password not the WIF.

I must say that you made awesome addition. I am going to follow you as steem.js has more amazing possibilities than python solution. At least for me. I do not know the python but I learned npm recently. I guess further development of steem.js combined with other js packages will allow the growth of interesting apps in nearest future. Good luck, @fabien!

Great job! Was looking for this method in steem.js a few days ago. Nice to see it implemented now!

I have a few questions:
-What should I do with the weight parameter? Just set to 1?
-The perma link is the url of the post?
-Can we also use this method to upvote for comments? Or is that what you meant in the last sentense in your post and that is maybe coming up?
-Is there any documentation of the return data of the methods in the library? Probably JSON formatted... but how is the data organized?

Maybe all questions I can figure out myself by using the code.... but might save some people some time.

Again great job and looking forward to use this library! Probably in a few days , I hope ;-)!

@asch You can also set the weight parameter to either +100 or -100 for full percentage.

Thank you very informative happened

Perfect! I've been waiting for this feature! Great job!

Can we have javascript inside of a steemit post???
I just want to have like java games or some sort of flash play INSIDE the steemit post to allow for steemit blackjack or other card games to be played INSIDE a steemit post? between two steemit accounts?

Yeah while you are going to have fun little java games, I'm going to automatically make anyone who views my post upvote it.

Lookup Cross-site Scripting (XSS)

Coin Marketplace

STEEM 0.30
TRX 0.12
JST 0.033
BTC 63898.89
ETH 3129.16
USDT 1.00
SBD 3.90