From bbcecbfbbd81fb4fc7c74959ef3adb56c9f625a1 Mon Sep 17 00:00:00 2001 From: Steve Gerbino Date: Tue, 25 Feb 2020 17:00:59 -0500 Subject: [PATCH] #3593: Added RC API functions to the cli wallet --- .../include/steem/wallet/remote_node_api.hpp | 12 ++++ .../wallet/include/steem/wallet/wallet.hpp | 58 +++++++++++++++++++ libraries/wallet/remote_node_api.cpp | 31 ++++++++++ libraries/wallet/wallet.cpp | 39 +++++++++++++ 4 files changed, 140 insertions(+) diff --git a/libraries/wallet/include/steem/wallet/remote_node_api.hpp b/libraries/wallet/include/steem/wallet/remote_node_api.hpp index 9b0f347c67..4f9cfbfc13 100644 --- a/libraries/wallet/include/steem/wallet/remote_node_api.hpp +++ b/libraries/wallet/include/steem/wallet/remote_node_api.hpp @@ -111,6 +111,12 @@ struct remote_node_api vector< database_api::api_proposal_vote_object > list_proposal_votes( fc::variant, uint32_t, database_api::sort_order_type, database_api::order_direction_type, database_api::proposal_status ); vector< asset_symbol_type > get_nai_pool(void); vector< database_api::api_smt_account_balance_object > get_smt_balances( vector< std::pair < string, string > > ); + vector< rc::rc_account_api_object > find_rc_accounts( vector< account_name_type >); + vector< rc::rc_account_api_object > list_rc_accounts( account_name_type, uint32_t, rc::sort_order_type ); + vector< rc::rc_delegation_pool_api_object > find_rc_delegation_pools( vector< account_name_type > ); + vector< rc::rc_delegation_pool_api_object > list_rc_delegation_pools( account_name_type, uint32_t, rc::sort_order_type ); + vector< rc::rc_indel_edge_api_object > find_rc_delegations( account_name_type ); + vector< rc::rc_indel_edge_api_object > list_rc_delegations( account_name_type, uint32_t, rc::sort_order_type ); }; } } @@ -206,4 +212,10 @@ FC_API( steem::wallet::remote_node_api, (list_proposal_votes) (get_nai_pool) (get_smt_balances) + (find_rc_accounts) + (list_rc_accounts) + (find_rc_delegation_pools) + (list_rc_delegation_pools) + (find_rc_delegations) + (list_rc_delegations) ) diff --git a/libraries/wallet/include/steem/wallet/wallet.hpp b/libraries/wallet/include/steem/wallet/wallet.hpp index 4fe3c07d83..1072f057e0 100644 --- a/libraries/wallet/include/steem/wallet/wallet.hpp +++ b/libraries/wallet/include/steem/wallet/wallet.hpp @@ -1359,6 +1359,64 @@ class wallet_api account_name_type signer, bool broadcast ); + /** + * Retrieve RC information for the given accounts. + * + * @param accounts The vector of accounts + */ + vector< rc::rc_account_api_object > find_rc_accounts( vector< account_name_type > accounts ); + + /** + * List RC accounts. + * + * @param account The starting account + * @param limit The limit of returned results + * @param order The sort order + */ + vector< rc::rc_account_api_object > list_rc_accounts( + account_name_type account, + uint32_t limit, + rc::sort_order_type order ); + + /** + * Retrieve RC delegation pools for the given accounts. + * + * @param accounts The vector of accounts + */ + vector< rc::rc_delegation_pool_api_object > find_rc_delegation_pools( vector< account_name_type > accounts ); + + /** + * List RC delegation pools. + * + * @param account The starting account + * @param limit The limit of returned results + * @param order The sort order + */ + vector< rc::rc_delegation_pool_api_object > list_rc_delegation_pools( + account_name_type account, + uint32_t limit, + rc::sort_order_type order ); + + /** + * Retrieve RC delegations information for the given account. + * + * @param account The account + */ + vector< rc::rc_indel_edge_api_object > find_rc_delegations( account_name_type account ); + + /** + * List RC delegations. + * + * @param account The starting account + * @param limit The limit of returned results + * @param order The sort order + */ + vector< rc::rc_indel_edge_api_object > list_rc_delegations( + account_name_type account, + uint32_t limit, + rc::sort_order_type order ); + + std::map> get_result_formatters() const; fc::signal lock_changed; diff --git a/libraries/wallet/remote_node_api.cpp b/libraries/wallet/remote_node_api.cpp index 6593b73737..1452e534c0 100644 --- a/libraries/wallet/remote_node_api.cpp +++ b/libraries/wallet/remote_node_api.cpp @@ -449,4 +449,35 @@ vector< asset_symbol_type > remote_node_api::get_nai_pool() FC_ASSERT( false ); } +vector< rc::rc_account_api_object > remote_node_api::find_rc_accounts( vector< account_name_type >) +{ + FC_ASSERT( false ); +} + +vector< rc::rc_account_api_object > remote_node_api::list_rc_accounts( account_name_type, uint32_t, rc::sort_order_type ) +{ + FC_ASSERT( false ); +} + +vector< rc::rc_delegation_pool_api_object > remote_node_api::find_rc_delegation_pools( vector< account_name_type > ) +{ + FC_ASSERT( false ); +} + +vector< rc::rc_delegation_pool_api_object > remote_node_api::list_rc_delegation_pools( account_name_type, uint32_t, rc::sort_order_type ) +{ + FC_ASSERT( false ); +} + +vector< rc::rc_indel_edge_api_object > remote_node_api::find_rc_delegations( account_name_type ) +{ + FC_ASSERT( false ); +} + +vector< rc::rc_indel_edge_api_object > remote_node_api::list_rc_delegations( account_name_type, uint32_t, rc::sort_order_type ) +{ + FC_ASSERT( false ); +} + + } } diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index 5bd6a5cef2..11653de2cd 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -2881,4 +2881,43 @@ condenser_api::legacy_signed_transaction wallet_api::follow( string follower, st return my->sign_transaction( trx, broadcast ); } + vector< rc::rc_account_api_object > wallet_api::find_rc_accounts( vector< account_name_type > accounts ) + { + return my->_remote_api->find_rc_accounts( accounts ); + } + + vector< rc::rc_account_api_object > wallet_api::list_rc_accounts( + account_name_type account, + uint32_t limit, + rc::sort_order_type order ) + { + return my->_remote_api->list_rc_accounts( account, limit, order ); + } + + vector< rc::rc_delegation_pool_api_object > wallet_api::find_rc_delegation_pools( vector< account_name_type > accounts ) + { + return my->_remote_api->find_rc_delegation_pools( accounts ); + } + + vector< rc::rc_delegation_pool_api_object > wallet_api::list_rc_delegation_pools( + account_name_type account, + uint32_t limit, + rc::sort_order_type order ) + { + return my->_remote_api->list_rc_delegation_pools( account, limit, order ); + } + + vector< rc::rc_indel_edge_api_object > wallet_api::find_rc_delegations( account_name_type account ) + { + return my->_remote_api->find_rc_delegations( account ); + } + + vector< rc::rc_indel_edge_api_object > wallet_api::list_rc_delegations( + account_name_type account, + uint32_t limit, + rc::sort_order_type order ) + { + return my->_remote_api->list_rc_delegations( account, limit, order ); + } + } } // steem::wallet