The Daily Adventures of a SteemPeak Developer #5 - Meet the New SCOT Tribes Page

As some of you already know, it's now possible to view the new Tribes powered by Scotbot and the Steem Engine tokens on SteemPeak.

In this post I'm going to give a short overview of the new page and how those tribes are loaded.

The New SCOT Tribes page

the_daily_adventure_cover_scot_tribes.png

Read other posts in the series HERE


But first of all here is a screenshot of the new page that will be useful to people not yet familiar with the new features :D

Selection_103.png

To retrieve the list of the Scotbot enabled tokens there are 2 API calls available:

https://scot-api.steem-engine.com/config
https://scot-api.steem-engine.com/info

Both those API returns a list of token with some details. For a frontend (or at least this is true for SteemPeak) the required details are all available in the /info endpoint. Calls can also be filtered to a specific token adding the corresponding query string parameter:

https://scot-api.steem-engine.com/info?token=PAL

This is a sample response for the PAL token:

claimed_token: 62474352
enabled: true
inflation_tools: 2
issuer: "minnowsupport"
last_mining_claim_block_num: 34264680
last_mining_claim_trx: "d23bed63c5141485c5558044572ef666ccb48f61"
last_other_accounts_transfer_block_num: 34255733
last_processed_mining_claim_block_num: 34263486
last_processed_staking_claim_block_num: 0
last_reduction_block_num: 33534726
last_reward_block_num: 34264727
last_staking_claim_block_num: null
last_staking_claim_trx: null
mining_enabled: true
mining_reward_pool: 24806
next_mining_claim_number: 0
next_staking_claim_number: 0
other_reward_pool: 213901
pending_rshares: 186237827819
pending_token: 6702578
precision: 3
reward_pool: 26014083
rewards_token: 62000
setup_complete: 2
staked_mining_power: 2981
staked_token: 1921261418
staking_enabled: false
staking_reward_pool: 0
start_block_num: 33534726
start_date: "Wed, 05 Jun 2019 15:44:21 GMT"
symbol: "PAL"
total_generated_token: 112777000
voting_enabled: true

Not all those fields are required for SteemPeak (and probably not required by other frontends neither), but maybe we'll use some of them in the future as we improve the set of available features so I'm glad to have so many details ready to be used all in one place.

An huge thanks to @holger80 for creating those API and for his support while I've worked on this.

This call is the main call to get the list of the tribes to include in the new page. But as you can see no images are available and no metadata (website, description, ...). To retrieve those information an additional call to the Steem Engine API is required. Thanks to @harpagon this is quite easy using this JavaScript library: https://github.com/harpagon210/sscjs.

This is the method used on SteemPeak (tokenNames is the list of the tokens retrieved in the previous call):

ssc.find('tokens', 'tokens', { 'symbol': { '$in': tokenNames } }, 1000, 0, [], (error, result) => { ... }

The result is an array of details associated with the specified tokens (tribes in this case). This is a sample of the response for the PAL tribe:

circulatingSupply: "14891366.650"
delegationEnabled: true
issuer: "minnowsupport"
maxSupply: 7000000000
metadata: "{"url":"http://minnowsupportproject.org","icon":"
name: "PALcoin"
numberTransactions: 4
precision: 3
stakingEnabled: true
supply: "14901090.801"
symbol: "PAL"
totalStaked: "1926016.983"
undelegationCooldown: 7
unstakingCooldown: 28

Now we have all the metadata required to display the tribe cards in the Tribes landing page. The only missing part is the whitelist for the tribes that are enabled on SteemPeak.

At the moment there is no API on Scot to get that list dynamically. So I have to manually whitelist tribes when I receive the green light from the Steem Engine team.


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


Thanks,
Sergio

H2
H3
H4
3 columns
2 columns
1 column
8 Comments