Steem.js: Comment, upvote, downvote, transfert. You wanted it, you got it.

in #steemjs8 years ago (edited)


Credit @klye

Hey developers, here is the news: Now you can upvote, downvote, comment and tranfert using Steem.js!

Here the package:

https://github.com/adcpm/steem
https://www.npmjs.com/package/steem

Here the examples:

UpVote

/* @params username, password, author, permlink, weight */
steem.broadcast.upvote('fabien', 'sgs56sd84hbr51qpodg1', 'steemjs', 'permlink-of-the-post', 10000, function(err, result) {
    console.log(err, result);
});

DownVote

/* @params username, password, author, permlink, weight */
steem.broadcast.downvote('fabien', 'sgs56sd84hbr51qpodg1', 'steemjs', 'permlink-of-the-post', 10000, function(err, result) {
    console.log(err, result);
});

Post

/* @params username, password, parentAuthor, parentPermlink, author, permlink, title, body, jsonMetadata */
steem.broadcast.comment('fabien', 'sgs56sd84hbr51qpodg1', 
 '', 
 'steemjs',
 'fabien', 
 'this-is-the-slug-of-my-article', 
 'This is the title', 
 'This is the body', 
 {tags: ['steemjs', 'steem']}, 
 function(err, result) {
    console.log(err, result);
});

Transfer

/* @params username, password, from, to, amount, memo */
steem.broadcast.transfer('fabien', 'sgs56sd84hbr51qpodg1', 'you', 'steemjs', '50.000 SBD', 'Donation', function(err, result) {
    console.log(err, result);
});

Thank's to @heimindanger who helped for the methods and browser side support. You also want to contribute and get rewarded for that? Contact me on the rocket chat @fabien or channel #steemjs.

More will come, stay tuned.

PS : This is not my real password on examples ;)

Fabien

Sort:  

How to check the balance

For anyone else finding this now, like me, it's changed:

  /** Broadcast a vote */
  steem.broadcast.vote(
    postingWif,
    username, // Voter
    'firepower', // Author
    'steemit-veni-vidi-vici-steemfest-2016-together-we-made-it-happen-thank-you-steemians', // Permlink
    10000, // Weight (10000 = 100%)
    function(err, result) {
      console.log(err, result);
    }
  );

Thank you very helpful!

Hi Yoghurt,

Could you please advise me how to downvote by using steem.broadcast.vote()? I did set weight to 0, but it seems a bad practice

Thank you so much for any help

Awesome work @fabien thank you for your efforts :)

nice post.. this is what im looking. thanks

Thks for making developpers work easy.

This post has been linked to from another place on Steem.

About linkback_bot

Now you're talking my language!

Really cool thing !!! It must be upvoted

Coin Marketplace

STEEM 0.29
TRX 0.12
JST 0.032
BTC 63376.37
ETH 3089.73
USDT 1.00
SBD 3.82