From 9ea386aa109a82195027723501db9e227e937bbd Mon Sep 17 00:00:00 2001 From: alfredo Date: Thu, 2 Feb 2017 18:20:21 -0300 Subject: [PATCH] added list of assets created by account output to get_full_accounts api function --- libraries/app/database_api.cpp | 9 +++++++++ libraries/app/include/graphene/app/full_account.hpp | 2 ++ libraries/chain/include/graphene/chain/asset_object.hpp | 2 ++ 3 files changed, 13 insertions(+) diff --git a/libraries/app/database_api.cpp b/libraries/app/database_api.cpp index f316d4f5..153a4672 100644 --- a/libraries/app/database_api.cpp +++ b/libraries/app/database_api.cpp @@ -600,6 +600,15 @@ std::map database_api_impl::get_full_accounts( const [&acnt] (const call_order_object& call) { acnt.call_orders.emplace_back(call); }); + + // get assets issued by user + auto asset_range = _db.get_index_type().indices().get().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; } return results; diff --git a/libraries/app/include/graphene/app/full_account.hpp b/libraries/app/include/graphene/app/full_account.hpp index 74724630..278df7a1 100644 --- a/libraries/app/include/graphene/app/full_account.hpp +++ b/libraries/app/include/graphene/app/full_account.hpp @@ -44,6 +44,7 @@ namespace graphene { namespace app { vector limit_orders; vector call_orders; vector proposals; + vector assets; }; } } @@ -61,4 +62,5 @@ FC_REFLECT( graphene::app::full_account, (limit_orders) (call_orders) (proposals) + (assets) ) diff --git a/libraries/chain/include/graphene/chain/asset_object.hpp b/libraries/chain/include/graphene/chain/asset_object.hpp index 28d5974e..d93993fe 100644 --- a/libraries/chain/include/graphene/chain/asset_object.hpp +++ b/libraries/chain/include/graphene/chain/asset_object.hpp @@ -232,11 +232,13 @@ namespace graphene { namespace chain { struct by_symbol; struct by_type; + struct by_issuer; typedef multi_index_container< asset_object, indexed_by< ordered_unique< tag, member< object, object_id_type, &object::id > >, ordered_unique< tag, member >, + ordered_non_unique< tag, member >, ordered_unique< tag, composite_key< asset_object, const_mem_fun,