You are viewing a single comment's thread from:

RE: (Part 5)Tutorial On Steem/SteemConnect JS Retrieve And Comment The Last Post @steemconnect pt5

in #utopian-io6 years ago

Hi! I am sorry if it was not clear to you. I completely agree with you that the documentation is really poor and not very helpful! Seems like every developer develop their workarounds for the lack of information.
The complete function to post a comment is:

api.comment(parentAuthor, parentPermlink, author, permlink, title, body, jsonMetadata, function (err, res) {
  console.log(err, res)
});

I have inserted author twice because I knew I was going to comment my own post since I was the only one using the testing platform. Now that I look back I realize it was bad for the didactics.

The parameters that I left blank with "" are jsonMetadata and title.
jsonMetadata: Is extra data that won't be used by Steemit or blogging, but are useful for other applications, such as SteemMonsters. It is a piece of JSON code that is stored but not executed by default by the Steem nodes, only by the applications/nodes that are actually looking to execute that in that context.
title: comments on Steemit don't need a title, only posts do, so I skipped that

The full implementation of that piece of code from this class is:
https://github.com/igormuba/steemhere/blob/class5/js/myscript5.js

Sort:  

Hello and thanks for the reply, I've ran your code and it actually works. But I've copied and pasted the same piece of code in mine, and strangely, I'm still getting a sc2-sdk null error.

Frankly, I'm quite baffled by what's going on. Here's my arrow function, and the data I've inputted.

submitComment = () => { SteemConnect.comment("eaudebla", "crowthelegendvrreview-mdnmolwle9", "eaudebla", "re-crowthelegendvrreview-mdnmolwle9", "", "this is a test", "", function (err, res) { console.log(err, res); }); } I

The function seems right. Did you initialize and log into SteemConnect?
The code for that is here
https://github.com/igormuba/steemhere/blob/class5/js/myscript.js
I empalia that on the previous tutorials, but maybe my didactics were not good enough at that time.
Also, make sure you have the package with the dependencies set
https://github.com/igormuba/steemhere/blob/class5/package.json

Yes, I already logged on steemconnect. I also have the dependencies installed. I’m going to upload my code on GitHub so maybe someone can have a look. Sorry to disturb, but I’m literally losing sleep over this. If you know anyone else who has worked on steemconnect, let me know. The scarcity of people using it is a problem.

EDIT: Here's my code in question
https://github.com/ChilledMatter/AkibaSteem

My comment function is under https://github.com/ChilledMatter/AkibaSteem/blob/master/src/components/PostDetail.js

This is really strange. I have got similar problem as only api.me function works. When I am trying to vote or post a comment I get 401 response...

The guy over at steemconnect's github page managed to fix it!

Just authorize your app here.

https://app.steemconnect.com/authorize/@steemconnect