From c9f240c7654896f73b6951f71d1d6610c30b2dfd Mon Sep 17 00:00:00 2001
From: crokkon <33018033+crokkon@users.noreply.github.com>
Date: Tue, 27 Nov 2018 11:03:48 +0100
Subject: [PATCH] Account: support for retrieving all delegations

Switching `Account.get_vesting_delegations()` from the
`find_vesting_delegations` API call, which is limited to only the first
1000 entries, to `list_vesting_delegations`. The latter supports
`start_account` and `limit` also for appbase nodes and allows fetching
all delegations of a given account.
---
 beem/account.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/beem/account.py b/beem/account.py
index 18d82001..3fc8b6c0 100644
--- a/beem/account.py
+++ b/beem/account.py
@@ -1143,8 +1143,8 @@ class Account(BlockchainObject):
         """ Returns the vesting delegations by an account.
 
             :param str account: When set, a different account is used for the request (Default is object account name)
-            :param str start_account: Only used in pre-appbase nodes
-            :param int limit: Only used in pre-appbase nodes
+            :param str start_account: delegatee to start with, leave empty to start from the first by name
+            :param int limit: maximum number of results to return
             :rtype: list
 
             .. code-block:: python
@@ -1163,7 +1163,10 @@ class Account(BlockchainObject):
             raise OfflineHasNoRPCException("No RPC available in offline mode!")
         self.steem.rpc.set_next_node_on_empty_reply(False)
         if self.steem.rpc.get_use_appbase():
-            return self.steem.rpc.find_vesting_delegations({'account': account}, api="database")['delegations']
+            delegations = self.steem.rpc.list_vesting_delegations(
+                {'start': [account, start_account], 'limit': limit,
+                 'order': 'by_delegation'}, api="database")['delegations']
+            return [d for d in delegations if d['delegator'] == account]
         else:
             return self.steem.rpc.get_vesting_delegations(account, start_account, limit)
 
-- 
GitLab