You are viewing a single comment's thread from:

RE: SteemWorld ~ Newsletter #3 / February, 2018

in #steem7 years ago

Thanks man! If you want to build it on your own with SQL, you need to look for the last 'delegate_vesting_shares' operation with the desired combination of 'delegator' and 'delegatee':

SELECT vesting_shares FROM [table] WHERE delegator = [1] AND delegatee = [2] ORDER BY [date] DESC LIMIT 1

To retrieve all active outgoing delegations for an account you will also need some grouping/joining to select each group ( delegator + delegatee ) with the last date. I think I would do it with MAX( [date] ) so that for each group only the row with highest date will be returned. To reach optimal performance I would recommend to test a few different queries (depending on existing indices for the table and type of your used SQL server).

You could also use SteemJS ( steem.api.getVestingDelegationsAsync() ) or just make a direct curl() to a steem node with 'get_vesting_delegations' to achieve that.