adding API call to get proposed transactions for an account
This commit is contained in:
parent
de99437be4
commit
962310b415
2 changed files with 27 additions and 0 deletions
|
|
@ -446,4 +446,22 @@ namespace graphene { namespace app {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** TODO: add secondary index that will accelerate this process */
|
||||||
|
vector<proposal_object> database_api::get_proposed_transactions( account_id_type id )const
|
||||||
|
{
|
||||||
|
const auto& idx = _db.get_index_type<proposal_index>();
|
||||||
|
vector<proposal_object> result;
|
||||||
|
|
||||||
|
idx.inspect_all_objects( [&](const object& obj){
|
||||||
|
const proposal_object& p = static_cast<const proposal_object&>(obj);
|
||||||
|
if( p.required_active_approvals.find( id ) != p.required_active_approvals.end() )
|
||||||
|
result.push_back(p);
|
||||||
|
else if ( p.required_owner_approvals.find( id ) != p.required_owner_approvals.end() )
|
||||||
|
result.push_back(p);
|
||||||
|
else if ( p.available_active_approvals.find( id ) != p.available_active_approvals.end() )
|
||||||
|
result.push_back(p);
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
} } // graphene::app
|
} } // graphene::app
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
#include <graphene/chain/key_object.hpp>
|
#include <graphene/chain/key_object.hpp>
|
||||||
#include <graphene/chain/delegate_object.hpp>
|
#include <graphene/chain/delegate_object.hpp>
|
||||||
#include <graphene/chain/witness_object.hpp>
|
#include <graphene/chain/witness_object.hpp>
|
||||||
|
#include <graphene/chain/proposal_object.hpp>
|
||||||
#include <graphene/net/node.hpp>
|
#include <graphene/net/node.hpp>
|
||||||
|
|
||||||
#include <fc/api.hpp>
|
#include <fc/api.hpp>
|
||||||
|
|
@ -226,6 +227,13 @@ namespace graphene { namespace app {
|
||||||
|
|
||||||
/// @brief Get a hexdump of the serialized binary form of a transaction
|
/// @brief Get a hexdump of the serialized binary form of a transaction
|
||||||
std::string get_transaction_hex(const signed_transaction& trx)const;
|
std::string get_transaction_hex(const signed_transaction& trx)const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the set of proposed transactions relevant to the specified account id.
|
||||||
|
*/
|
||||||
|
vector<proposal_object> get_proposed_transactions( account_id_type id )const;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** called every time a block is applied to report the objects that were changed */
|
/** called every time a block is applied to report the objects that were changed */
|
||||||
void on_objects_changed(const vector<object_id_type>& ids);
|
void on_objects_changed(const vector<object_id_type>& ids);
|
||||||
|
|
@ -362,6 +370,7 @@ FC_API(graphene::app::database_api,
|
||||||
(unsubscribe_from_market)
|
(unsubscribe_from_market)
|
||||||
(cancel_all_subscriptions)
|
(cancel_all_subscriptions)
|
||||||
(get_transaction_hex)
|
(get_transaction_hex)
|
||||||
|
(get_proposed_transactions)
|
||||||
)
|
)
|
||||||
FC_API(graphene::app::history_api, (get_account_history))
|
FC_API(graphene::app::history_api, (get_account_history))
|
||||||
FC_API(graphene::app::network_api, (broadcast_transaction)(add_node)(get_connected_peers))
|
FC_API(graphene::app::network_api, (broadcast_transaction)(add_node)(get_connected_peers))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue