The Daily Adventures of a SteemPeak Developer #4 - SCOT Rewards Included in the Feeds

in #dailyadventures5 years ago

As some of you already know we are going to include the SCOT Tribes (of which PALnet is the most known) in SteemPeak. With the next release PALnet and Splintertalk will be available and others can be enabled talking directly to the tribe owner and the Steem Engine team.

I'm not going to explain in this post what a Tribe is, check the blogs by @aggroed or @holger80 to read more about Scotbot and tribes.

The first important decision we took was to integrate the tribes directly into the website, so don't expect a new website for each tribe as you may have seen with palnet.io and splintertalk.io. This is what we think is the best approach to enjoy both the new tribes and the standard Steem features, but required some work to allow the rewards to be displayed in the standard pages.

Keep reading to find out how these rewards are loaded and to get a quick preview of what wil be available in the next release.

SCOT Rewards included in the standard Feeds

the_daily_adventure_cover_scot_rewards_feed.png

Read other posts in the series HERE

If you have used the Steem API before you know that for most pages one of the following API are used:

getDiscussionsByFeed
getDiscussionsByBlog
getDiscussionsByTrending
getDiscussionsByCreated

Of course those API include only standard Steem details. To load additional SCOT rewards another call is required and fortunately it is pretty straightforward:

https://scot-api.steem-engine.com/@author/permlink

We don't need to do this call on each posts fetched in the feed, but only for posts having one (or more) of the correct tags to be processed by Scotbot (at the time of this post only palnet, spt and splintertalk).

This calls returns all the details available for a post in the Scot instance. For example with this call https://scot-api.steem-engine.com/@asgarth/on-the-way-back-home you'll get the following result (I removed some parts to make it easier to read):

{
  "PAL":{
    "active_votes":[...],
    "app":"steempeak/1.12.2",
    "author":"asgarth",
    "author_curve_exponent":1.05,
    "authorperm":"@asgarth/on-the-way-back-home",
    "beneficiaries_payout_value":0,
    "block":33975537,
    "cashout_time":"2019-06-27T21:43:48",
    "children":1,
    "created":"2019-06-20T21:43:48",
    "curator_payout_value":0,
    "decline_payout":false,
    "desc":"As some of you may have noticed I'm trying to post more consistently...",
    "json_metadata":"{\"app\": \"steempeak/1.12.2\", , ...}",
    "last_payout":"1970-01-01T00:00:00",
    "last_update":"2019-06-25T19:19:19",
    "main_post":true,
    "pending_token":1440,
    "precision":3,
    "promoted":0,
    "score_hot":156109.0,
    "score_trend":3254.84,
    "tags":"photofeed,palnet,steempeak,photography,cityscape",
    "title":"On The Way Back Home",
    "token":"PAL",
    "total_payout_value":0,
    "total_vote_weight":0,
    "vote_rshares":4294022
  }
}

After parsing and attaching those information to the post retrieved with the Steem API we have everything required to display the additional rewards details on the post payout.
Considering that multiple tokens can be associated with a single post and that the space available in the post footer is quite limited I added a small icon indicating the additional rewards and moved all the additional details in the tooltip.

This is a preview of the payout of one of my recent posts having both Steem and PAL.

Selection_098.png

I hope you like it and that you'll find it useful. Of course there will be other pages included in the next release related to the Tribes, but for this post I think to have already shown enough :D


As always feedback and suggestion are much appreciated, both in the comments or on our Discord ;)


Sergio

Sort:  

This is an awesome implementation @asgarth! I'm not a programmer, but looking at the info you get back from the scot instance I see

"total_payout_value":0,

Is that in USD or Pal?

Because I think it would be cool if the USD value shown was the sum of all rewards. Once these scot instances take off the user will have to do a lot of math, as well as going to check the prices of all tokens to know the total value of a post. Just some thoughts. :)

Excellent work as always!

Glad you mentioned this. We have talked about this topic internally too in the past days. Unfortunately the value returned is in PAL and there isn't an easy way to show the USD reward. We had a way to get the USD amount for standard Steem Payout, but now that we have more than one token is not so easy to get the total value.

Probably this can be done for the 'estimated' value on pending payouts (it will take more code and some more API calls). But the real challenge is to get the correct value for post already paid because I don't think there is an API to view the historical price of the steem-engine tokens. Getting the USD payout for a post paid 1 month ago will be really difficult.

Looking great, thank you for your hard work on this. I really like your thumbnail images for this post series too :)

I would like to improve the tooltip layout a bit but this will have to wait for a later release.

And thanks for thumbnail too. I tried to create a simple image that I can easily update without being too boring for the readers :)

Awesome feature to add, I will find it very useful! You continue to impress :)

Thanks. Glad you like it ;)

Great work @asgarth! Now I can stop using the crappy steemit clone to access PAL.

Hopefully more tribes will be added in the coming days/weeks ;)

You’re the man!
Thanks for everything you do.

Thanks, let me know if you have feedback on this new addition :)

"...but for this post I think to have already shown enough :D ...."

Lol... looking forward to it!

does that mean palnet is added automatically now on a new post, or is there some kind of checkbox?

At the moment you still have to add the 'palnet' tag manually. We are planning some updates to the Publish page to make this easier.

alright, thanks!

This is pretty cool :-D I may ditch busy for Steempeak now that everyone is participating on these "tribes"

Let us know if there is something that you think should be improved ;)

You all are starting to run laps around steemit.

Posted using Partiko Android

On your left!

Awesome, @swayzilla I just started following this guy but he's got some great developer related posts that I will certainly be reading more of!

Grazie mille Sergio!

Hey very cool im glad i asked about him on Steempeak.com discord ! https://discord.gg/pBcJJTS

I am patiently awaiting ability to send ALL steem engine tokens in steempeak wallet

I know we mentioned it in the discord but for anyone else reading the option is totally already there. It's the SEND button.

I just found it yes haha i didnt have to wait long , i apologize for my confusion, here it is!

, i just didnt notice because the page looks the same unless you know to actually click send
It took an admin to tell me it was there for me to know, because i was just expecting an extra button of some sort.... but i guess most steemians will know about that with it being normal to select various coins, with steem/sbd pull down menu on steemitwallet......,

so even though i wanted a button here but may not be the best choice but im very excited now , i appreciate you responding, and hey steempeak is so early, and you can end up as one of the top steem front ends, maybe surpassing steemit.com for mobile one day ...

image.png

maybe you cant add a button for each coin, maybe its overkill to add a second button for sending SE tokens i just wanted to let people know who visit the wallet page... but maybe new users will see the tokens and it will be fine...