Difference between revisions of "Steem.js"
From Steem Center
Heimindanger (talk | contribs) (Redirected page to Steemjs) |
m (new link to new page - Steem.js (es) - Spanish june 21 2018) |
||
(4 intermediate revisions by 3 users not shown) | |||
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. |
+ | |||
+ | [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> | ||
+ | |||
+ | |||
+ | ===In other languages=== | ||
+ | * [[Hrvatski]] (croatian) : [[Steem.js (hr)]] | ||
+ | * [[Bangla]] (bangla) : [[Steem.js (bd)]] | ||
+ | * [[Español]] (spanish) : [[Steem.js (es)]] | ||
+ | |||
+ | <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]] |
Latest revision as of 19:13, 21 June 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.
Contents
[hide]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
- Hrvatski (croatian) : Steem.js (hr)
- Bangla (bangla) : Steem.js (bd)
- Español (spanish) : Steem.js (es)
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. |