I started working on Blurt delegation with beem.
Plan is to display
incoming delegations: where they are coming from
outgoing delegations: where they are going to
expiring delegations: when delegations expire (since it takes 5 days)
Main part is done like this to get all 3 delegation data
def get_delegation(self):
# find delegations for username
data = {}
if self.username:
# find outgoing delegatons
data['outgoing'] = self.account.get_vesting_delegations()
for value in data['outgoing']:
# vests to BP conversion
# vests = Amount(value['vesting_shares'])
# bp = self.blurt.vests_to_bp(vests.amount)
# value['bp'] = f'{bp:.3f}'
value['bp'] = self.vests_to_bp(value['vesting_shares'])
# find expiring delegatons
data['expiring'] = self.account.get_expiring_vesting_delegations()
for value in data['expiring']:
# vests to BP conversion
# vests = Amount(value['vesting_shares'])
# bp = self.blurt.vests_to_bp(vests.amount)
# value['bp'] = f'{bp:.3f}'
value['bp'] = self.vests_to_bp(value['vesting_shares'])
# find incoming delegatons
data['incoming'] = []
incoming_temp = dict()
for operation in self.account.history(
only_ops=["delegate_vesting_shares"]):
if self.username == operation["delegator"]:
continue
if operation["vesting_shares"] == '0.000000 VESTS':
incoming_temp.pop(operation["delegator"])
continue
else:
incoming_temp[operation["delegator"]] = operation
for key, value in incoming_temp.items():
value['bp'] = self.vests_to_bp(value['vesting_shares'])
data['incoming'].append(value)
return data
def vests_to_bp(self, vests):
# VESTS to BP conversion
bp = 0.000
v = Amount(vests)
bp = self.blurt.vests_to_bp(v.amount)
bp = f'{bp:.3f}'
return bp
I think backend is working, but frontend for this is not done... 😂
Every time I work on frontend, I get distracted and feel like I want to change something, but design takes a looong time for me. It is very exausting.
So just added a bear.
I think I like it like that for now...
Get Rewarded For Browsing! Are you Brave?
➡️ Website
Yay!
Your post has been boosted with Ecency Points. Keep up the good work!
Dear reader, Install Android: https://android.ecency.com, iOS: https://ios.ecency.com mobile app or desktop app for Windows, Mac, Linux: https://desktop.ecency.com
Learn more: https://ecency.com
Join our discord: https://discord.me/ecency