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

in steemjs •  8 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

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

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 ;-)

  ·  7 years ago Reveal Comment
  ·  8 years ago (edited)

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)