Voting Power & Reputation Bug Fix and Estimated Account Value Feature added

in utopian-io •  7 years ago  (edited)

Screenshot from 2018-02-08 15-52-07.png

Bug Fixes

  • What was the issue(s)?

The Voting Power and Reputation was showing wrong because it was being pulled from a third party API listed below-

    let api = 'https://helloacm.com/api/steemit/account/vp/?id=' + id;
  • What was the solution?

I shifted the API call to steemJS it was my first work related to any steem library.
The following code fixed the bug-

steem.api.getAccounts([id], function(err, response) {
        if(!err)
        {
            let result = (response[0].voting_power)/100;
            dom.html("<i>@" + id + "'s Voting Power is</i> <B>" + result + "%</B>");

The reputation bug was fixed using Reputation formatter in steemJS for which I needed to read code of steemJS which was quite interesting part.

New Features

  • What feature(s) did you add?

I added estimated account value(in USD) using steemjs.

  • How did you implement it/them?
    The steemJS function was added using following code-
steem.api.getAccounts([id], function(err, response) {
        if(!err)
        {
            var result = steem.formatter.reputation(response[0].reputation);
            var steemPower = steem.formatter.estimateAccountValue(response[0]);
            steemPower.then(value => dom.html("<i>@" + id + "'s Reputation is</i> <B>" + result + "</B><br><i>@" + id + "'s Total Account Value is</i> <B>$" + value + "</B>"));
           logit("API Finished: Reputation - " + id);
        }
    });
}
  • How to contribute?

Link to the Github repository, Click here.



Posted on Utopian.io - Rewarding Open Source Contributors

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  
  ·  7 years ago 

Thank you for the contribution. It has been approved.

Thanks for the nice fixes and new feature! I'll include your changes in version 0.0.9 ^_^

You can contact us on Discord.
[utopian-moderator]

Hey @justyy, I just gave you a tip for your hard work on moderation. Upvote this comment to support the utopian moderators and increase your future rewards!

Hey @ms10398 I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

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

Your voting power is very interesting I like it very much

please help me in making like you