Difference between revisions of "Steem.js"

From Steem Center
Jump to: navigation, search
m
Line 53: Line 53:
 
<pre class="js">var reputation = steem.formatter.reputation(user.reputation);
 
<pre class="js">var reputation = steem.formatter.reputation(user.reputation);
 
console.log(reputation);</pre>
 
console.log(reputation);</pre>
 +
 +
 +
===In other languages===
 +
* [[Hrvatski]] (croatian) : [[Steem.js (hr)]]
 +
* [[Bangla]] (bangla) : [[Steem.js (bd)]]
 +
 +
<br>
 +
 +
----
 +
<br>
 +
{| class="wikitable" style="margin: auto;"
 +
| Help keep this wiki page updated. Register, click in [https://www.steem.center/index.php?CLI_Wallet=Flag&action=edit edit], add or modify the text and save. <br>If you're already a steemian you can be rewarded with steem, see how in [https://steemit.com/introduceyourself/@steemcenterwiki/introduction-rewarding-steem-center-wiki-editors-with-steem-too @steemcenterwiki].
 +
|-
 +
|}
 +
<br>
  
 
<br>[[Category:Technology]]
 
<br>[[Category:Technology]]

Revision as of 05:49, 25 March 2018

Steem.js is a javascript library that allows developers to communicate and transact on the STEEM blockchain easily. A lot of applications use SteemJS, and the steemit.chat channel #steemjs is pretty active if you are looking for help.

GitHub source

Browser

<script src="./steem.min.js"></script>
<script>
steem.api.getAccounts(['ned', 'dan'], function(err, response){
    console.log(err, response);
});
</script>

CDN

https://cdn.steemjs.com/lib/latest/steem.min.js

<script src="//cdn.steemjs.com/lib/latest/steem.min.js"></script>

Webpack

Please have a look at the webpack usage example.

Server

Install

$ npm install steem --save

WebSockets

wss://steemd.steemit.com By Default
wss://node.steem.ws
wss://this.piston.rocks

Examples

Broadcast Vote

var steem = require('steem');

var wif = steem.auth.toWif(username, password, 'posting');
steem.broadcast.vote(wif, voter, author, permlink, weight, function(err, result) {
    console.log(err, result);
});

Get Accounts

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

Get State

steem.api.getState('/trends/funny', function(err, result) {
    console.log(err, result);
});

Reputation Formatter

var reputation = steem.formatter.reputation(user.reputation);
console.log(reputation);


In other languages




Help keep this wiki page updated. Register, click in edit, add or modify the text and save.
If you're already a steemian you can be rewarded with steem, see how in @steemcenterwiki.