I have updated my project a bit.
It is kind of nice to know how **HIVE** and **STEEM** are doing so I took some chart widgets from CoinGecko and added to my home page.
Also I have added a "Profile" thing that you can check your account information.
Reputation, voting power, wallet info and delegations.
## https://floating-meadow-28045.herokuapp.com
![ezgif.com-gif-maker.gif](https://images.ecency.com/DQmPYP8ZpjaAiVcMFYTgPEic6HUzVn2ye7ZRJJ5o53Kqcnt/ezgif.com-gif-maker.gif)
UI, layout stuff will probably change again soon since I am going to add information in this page, but it is a nice start.
Design inspirations came from https://hivestats.io/ and https://steemworld.org/ that I use time to time but I don't use all the features.
I just want some specific information and display it in my way but I like hivestats' clean design so I think it will probably end up looking like to hivestat 🤣
Hopefully able to add some nice touch to it though 🙈 🙊 🙉
Main stuff I added was like this 👇
```
@app.route('/hive/profile', methods=['GET', 'POST'])
def hive_profile():
form = UserNameForm(request.form)
if request.method == 'POST':
if form.validate():
username = request.form['username'].lower()
return redirect('/hive/profile/' + username)
else:
flash('Username is Required')
return render_template('hive/profile.html', form=form)
@app.route('/hive/profile/<username>')
@app.route('/hive/profile/<username>/')
def hive_profile_data(username=None):
data = {}
if username:
username = escape(username).lower()
data = get_user_profile('hive', username)
logging.warning('get_user_profile')
logging.warning(data)
if data:
return render_template('hive/profile_data.html',
username=username, data=data)
else:
return render_template('hive/profile_data.html',
username=None, data=data)
def get_user_profile(chain_type, username):
chain = None
if chain_type == 'hive':
chain = set_node_list(chain_type='hive')
chain.is_hive
elif chain_type == 'steemit':
chain = set_node_list(chain_type='steemit')
else:
return None
# Create account object
try:
account = Account(username)
except Exception as e:
logging.warning(e)
return None
profile = account.profile
profile['balances'] = account.get_balances()
profile['voting_power'] = f"{account.get_voting_power(): .2f}"
profile['reputation'] = f"{account.get_reputation(): .1f}"
token_power = account.get_token_power()
profile['token_power'] = f"{token_power:.3f}"
logging.warning('token_power')
logging.warning(token_power)
# Get delegations
delegations = account.get_vesting_delegations()
if delegations:
profile['delegations'] = get_user_delegations(
chain, username, delegations)
else:
profile['delegations'] = []
return profile
def get_user_delegations(chain, username, delegations):
# Convert vest to power
delegation_list = []
for d in delegations:
amount = d['vesting_shares']['amount']
precision = d['vesting_shares']['precision']
precision = 10 ** precision
delegatee = d['delegatee']
vest_amount = float(int(amount) / precision)
if chain.is_hive:
delegation_power = f"{chain.vests_to_hp(vest_amount):.3f}"
elif chain.is_steem:
delegation_power = f"{chain.vests_to_sp(vest_amount):.3f}"
delegation_list.append(
{'delegatee': delegatee, 'amount': delegation_power})
return delegation_list
```
My stuff is all in here if you like to look at it.
(please dont. it is a big mess right now lol)
https://github.com/tomoyan/blockchain-tools
<center>
[Get Rewarded For Browsing! Are you Brave?](https://brave.com/tom490)
[<img src="https://img.esteem.app/be00j8.png">](https://brave.com/tom490)
[![happy tears](https://images.ecency.com/DQmUfaVp5UQvASdTyyLrNiBdGB7NxQfxE2wBpNivcDUkCfe/h.gif)](https://tomoyan.github.io/)
➡️ [Website](tomoyan.github.io)
➡️ [Twitter ](twitter.com/tomoyanTweet)
</center>