|
|
|
|
@ -235,6 +235,18 @@ class database_api_impl : public std::enable_shared_from_this<database_api_impl>
|
|
|
|
|
vector<offer_history_object> get_offer_history_by_item(const offer_history_id_type lower_id, const nft_id_type item, uint32_t limit) const;
|
|
|
|
|
vector<offer_history_object> get_offer_history_by_bidder(const offer_history_id_type lower_id, const account_id_type bidder_account_id, uint32_t limit) const;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t api_limit_get_lower_bound_symbol = 100;
|
|
|
|
|
uint32_t api_limit_get_limit_orders = 300;
|
|
|
|
|
uint32_t api_limit_get_limit_orders_by_account = 101;
|
|
|
|
|
uint32_t api_limit_get_order_book = 50;
|
|
|
|
|
uint32_t api_limit_all_offers_count = 100;
|
|
|
|
|
uint32_t api_limit_lookup_accounts = 1000;
|
|
|
|
|
uint32_t api_limit_lookup_witness_accounts = 1000;
|
|
|
|
|
uint32_t api_limit_lookup_committee_member_accounts = 1000;
|
|
|
|
|
uint32_t api_limit_get_trade_history = 100;
|
|
|
|
|
uint32_t api_limit_get_trade_history_by_sequence = 100;
|
|
|
|
|
|
|
|
|
|
// Account Role
|
|
|
|
|
vector<account_role_object> get_account_roles_by_owner(account_id_type owner) const;
|
|
|
|
|
|
|
|
|
|
@ -878,7 +890,9 @@ map<string,account_id_type> database_api::lookup_accounts(const string& lower_bo
|
|
|
|
|
|
|
|
|
|
map<string,account_id_type> database_api_impl::lookup_accounts(const string& lower_bound_name, uint32_t limit)const
|
|
|
|
|
{
|
|
|
|
|
FC_ASSERT( limit <= 1000 );
|
|
|
|
|
FC_ASSERT( limit <= api_limit_lookup_accounts,
|
|
|
|
|
"Number of querying accounts can not be greater than ${configured_limit}",
|
|
|
|
|
("configured_limit", api_limit_lookup_accounts) );
|
|
|
|
|
const auto& accounts_by_name = _db.get_index_type<account_index>().indices().get<by_name>();
|
|
|
|
|
map<string,account_id_type> result;
|
|
|
|
|
|
|
|
|
|
@ -1086,7 +1100,9 @@ vector<asset_object> database_api::list_assets(const string& lower_bound_symbol,
|
|
|
|
|
|
|
|
|
|
vector<asset_object> database_api_impl::list_assets(const string& lower_bound_symbol, uint32_t limit)const
|
|
|
|
|
{
|
|
|
|
|
FC_ASSERT( limit <= 100 );
|
|
|
|
|
FC_ASSERT( limit <= api_limit_get_lower_bound_symbol,
|
|
|
|
|
"Number of querying accounts can not be greater than ${configured_limit}",
|
|
|
|
|
("configured_limit", api_limit_get_lower_bound_symbol) );
|
|
|
|
|
const auto& assets_by_symbol = _db.get_index_type<asset_index>().indices().get<by_symbol>();
|
|
|
|
|
vector<asset_object> result;
|
|
|
|
|
result.reserve(limit);
|
|
|
|
|
@ -1536,7 +1552,9 @@ order_book database_api::get_order_book( const string& base, const string& quote
|
|
|
|
|
order_book database_api_impl::get_order_book( const string& base, const string& quote, unsigned limit )const
|
|
|
|
|
{
|
|
|
|
|
using boost::multiprecision::uint128_t;
|
|
|
|
|
FC_ASSERT( limit <= 50 );
|
|
|
|
|
FC_ASSERT( limit <= api_limit_get_order_book,
|
|
|
|
|
"Number of querying accounts can not be greater than ${configured_limit}",
|
|
|
|
|
("configured_limit", api_limit_get_order_book) );
|
|
|
|
|
|
|
|
|
|
order_book result;
|
|
|
|
|
result.base = base;
|
|
|
|
|
@ -1598,7 +1616,9 @@ vector<market_trade> database_api_impl::get_trade_history( const string& base,
|
|
|
|
|
fc::time_point_sec stop,
|
|
|
|
|
unsigned limit )const
|
|
|
|
|
{
|
|
|
|
|
FC_ASSERT( limit <= 100 );
|
|
|
|
|
FC_ASSERT( limit <= api_limit_get_trade_history,
|
|
|
|
|
"Number of querying accounts can not be greater than ${configured_limit}",
|
|
|
|
|
("configured_limit", api_limit_get_trade_history) );
|
|
|
|
|
|
|
|
|
|
auto assets = lookup_asset_symbols( {base, quote} );
|
|
|
|
|
FC_ASSERT( assets[0], "Invalid base asset symbol: ${s}", ("s",base) );
|
|
|
|
|
@ -1717,7 +1737,9 @@ map<string, witness_id_type> database_api::lookup_witness_accounts(const string&
|
|
|
|
|
|
|
|
|
|
map<string, witness_id_type> database_api_impl::lookup_witness_accounts(const string& lower_bound_name, uint32_t limit)const
|
|
|
|
|
{
|
|
|
|
|
FC_ASSERT( limit <= 1000 );
|
|
|
|
|
FC_ASSERT( limit <= api_limit_lookup_witness_accounts,
|
|
|
|
|
"Number of querying accounts can not be greater than ${configured_limit}",
|
|
|
|
|
("configured_limit", api_limit_lookup_witness_accounts) );
|
|
|
|
|
const auto& witnesses_by_id = _db.get_index_type<witness_index>().indices().get<by_id>();
|
|
|
|
|
|
|
|
|
|
// we want to order witnesses by account name, but that name is in the account object
|
|
|
|
|
@ -1793,7 +1815,9 @@ map<string, committee_member_id_type> database_api::lookup_committee_member_acco
|
|
|
|
|
|
|
|
|
|
map<string, committee_member_id_type> database_api_impl::lookup_committee_member_accounts(const string& lower_bound_name, uint32_t limit)const
|
|
|
|
|
{
|
|
|
|
|
FC_ASSERT( limit <= 1000 );
|
|
|
|
|
FC_ASSERT( limit <= api_limit_lookup_committee_member_accounts,
|
|
|
|
|
"Number of querying accounts can not be greater than ${configured_limit}",
|
|
|
|
|
("configured_limit", api_limit_lookup_committee_member_accounts) );
|
|
|
|
|
const auto& committee_members_by_id = _db.get_index_type<committee_member_index>().indices().get<by_id>();
|
|
|
|
|
|
|
|
|
|
// we want to order committee_members by account name, but that name is in the account object
|
|
|
|
|
@ -2913,7 +2937,9 @@ vector<offer_object> database_api::list_offers(const offer_id_type lower_id, uin
|
|
|
|
|
|
|
|
|
|
vector<offer_object> database_api_impl::list_offers(const offer_id_type lower_id, uint32_t limit) const
|
|
|
|
|
{
|
|
|
|
|
FC_ASSERT( limit <= 100 );
|
|
|
|
|
FC_ASSERT( limit <= api_limit_all_offers_count,
|
|
|
|
|
"Number of querying offers can not be greater than ${configured_limit}",
|
|
|
|
|
("configured_limit", api_limit_all_offers_count) );
|
|
|
|
|
const auto& offers_idx = _db.get_index_type<offer_index>().indices().get<by_id>();
|
|
|
|
|
vector<offer_object> result;
|
|
|
|
|
result.reserve(limit);
|
|
|
|
|
@ -2933,7 +2959,9 @@ vector<offer_object> database_api::list_sell_offers(const offer_id_type lower_id
|
|
|
|
|
|
|
|
|
|
vector<offer_object> database_api_impl::list_sell_offers(const offer_id_type lower_id, uint32_t limit) const
|
|
|
|
|
{
|
|
|
|
|
FC_ASSERT( limit <= 100 );
|
|
|
|
|
FC_ASSERT( limit <= api_limit_all_offers_count,
|
|
|
|
|
"Number of querying offers can not be greater than ${configured_limit}",
|
|
|
|
|
("configured_limit", api_limit_all_offers_count) );
|
|
|
|
|
const auto& offers_idx = _db.get_index_type<offer_index>().indices().get<by_id>();
|
|
|
|
|
vector<offer_object> result;
|
|
|
|
|
result.reserve(limit);
|
|
|
|
|
@ -2959,7 +2987,9 @@ vector<offer_object> database_api::list_buy_offers(const offer_id_type lower_id,
|
|
|
|
|
|
|
|
|
|
vector<offer_object> database_api_impl::list_buy_offers(const offer_id_type lower_id, uint32_t limit) const
|
|
|
|
|
{
|
|
|
|
|
FC_ASSERT( limit <= 100 );
|
|
|
|
|
FC_ASSERT( limit <= api_limit_all_offers_count,
|
|
|
|
|
"Number of querying offers can not be greater than ${configured_limit}",
|
|
|
|
|
("configured_limit", api_limit_all_offers_count) );
|
|
|
|
|
const auto& offers_idx = _db.get_index_type<offer_index>().indices().get<by_id>();
|
|
|
|
|
vector<offer_object> result;
|
|
|
|
|
result.reserve(limit);
|
|
|
|
|
@ -2986,7 +3016,9 @@ vector<offer_history_object> database_api::list_offer_history(const offer_histor
|
|
|
|
|
|
|
|
|
|
vector<offer_history_object> database_api_impl::list_offer_history(const offer_history_id_type lower_id, uint32_t limit) const
|
|
|
|
|
{
|
|
|
|
|
FC_ASSERT( limit <= 100 );
|
|
|
|
|
FC_ASSERT( limit <= api_limit_all_offers_count,
|
|
|
|
|
"Number of querying offers can not be greater than ${configured_limit}",
|
|
|
|
|
("configured_limit", api_limit_all_offers_count) );
|
|
|
|
|
const auto& oh_idx = _db.get_index_type<offer_history_index>().indices().get<by_id>();
|
|
|
|
|
vector<offer_history_object> result;
|
|
|
|
|
result.reserve(limit);
|
|
|
|
|
@ -3006,7 +3038,9 @@ vector<offer_object> database_api::get_offers_by_issuer(const offer_id_type lowe
|
|
|
|
|
|
|
|
|
|
vector<offer_object> database_api_impl::get_offers_by_issuer(const offer_id_type lower_id, const account_id_type issuer_account_id, uint32_t limit) const
|
|
|
|
|
{
|
|
|
|
|
FC_ASSERT( limit <= 100 );
|
|
|
|
|
FC_ASSERT( limit <= api_limit_all_offers_count,
|
|
|
|
|
"Number of querying offers can not be greater than ${configured_limit}",
|
|
|
|
|
("configured_limit", api_limit_all_offers_count) );
|
|
|
|
|
const auto& offers_idx = _db.get_index_type<offer_index>().indices().get<by_id>();
|
|
|
|
|
vector<offer_object> result;
|
|
|
|
|
result.reserve(limit);
|
|
|
|
|
@ -3030,7 +3064,9 @@ vector<offer_object> database_api::get_offers_by_item(const offer_id_type lower_
|
|
|
|
|
|
|
|
|
|
vector<offer_object> database_api_impl::get_offers_by_item(const offer_id_type lower_id, const nft_id_type item, uint32_t limit) const
|
|
|
|
|
{
|
|
|
|
|
FC_ASSERT( limit <= 100 );
|
|
|
|
|
FC_ASSERT( limit <= api_limit_all_offers_count,
|
|
|
|
|
"Number of querying offers can not be greater than ${configured_limit}",
|
|
|
|
|
("configured_limit", api_limit_all_offers_count) );
|
|
|
|
|
const auto& offers_idx = _db.get_index_type<offer_index>().indices().get<by_id>();
|
|
|
|
|
vector<offer_object> result;
|
|
|
|
|
result.reserve(limit);
|
|
|
|
|
@ -3065,7 +3101,9 @@ vector<offer_history_object> database_api::get_offer_history_by_bidder(const off
|
|
|
|
|
|
|
|
|
|
vector<offer_history_object> database_api_impl::get_offer_history_by_issuer(const offer_history_id_type lower_id, const account_id_type issuer_account_id, uint32_t limit) const
|
|
|
|
|
{
|
|
|
|
|
FC_ASSERT( limit <= 100 );
|
|
|
|
|
FC_ASSERT( limit <= api_limit_all_offers_count,
|
|
|
|
|
"Number of querying offers can not be greater than ${configured_limit}",
|
|
|
|
|
("configured_limit", api_limit_all_offers_count) );
|
|
|
|
|
const auto& oh_idx = _db.get_index_type<offer_history_index>().indices().get<by_id>();
|
|
|
|
|
vector<offer_history_object> result;
|
|
|
|
|
result.reserve(limit);
|
|
|
|
|
@ -3086,7 +3124,9 @@ vector<offer_history_object> database_api_impl::get_offer_history_by_issuer(cons
|
|
|
|
|
|
|
|
|
|
vector<offer_history_object> database_api_impl::get_offer_history_by_item(const offer_history_id_type lower_id, const nft_id_type item, uint32_t limit) const
|
|
|
|
|
{
|
|
|
|
|
FC_ASSERT( limit <= 100 );
|
|
|
|
|
FC_ASSERT( limit <= api_limit_all_offers_count,
|
|
|
|
|
"Number of querying offers can not be greater than ${configured_limit}",
|
|
|
|
|
("configured_limit", api_limit_all_offers_count) );
|
|
|
|
|
const auto& oh_idx = _db.get_index_type<offer_history_index>().indices().get<by_id>();
|
|
|
|
|
vector<offer_history_object> result;
|
|
|
|
|
result.reserve(limit);
|
|
|
|
|
@ -3108,7 +3148,9 @@ vector<offer_history_object> database_api_impl::get_offer_history_by_item(const
|
|
|
|
|
|
|
|
|
|
vector<offer_history_object> database_api_impl::get_offer_history_by_bidder(const offer_history_id_type lower_id, const account_id_type bidder_account_id, uint32_t limit) const
|
|
|
|
|
{
|
|
|
|
|
FC_ASSERT( limit <= 100 );
|
|
|
|
|
FC_ASSERT( limit <= api_limit_all_offers_count,
|
|
|
|
|
"Number of querying offers can not be greater than ${configured_limit}",
|
|
|
|
|
("configured_limit", api_limit_all_offers_count) );
|
|
|
|
|
const auto& oh_idx = _db.get_index_type<offer_history_index>().indices().get<by_id>();
|
|
|
|
|
vector<offer_history_object> result;
|
|
|
|
|
result.reserve(limit);
|
|
|
|
|
|