steem-js icon indicating copy to clipboard operation
steem-js copied to clipboard

how to make a post

Open kiahmed opened this issue 7 years ago • 7 comments

Hello Great Api! I was wondering how to make post from it like calling steem.broadcast.comment for which I need posting key which I can get from keys I guess after login?

Expected behavior

none

Actual behavior

none

no error. just finding out api usages

How to reproduce

Environment information

kiahmed avatar Jan 25 '18 03:01 kiahmed

Same problem here. Some more detailed examples would be nice.

lmiller1990 avatar Jan 25 '18 15:01 lmiller1990

If you read the documentation, you will see:

steem.broadcast.comment(wif, parentAuthor, parentPermlink, author, permlink, title, body, jsonMetadata, function(err, result) {
  console.log(err, result);
});

https://github.com/steemit/steem-js/blob/master/doc/README.md#comment If you want a post, than parentAuthor is an empty string and parentPermlink is your first tag. You might want to check out any post's jsonMetadata on steemd to see how to do that part. The doc also explains the login at the top of the page.

neander-squirrel avatar Jan 26 '18 17:01 neander-squirrel

problem was didnt know how to get wif , figured out return steem.auth.toWif(uname, pwd, 'posting');

but still steem.broadcast.comment call succeeds but the post dont show up on steemit site ...happened so many times ..any idea?

kiahmed avatar Jan 27 '18 01:01 kiahmed

You can just simply store your private posting key as string and use that. What you're doing now is storing your master key and make a call to get your posting key. I don't see why it is necessary unless you want to do transfers or other action requiring your master key somewhere else i the code.


Do you have any logging? You should receive a response (result or error) after broadcast.

neander-squirrel avatar Jan 27 '18 01:01 neander-squirrel

Working for me.

var permlink = new Date().toISOString().replace(/[^a-zA-Z0-9]+/g, '').toLowerCase(); steem.broadcast.comment( 'private posting key', '', // Leave parent author empty 'test', // Main tag 'xenetics', // 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); } );

I wrote an article about it here.

Thanks @neander-squirrel .

lmiller1990 avatar Jan 29 '18 15:01 lmiller1990

how to do self upvote option steem.broadcast.comment ?

aminraisy avatar Mar 10 '18 15:03 aminraisy

can i write permalink anything instead of 'test' ???? @lmiller1990 @neander-squirrel everytime i do permlink any thing instead of test , steem throws RPC error

potadibyo avatar Mar 14 '18 07:03 potadibyo