added list of assets created by account output to get_full_accounts api function

This commit is contained in:
alfredo 2017-02-02 18:20:21 -03:00
parent c8f1d20850
commit 9ea386aa10
3 changed files with 13 additions and 0 deletions

View file

@ -600,6 +600,15 @@ std::map<std::string, full_account> database_api_impl::get_full_accounts( const
[&acnt] (const call_order_object& call) { [&acnt] (const call_order_object& call) {
acnt.call_orders.emplace_back(call); acnt.call_orders.emplace_back(call);
}); });
// get assets issued by user
auto asset_range = _db.get_index_type<asset_index>().indices().get<by_issuer>().equal_range(account->id);
std::for_each(asset_range.first, asset_range.second,
[&acnt] (const asset_object& asset) {
acnt.assets.emplace_back(asset.id);
});
results[account_name_or_id] = acnt; results[account_name_or_id] = acnt;
} }
return results; return results;

View file

@ -44,6 +44,7 @@ namespace graphene { namespace app {
vector<limit_order_object> limit_orders; vector<limit_order_object> limit_orders;
vector<call_order_object> call_orders; vector<call_order_object> call_orders;
vector<proposal_object> proposals; vector<proposal_object> proposals;
vector<asset_id_type> assets;
}; };
} } } }
@ -61,4 +62,5 @@ FC_REFLECT( graphene::app::full_account,
(limit_orders) (limit_orders)
(call_orders) (call_orders)
(proposals) (proposals)
(assets)
) )

View file

@ -232,11 +232,13 @@ namespace graphene { namespace chain {
struct by_symbol; struct by_symbol;
struct by_type; struct by_type;
struct by_issuer;
typedef multi_index_container< typedef multi_index_container<
asset_object, asset_object,
indexed_by< indexed_by<
ordered_unique< tag<by_id>, member< object, object_id_type, &object::id > >, ordered_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
ordered_unique< tag<by_symbol>, member<asset_object, string, &asset_object::symbol> >, ordered_unique< tag<by_symbol>, member<asset_object, string, &asset_object::symbol> >,
ordered_non_unique< tag<by_issuer>, member<asset_object, account_id_type, &asset_object::issuer > >,
ordered_unique< tag<by_type>, ordered_unique< tag<by_type>,
composite_key< asset_object, composite_key< asset_object,
const_mem_fun<asset_object, bool, &asset_object::is_market_issued>, const_mem_fun<asset_object, bool, &asset_object::is_market_issued>,