From fd40d47240d24ea74cc99d468b453daf3ed7eb56 Mon Sep 17 00:00:00 2001 From: Steve Gerbino Date: Tue, 11 Feb 2020 16:31:01 -0500 Subject: [PATCH 1/6] #3593: Add delegation pool support to the cli wallet --- .../wallet/include/steem/wallet/wallet.hpp | 53 +++++++++++ libraries/wallet/wallet.cpp | 92 +++++++++++++++++++ 2 files changed, 145 insertions(+) diff --git a/libraries/wallet/include/steem/wallet/wallet.hpp b/libraries/wallet/include/steem/wallet/wallet.hpp index c1f30839ba..4fe3c07d83 100644 --- a/libraries/wallet/include/steem/wallet/wallet.hpp +++ b/libraries/wallet/include/steem/wallet/wallet.hpp @@ -1311,6 +1311,54 @@ class wallet_api */ vector< asset_symbol_type > get_nai_pool(); + /** + * Delegate from a user to a pool. + * + * @param from_account The source account + * @param to_pool The destination pool + * @param amount The amount to delegate + * @param broadcast To broadcast this transaction or not + */ + condenser_api::legacy_signed_transaction delegate_to_pool( + account_name_type from_account, + account_name_type to_pool, + asset amount, + bool broadcast ); + + /** + * Delegate from a pool to a user. + * + * @param from_pool The source pool + * @param to_account The destination account + * @param to_slot The slot + * @param asset_symbol The symbol of the delegation + * @param drc_max_mana The maximum mana to delegate + * @param broadcast To broadcast this transaction or not + */ + condenser_api::legacy_signed_transaction delegate_drc_from_pool( + account_name_type from_pool, + account_name_type to_account, + uint8_t to_slot, + asset_symbol_type asset_symbol, + int64_t drc_max_mana, + bool broadcast ); + + /** + * Designate an account the privilege to delegate a slot. + * + * @param from_pool The source pool + * @param to_account The destination account + * @param to_slot The slot + * @param signer The appointed delegator + * @param broadcast To broadcast this transaction or not + */ + condenser_api::legacy_signed_transaction set_slot_delegator( + account_name_type from_pool, + account_name_type to_account, + uint8_t to_slot, + account_name_type signer, + bool broadcast ); + std::map> get_result_formatters() const; fc::signal lock_changed; @@ -1442,6 +1490,11 @@ FC_API( steem::wallet::wallet_api, (smt_setup) (smt_contribute) (get_nai_pool) + + /// delegation pool api + (delegate_to_pool) + (delegate_drc_from_pool) + (set_slot_delegator) ) FC_REFLECT( steem::wallet::memo_data, (from)(to)(nonce)(check)(encrypted) ) diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index a4d74c9c1a..5bd6a5cef2 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -12,6 +12,9 @@ #include #include +#include +#include +#include #include #include @@ -2789,4 +2792,93 @@ condenser_api::legacy_signed_transaction wallet_api::follow( string follower, st return my->_remote_api->get_nai_pool(); } + condenser_api::legacy_signed_transaction wallet_api::delegate_to_pool( + account_name_type from_account, + account_name_type to_pool, + asset amount, + bool broadcast ) + { + using namespace plugins::rc; + FC_ASSERT( !is_locked() ); + + delegate_to_pool_operation cop; + cop.from_account = from_account; + cop.to_pool = to_pool; + cop.amount = amount; + + custom_json_operation op; + op.json = fc::json::to_string( rc_plugin_operation( cop ) ); + op.id = STEEM_RC_PLUGIN_NAME; + + flat_set< account_name_type > required_auths; + cop.get_required_active_authorities( required_auths ); + op.required_auths = required_auths; + + signed_transaction trx; + trx.operations.push_back( op ); + trx.validate(); + return my->sign_transaction( trx, broadcast ); + } + + condenser_api::legacy_signed_transaction wallet_api::delegate_drc_from_pool( + account_name_type from_pool, + account_name_type to_account, + uint8_t to_slot, + asset_symbol_type asset_symbol, + int64_t drc_max_mana, + bool broadcast ) + { + using namespace plugins::rc; + FC_ASSERT( !is_locked() ); + + delegate_drc_from_pool_operation cop; + cop.from_pool = from_pool; + cop.to_account = to_account; + cop.to_slot = to_slot; + cop.drc_max_mana = drc_max_mana; + + custom_json_operation op; + op.json = fc::json::to_string( rc_plugin_operation( cop ) ); + op.id = STEEM_RC_PLUGIN_NAME; + + flat_set< account_name_type > required_auths; + cop.get_required_active_authorities( required_auths ); + op.required_auths = required_auths; + + signed_transaction trx; + trx.operations.push_back( op ); + trx.validate(); + return my->sign_transaction( trx, broadcast ); + } + + condenser_api::legacy_signed_transaction wallet_api::set_slot_delegator( + account_name_type from_pool, + account_name_type to_account, + uint8_t to_slot, + account_name_type signer, + bool broadcast ) + { + using namespace plugins::rc; + FC_ASSERT( !is_locked() ); + + set_slot_delegator_operation cop; + cop.from_pool = from_pool; + cop.to_account = to_account; + cop.to_slot = to_slot; + cop.signer = signer; + + custom_json_operation op; + op.json = fc::json::to_string( rc_plugin_operation( cop ) ); + op.id = STEEM_RC_PLUGIN_NAME; + + flat_set< account_name_type > required_auths; + cop.get_required_active_authorities( required_auths ); + op.required_auths = required_auths; + + signed_transaction trx; + trx.operations.push_back( op ); + trx.validate(); + return my->sign_transaction( trx, broadcast ); + } + } } // steem::wallet From e51fbaafd76aebd7549b56bd5c3bb2e2031e2a17 Mon Sep 17 00:00:00 2001 From: Steve Gerbino Date: Mon, 24 Feb 2020 17:59:08 -0500 Subject: [PATCH 2/6] #3593: Implement condenser wrapper APIs for RC APIs --- .../plugins/apis/condenser_api/CMakeLists.txt | 1 + .../apis/condenser_api/condenser_api.cpp | 86 +++++++++++++++++++ .../plugins/condenser_api/condenser_api.hpp | 13 +++ .../include/steem/plugins/rc_api/rc_api.hpp | 2 + 4 files changed, 102 insertions(+) diff --git a/libraries/plugins/apis/condenser_api/CMakeLists.txt b/libraries/plugins/apis/condenser_api/CMakeLists.txt index 50fd9e767f..769ae38d82 100644 --- a/libraries/plugins/apis/condenser_api/CMakeLists.txt +++ b/libraries/plugins/apis/condenser_api/CMakeLists.txt @@ -17,6 +17,7 @@ target_link_libraries( condenser_api_plugin market_history_api_plugin network_broadcast_api_plugin tags_api_plugin + rc_api_plugin steem_utilities ) target_include_directories( condenser_api_plugin PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) diff --git a/libraries/plugins/apis/condenser_api/condenser_api.cpp b/libraries/plugins/apis/condenser_api/condenser_api.cpp index 3c472a28f4..191beede2e 100644 --- a/libraries/plugins/apis/condenser_api/condenser_api.cpp +++ b/libraries/plugins/apis/condenser_api/condenser_api.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include @@ -137,6 +138,12 @@ namespace detail (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) ) void recursively_fetch_content( state& _state, tags::discussion& root, set& referenced_accounts ); @@ -159,6 +166,7 @@ namespace detail std::shared_ptr< follow::follow_api > _follow_api; std::shared_ptr< reputation::reputation_api > _reputation_api; std::shared_ptr< market_history::market_history_api > _market_history_api; + std::shared_ptr< rc::rc_api > _rc_api; map< transaction_id_type, confirmation_callback > _callbacks; map< time_point_sec, vector< transaction_id_type > > _callback_expirations; boost::signals2::connection _on_post_apply_block_conn; @@ -2144,6 +2152,72 @@ namespace detail return _database_api->find_smt_token_balances( dbapi_args ).balances; } + DEFINE_API_IMPL( condenser_api_impl, find_rc_accounts ) + { + CHECK_ARG_SIZE( 1 ) + FC_ASSERT( _rc_api, "rc_api_plugin not enabled." ); + + return _rc_api->find_rc_accounts( { args[0].as< vector< account_name_type > >() } ).rc_accounts; + } + + DEFINE_API_IMPL( condenser_api_impl, list_rc_accounts ) + { + FC_ASSERT( args.size() == 3, "Expected 3 arguments, was ${n}", ("n", args.size()) ); + FC_ASSERT( _rc_api, "rc_api_plugin not enabled." ); + + rc::list_rc_accounts_args a; + a.start = args[0].as< account_name_type >(); + a.limit = args[1].as< uint32_t >(); + a.order = args[2].as< rc::sort_order_type >(); + + return _rc_api->list_rc_accounts( a ).rc_accounts; + } + + DEFINE_API_IMPL( condenser_api_impl, find_rc_delegation_pools ) + { + CHECK_ARG_SIZE( 1 ) + FC_ASSERT( _rc_api, "rc_api_plugin not enabled." ); + + return _rc_api->find_rc_delegation_pools( { args[0].as< vector< account_name_type > >() } ).rc_delegation_pools; + } + + DEFINE_API_IMPL( condenser_api_impl, list_rc_delegation_pools ) + { + FC_ASSERT( args.size() == 3, "Expected 3 arguments, was ${n}", ("n", args.size()) ); + FC_ASSERT( _rc_api, "rc_api_plugin not enabled." ); + + rc::list_rc_delegation_pools_args a; + a.start = args[0].as< account_name_type >(); + a.limit = args[1].as< uint32_t >(); + a.order = args[2].as< rc::sort_order_type >(); + + return _rc_api->list_rc_delegation_pools( a ).rc_delegation_pools; + } + + DEFINE_API_IMPL( condenser_api_impl, find_rc_delegations ) + { + CHECK_ARG_SIZE( 1 ) + FC_ASSERT( _rc_api, "rc_api_plugin not enabled." ); + + rc::find_rc_delegations_args a; + a.account = args[0].as< account_name_type >(); + + return _rc_api->find_rc_delegations( a ).rc_delegations; + } + + DEFINE_API_IMPL( condenser_api_impl, list_rc_delegations ) + { + FC_ASSERT( args.size() == 3, "Expected 3 arguments, was ${n}", ("n", args.size()) ); + FC_ASSERT( _rc_api, "rc_api_plugin not enabled." ); + + rc::list_rc_delegations_args a; + a.start = args[0].as< account_name_type >(); + a.limit = args[1].as< uint32_t >(); + a.order = args[2].as< rc::sort_order_type >(); + + return _rc_api->list_rc_delegations( a ).rc_delegations; + } + } // detail uint16_t api_account_object::_compute_voting_power( const database_api::api_account_object& a ) @@ -2250,6 +2324,12 @@ void condenser_api::api_startup() { my->_market_history_api = market_history->api; } + + auto rc = appbase::app().find_plugin< rc::rc_api_plugin >(); + if( rc != nullptr ) + { + my->_rc_api = rc->api; + } } DEFINE_LOCKLESS_APIS( condenser_api, @@ -2345,6 +2425,12 @@ DEFINE_READ_APIS( condenser_api, (find_proposals) (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) ) } } } // steem::plugins::condenser_api diff --git a/libraries/plugins/apis/condenser_api/include/steem/plugins/condenser_api/condenser_api.hpp b/libraries/plugins/apis/condenser_api/include/steem/plugins/condenser_api/condenser_api.hpp index f3a05c6479..aa595fe242 100644 --- a/libraries/plugins/apis/condenser_api/include/steem/plugins/condenser_api/condenser_api.hpp +++ b/libraries/plugins/apis/condenser_api/include/steem/plugins/condenser_api/condenser_api.hpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -1077,6 +1078,12 @@ DEFINE_API_ARGS( find_proposals, vector< variant >, ve DEFINE_API_ARGS( list_proposal_votes, vector< variant >, vector< database_api::api_proposal_vote_object > ) DEFINE_API_ARGS( get_nai_pool, vector< variant >, vector< asset_symbol_type > ) DEFINE_API_ARGS( get_smt_balances, vector< variant >, vector< database_api::api_smt_account_balance_object > ) +DEFINE_API_ARGS( find_rc_accounts, vector< variant >, vector< rc::rc_account_api_object > ) +DEFINE_API_ARGS( list_rc_accounts, vector< variant >, vector< rc::rc_account_api_object > ) +DEFINE_API_ARGS( find_rc_delegation_pools, vector< variant >, vector< rc::rc_delegation_pool_api_object > ) +DEFINE_API_ARGS( list_rc_delegation_pools, vector< variant >, vector< rc::rc_delegation_pool_api_object > ) +DEFINE_API_ARGS( find_rc_delegations, vector< variant >, vector< rc::rc_indel_edge_api_object > ) +DEFINE_API_ARGS( list_rc_delegations, vector< variant >, vector< rc::rc_indel_edge_api_object > ) #undef DEFINE_API_ARGS @@ -1176,6 +1183,12 @@ class condenser_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) ) private: diff --git a/libraries/plugins/apis/rc_api/include/steem/plugins/rc_api/rc_api.hpp b/libraries/plugins/apis/rc_api/include/steem/plugins/rc_api/rc_api.hpp index b348fcee3a..67bb11ff27 100644 --- a/libraries/plugins/apis/rc_api/include/steem/plugins/rc_api/rc_api.hpp +++ b/libraries/plugins/apis/rc_api/include/steem/plugins/rc_api/rc_api.hpp @@ -62,6 +62,8 @@ struct pool_delegation struct rc_account_api_object { + rc_account_api_object(){} + rc_account_api_object( const rc_account_object& rca, const database& db ) : account( rca.account ), creator( rca.creator ), From bbcecbfbbd81fb4fc7c74959ef3adb56c9f625a1 Mon Sep 17 00:00:00 2001 From: Steve Gerbino Date: Tue, 25 Feb 2020 17:00:59 -0500 Subject: [PATCH 3/6] #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 From f8ae7cf670dfbbd24c3d920f73cb7a0e3a76812a Mon Sep 17 00:00:00 2001 From: Steve Gerbino Date: Tue, 25 Feb 2020 17:31:34 -0500 Subject: [PATCH 4/6] #3593: Add RC APIs to wallet reflection --- libraries/wallet/include/steem/wallet/wallet.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libraries/wallet/include/steem/wallet/wallet.hpp b/libraries/wallet/include/steem/wallet/wallet.hpp index 1072f057e0..9d4604b2ff 100644 --- a/libraries/wallet/include/steem/wallet/wallet.hpp +++ b/libraries/wallet/include/steem/wallet/wallet.hpp @@ -1553,6 +1553,12 @@ FC_API( steem::wallet::wallet_api, (delegate_to_pool) (delegate_drc_from_pool) (set_slot_delegator) + (find_rc_accounts) + (list_rc_accounts) + (find_rc_delegation_pools) + (list_rc_delegation_pools) + (find_rc_delegations) + (list_rc_delegations) ) FC_REFLECT( steem::wallet::memo_data, (from)(to)(nonce)(check)(encrypted) ) From ba90b8c7e65611e8d78a701e63e0476a170857c5 Mon Sep 17 00:00:00 2001 From: Steve Gerbino Date: Thu, 27 Feb 2020 19:36:01 -0500 Subject: [PATCH 5/6] #3593: Cleanup API object constructor --- .../apis/rc_api/include/steem/plugins/rc_api/rc_api.hpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/libraries/plugins/apis/rc_api/include/steem/plugins/rc_api/rc_api.hpp b/libraries/plugins/apis/rc_api/include/steem/plugins/rc_api/rc_api.hpp index 67bb11ff27..d0145b5f53 100644 --- a/libraries/plugins/apis/rc_api/include/steem/plugins/rc_api/rc_api.hpp +++ b/libraries/plugins/apis/rc_api/include/steem/plugins/rc_api/rc_api.hpp @@ -75,15 +75,11 @@ struct rc_account_api_object { max_rc = get_maximum_rc( db.get_account( account ), rca ); - db.get_index< chain::comment_index, chain::by_permlink >(); // works - db.get_index< rc_outdel_drc_edge_index, by_edge >(); // does not work - db.get_index< rc_outdel_drc_edge_index >().indices().get< by_edge >(); // works - for( const account_name_type& pool : delegation_slots ) + for ( const account_name_type& pool : delegation_slots ) { pool_delegation del; - db.get< rc_outdel_drc_edge_object, by_edge >( boost::make_tuple( pool, account, VESTS_SYMBOL ) ); // does not work - auto indel_edge = db.find< rc_outdel_drc_edge_object, by_edge >( boost::make_tuple( pool, account, VESTS_SYMBOL ) ); // does not work + auto indel_edge = db.find< rc_outdel_drc_edge_object, by_edge >( boost::make_tuple( pool, account, VESTS_SYMBOL ) ); if( indel_edge != nullptr ) { del.rc_manabar = indel_edge->drc_manabar; From b6aff0e4cf9b2fd24103ca2d5f3c7739b19b05fc Mon Sep 17 00:00:00 2001 From: Steve Gerbino Date: Thu, 27 Feb 2020 19:36:43 -0500 Subject: [PATCH 6/6] #3593: Fix prototype for list_rc_delegations to a vector of account name types --- libraries/plugins/apis/condenser_api/condenser_api.cpp | 2 +- libraries/wallet/include/steem/wallet/remote_node_api.hpp | 2 +- libraries/wallet/include/steem/wallet/wallet.hpp | 2 +- libraries/wallet/remote_node_api.cpp | 2 +- libraries/wallet/wallet.cpp | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libraries/plugins/apis/condenser_api/condenser_api.cpp b/libraries/plugins/apis/condenser_api/condenser_api.cpp index 191beede2e..b61a090e50 100644 --- a/libraries/plugins/apis/condenser_api/condenser_api.cpp +++ b/libraries/plugins/apis/condenser_api/condenser_api.cpp @@ -2211,7 +2211,7 @@ namespace detail FC_ASSERT( _rc_api, "rc_api_plugin not enabled." ); rc::list_rc_delegations_args a; - a.start = args[0].as< account_name_type >(); + a.start = args[0].as< vector< fc::variant > >(); a.limit = args[1].as< uint32_t >(); a.order = args[2].as< rc::sort_order_type >(); diff --git a/libraries/wallet/include/steem/wallet/remote_node_api.hpp b/libraries/wallet/include/steem/wallet/remote_node_api.hpp index 4f9cfbfc13..87e3994b19 100644 --- a/libraries/wallet/include/steem/wallet/remote_node_api.hpp +++ b/libraries/wallet/include/steem/wallet/remote_node_api.hpp @@ -116,7 +116,7 @@ struct remote_node_api 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 ); + vector< rc::rc_indel_edge_api_object > list_rc_delegations( vector< account_name_type >, uint32_t, rc::sort_order_type ); }; } } diff --git a/libraries/wallet/include/steem/wallet/wallet.hpp b/libraries/wallet/include/steem/wallet/wallet.hpp index 9d4604b2ff..278f6663c6 100644 --- a/libraries/wallet/include/steem/wallet/wallet.hpp +++ b/libraries/wallet/include/steem/wallet/wallet.hpp @@ -1412,7 +1412,7 @@ class wallet_api * @param order The sort order */ vector< rc::rc_indel_edge_api_object > list_rc_delegations( - account_name_type account, + vector< account_name_type > account, uint32_t limit, rc::sort_order_type order ); diff --git a/libraries/wallet/remote_node_api.cpp b/libraries/wallet/remote_node_api.cpp index 1452e534c0..724fbab088 100644 --- a/libraries/wallet/remote_node_api.cpp +++ b/libraries/wallet/remote_node_api.cpp @@ -474,7 +474,7 @@ vector< rc::rc_indel_edge_api_object > remote_node_api::find_rc_delegations( acc 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 ) +vector< rc::rc_indel_edge_api_object > remote_node_api::list_rc_delegations( vector< 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 11653de2cd..04b416f5ec 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -2913,11 +2913,11 @@ condenser_api::legacy_signed_transaction wallet_api::follow( string follower, st } vector< rc::rc_indel_edge_api_object > wallet_api::list_rc_delegations( - account_name_type account, + vector< account_name_type > accounts, uint32_t limit, rc::sort_order_type order ) { - return my->_remote_api->list_rc_delegations( account, limit, order ); + return my->_remote_api->list_rc_delegations( accounts, limit, order ); } } } // steem::wallet