While the Hive API makes it easy to know to whom an account is delegating using
condenser_api.get_vesting_delegations, the opposite is more difficult. As far as I know, there is no API call to know who has delegated to an account.
Fortunately, HiveSQL allows you to easily retrieve this information thanks to the TxDelegateVestingShares table which includes all creation, modification or removal of delegation operations carried out by users.
However, the main difficulty comes from the fact that you have to check the last
delegate_vesting_share operation involving two accounts to get the state of the delegation between these accounts.
Due to all the technical reasons mentioned above, retrieving an accurate list of delegators or delegatees has become much more complex and resources consuming.
The non-consensus state table Delegations allows you to retrieve delegations data quickly and easily. It contains the list of all active delegations with the following info:
The account delegating Hive Power
The account receiving Hive Power delegation
The amount of Vesting Shares delegated