Commit 7271dde1 authored by Fabien's avatar Fabien Committed by GitHub

Merge pull request #152 from steemit/comment-example

Add operations example
parents bef8949e dcfe887c
......@@ -8,16 +8,98 @@
<script src="../dist/steem.min.js"></script>
<script>
steem.broadcast.vote(
'5JRaypasxMx1L97ZUX7YuC5Psb5EAbF821kkAGtBj7xCJFQcbLg', // Posting WIF
'guest123', // Voter username
'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);
}
);
/** Configure your account */
var username = 'guest123';
var postingWif = '5JRaypasxMx1L97ZUX7YuC5Psb5EAbF821kkAGtBj7xCJFQcbLg';
/** 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);
}
);
/** Broadcast a comment */
var permlink = new Date().toISOString().replace(/[^a-zA-Z0-9]+/g, '').toLowerCase();
steem.broadcast.comment(
postingWif,
'siol', // Parent Author
'test', // Parent Permlink
username, // Author
permlink, // Permlink
'', // Title
'This is a test!', // Body
{ tags: ['test'], app: 'steemjs/examples' }, // Json Metadata
function(err, result) {
console.log(err, result);
}
);
/** Broadcast a post */
var permlink = new Date().toISOString().replace(/[^a-zA-Z0-9]+/g, '').toLowerCase();
steem.broadcast.comment(
postingWif,
'', // Leave parent author empty
'photography', // Main tag
username, // Author
permlink + '-post', // Permlink
'This is just a test!', // Title
'Nothing to see here', // Body
{ tags: ['test'], app: 'steemjs/examples' }, // Json Metadata
function(err, result) {
console.log(err, result);
}
);
/** Follow an user */
var follower = username; // Your username
var following = 'steemjs'; // User to follow
var json = JSON.stringify(
['follow', {
follower: follower,
following: following,
what: ['blog']
}]
);
steem.broadcast.customJson(
postingWif,
[], // Required_auths
[follower], // Required Posting Auths
'follow', // Id
json, //
function(err, result) {
console.log(err, result);
}
);
/** Unfollow an user */
var json = JSON.stringify(
['follow', {
follower: follower,
following: following,
what: []
}]
);
steem.broadcast.customJson(
postingWif,
[], // Required_auths
[follower], // Required Posting Auths
'follow', // Id
json, //
function(err, result) {
console.log(err, result);
}
);
</script>
</body>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment