SteemJ Dev Diary #9 (14.01.2018)
Appbase API calls and additional utility methods.
Latest SteemJ 0.4.x releases: 0.4.3 v0.4.2 v0.4.2pr1 v0.4.1 v0.4.0
SteemJ Dev Diary #9 (14.01.2018)
Hello Steemians!
I am still a little bit blocked by the limited possibility to test the changes made for HF 0.20. While I feel like we are already on a pretty good way to support the new API structure ('Appbase APIs'), we hit a point where I simply would like to test the methods. This would help a lot to improve the JavaDoc and the tests again.
So due to that I started to search for a reason, why the new Appbase API calls are not accepted by the Steem API endpoints like api.steemitstage.com and found the following Jussie Issue #78. It looks like due to this issue it is currently not possible to send Appbase API calls as Jussi can't process them.
Sure, this will not help to test new API calls that will be introduced with HF 0.20, but when this Jussie issue is fixed at least the old api methods should work again.
But hay, there is still a lot of other stuff to do. In example, two smaller issues that requested some additional functionallities to:
- Calculate the bandwidth for an account
- Calculate the SBD value for a Steem Asset and the other way around
So I committed a first draft for both feature requests, while the one for the account bandwidth is based on the great guide provided by @jfollas.
Beside that I finally changed all API calls to the new Appbase format as I am now 100% sure that it should work in general after the Jussi issue is fixed.
List of related issues:
- IS #196 - Add a method to calculate the remaining bandwidth
- IS #205 - Provide a utility method to calculate the STEEM <-> SBD values
- IS #206 - Fully drop the WS support and only support the appbase api
- IS #208 - Implement the CodenserAPI
The commits are only related to the issues above - It does not mean that the issues are completly solved
Full list of commits:
(A prove that the commits have been made by me can be found here)
A list of all commits made after the last release can be found here: https://github.com/marvin-we/steem-java-api-wrapper/compare/v0.4.3...master
General information
What is SteemJ?
SteemJ is a project that allows you to communicate with a Steem node using Java. So far, the project supports most of the API calls and is also able to broadcast most of the common operation types. Further information can be found on GitHub.
Quick Start Guide
Add SteemJ to your project
SteemJ binaries are pushed into the maven central repository and can be integrated with a bunch of build management tools like Maven. The Wiki provides a lot of examples for the most common build tools. If you do not use a build management tool you can download the binaries as described here.
To add this release to your project paste the following snippet into your 'pom.xml'
<dependency>
<groupId>eu.bittrade.libs</groupId>
<artifactId>steemj-core</artifactId>
<version>0.4.3</version>
</dependency>
Start posting
SteemJConfig myConfig = SteemJConfig.getInstance();
myConfig.setDefaultAccount(new AccountName("YOUR-ACCOUNT"));
List<ImmutablePair<PrivateKeyType, String>> privateKeys = new ArrayList<>();
privateKeys.add(new ImmutablePair<>(PrivateKeyType.POSTING, "YOUR-PRIVATE-POSTING-KEY"));
myConfig.getPrivateKeyStorage().addAccount(myConfig.getDefaultAccount(), privateKeys);
steemJ.createComment(new AccountName("steemj"), new Permlink("testofsteemj040"), "Example comment without no link but with a @user .", new String[] { "test" });
Further information
The sample module of the SteemJ project provides showcases for the most common acitivies and operations users want to perform.
Beside that you can find a lot of snippets and examples in the different Wiki sections.
Contribute
The project became quite big and there is still a lot to do. If you want to support the project simply clone the git repository and submit a pull request. I would really appreciate it =).
git clone https://github.com/marvin-we/steem-java-api-wrapper.git
Get in touch!
Most of my projects are pretty time consuming and I always try to provide some useful stuff to the community. What keeps me going for that is your feedback and your support. For that reason I would love to get some Feedback from you <3. Just contact me here on Steemit or ping me on GitHub.
Posted on Utopian.io - Rewarding Open Source Contributors
I'm having major problems trying to use SteemJ. I'm using Eclipse and really have no idea what I'm doing. :(
Hay @edicted - I am still on a business trip this week :'( Can you ping me on discord or steemit.chat next saturday?
Sounds good. I'm in no hurry. Plenty of code to write. Thanks for the response.
Looks like I got the Jar files to work... just have to figure out how to import and run Maven on Eclipse.
Aw - dang I didn't think that would be the error but now that you explain it it makes sense. At least you were able to change all the API calls to the new format!
Thanks so much!!
Hi @dez1337. I am continuing a course Named web design. Where I have seen a part named java script. A small part of J Quarry. HTML and CSS was easy for me. But It is hard for me to J Quarry. By the way...You post is excellent. I hope it is helpful. Thank you for sharing the informative post.
Is there a method that returns the text inside of a comment/post?
Are you referring to getting the body of a post/comment/discussion?
steemJ.getContent
List<Discussion> discussions = steemJ.getContentReplies(account, entry.getComment().getPermlink());
playersScan: for (Discussion discussion : discussions) {
String body = discussion.getBody();
Hey @dez1337 I am @utopian-io. I have just upvoted you!
Achievements
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x
Nic post
Test comment using Mixion by @edgar-trem and SteemJ 0.4.3 by @dez1337 .
Thank you for the contribution. It has been approved.
I like that you took encouragement and made a good post. I appreciate your efforts.
You can contact us on Discord.
[utopian-moderator]
nice