#85 adding api call get_keys_for_address
This commit is contained in:
parent
c4b2bb443b
commit
23a633bea1
2 changed files with 24 additions and 0 deletions
|
|
@ -515,5 +515,23 @@ namespace graphene { namespace app {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return all key_ids that have been registered for a given address.
|
||||||
|
*/
|
||||||
|
vector<key_id_type> database_api::get_keys_for_address( const address& a )const
|
||||||
|
{ try {
|
||||||
|
vector<key_id_type> result;
|
||||||
|
const auto& idx = _db.get_index_type<key_index>();
|
||||||
|
const auto& aidx = idx.indices().get<by_address>();
|
||||||
|
auto itr = aidx.find(a);
|
||||||
|
|
||||||
|
while( itr != aidx.end() && itr->key_address() == a )
|
||||||
|
{
|
||||||
|
result.push_back( itr->id );
|
||||||
|
++itr;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
} FC_CAPTURE_AND_RETHROW( (a) ) }
|
||||||
|
|
||||||
|
|
||||||
} } // graphene::app
|
} } // graphene::app
|
||||||
|
|
|
||||||
|
|
@ -242,6 +242,11 @@ namespace graphene { namespace app {
|
||||||
*/
|
*/
|
||||||
vector<account_id_type> get_account_references( object_id_type key_or_account_id )const;
|
vector<account_id_type> get_account_references( object_id_type key_or_account_id )const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return all key_ids that have been registered for a given address.
|
||||||
|
*/
|
||||||
|
vector<key_id_type> get_keys_for_address( const address& a )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);
|
||||||
|
|
@ -383,6 +388,7 @@ FC_API(graphene::app::database_api,
|
||||||
(get_transaction_hex)
|
(get_transaction_hex)
|
||||||
(get_proposed_transactions)
|
(get_proposed_transactions)
|
||||||
(get_account_references)
|
(get_account_references)
|
||||||
|
(get_keys_for_address)
|
||||||
)
|
)
|
||||||
FC_API(graphene::app::history_api, (get_account_history)(get_market_history)(get_market_history_buckets))
|
FC_API(graphene::app::history_api, (get_account_history)(get_market_history)(get_market_history_buckets))
|
||||||
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