|
|
Line 1: |
Line 1: |
− | 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.
| + | #REDIRECT [[Steem.js]] |
− | | |
− | [https://github.com/steemit/steem-js/tree/master/doc GitHub source] | |
− | | |
− | == Browser ==
| |
− | | |
− | <pre class="html"><script src="./steem.min.js"></script>
| |
− | <script>
| |
− | steem.api.getAccounts(['ned', 'dan'], function(err, response){
| |
− | console.log(err, response);
| |
− | });
| |
− | </script></pre>
| |
− | == CDN ==
| |
− | | |
− | https://cdn.steemjs.com/lib/latest/steem.min.js<br/>
| |
− | | |
− | <pre class="html"><script src="//cdn.steemjs.com/lib/latest/steem.min.js"></script></pre>
| |
− | == Webpack ==
| |
− | | |
− | [https://github.com/steemit/steem-js/blob/master/examples/webpack-example Please have a look at the webpack usage example.]
| |
− | | |
− | == Server ==
| |
− | | |
− | == Install ==
| |
− | | |
− | <pre>$ npm install steem --save</pre>
| |
− | == WebSockets ==
| |
− | | |
− | wss://steemd.steemit.com By Default<br/> wss://node.steem.ws<br/> wss://this.piston.rocks<br/>
| |
− | | |
− | == Examples ==
| |
− | | |
− | === Broadcast Vote ===
| |
− | | |
− | <pre class="js">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);
| |
− | });</pre>
| |
− | === Get Accounts ===
| |
− | | |
− | <pre class="js">steem.api.getAccounts(['ned', 'dan'], function(err, result) {
| |
− | console.log(err, result);
| |
− | });</pre>
| |
− | === Get State ===
| |
− | | |
− | <pre class="js">steem.api.getState('/trends/funny', function(err, result) {
| |
− | console.log(err, result);
| |
− | });</pre>
| |
− | === Reputation Formatter ===
| |
− | | |
− | <pre class="js">var reputation = steem.formatter.reputation(user.reputation);
| |
− | console.log(reputation);</pre>
| |