BitShares-Core  5.0.0
BitShares blockchain implementation and command-line interface software
database_api_impl.hxx
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Cryptonomex, Inc., and contributors.
3  *
4  * The MIT License
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22  * THE SOFTWARE.
23  */
24 
26 
27 #include <fc/bloom_filter.hpp>
28 
29 #define GET_REQUIRED_FEES_MAX_RECURSION 4
30 
31 namespace graphene { namespace app {
32 
33 typedef std::map< std::pair<graphene::chain::asset_id_type, graphene::chain::asset_id_type>,
34  std::vector<fc::variant> > market_queue_type;
35 
36 class database_api_impl : public std::enable_shared_from_this<database_api_impl>
37 {
38  public:
39  explicit database_api_impl( graphene::chain::database& db, const application_options* app_options );
40  virtual ~database_api_impl();
41 
42  // Objects
43  fc::variants get_objects( const vector<object_id_type>& ids, optional<bool> subscribe )const;
44 
45  // Subscriptions
46  void set_subscribe_callback( std::function<void(const variant&)> cb, bool notify_remove_create );
47  void set_auto_subscription( bool enable );
48  void set_pending_transaction_callback( std::function<void(const variant&)> cb );
49  void set_block_applied_callback( std::function<void(const variant& block_id)> cb );
50  void cancel_all_subscriptions(bool reset_callback, bool reset_market_subscriptions);
51 
52  // Blocks and transactions
53  optional<block_header> get_block_header(uint32_t block_num)const;
54  map<uint32_t, optional<block_header>> get_block_header_batch(const vector<uint32_t> block_nums)const;
55  optional<signed_block> get_block(uint32_t block_num)const;
56  processed_transaction get_transaction( uint32_t block_num, uint32_t trx_in_block )const;
57 
58  // Globals
64 
65  // Keys
66  vector<flat_set<account_id_type>> get_key_references( vector<public_key_type> key )const;
67  bool is_public_key_registered(string public_key) const;
68 
69  // Accounts
70  account_id_type get_account_id_from_string(const std::string& name_or_id)const;
71  vector<optional<account_object>> get_accounts( const vector<std::string>& account_names_or_ids,
72  optional<bool> subscribe )const;
73  std::map<string,full_account> get_full_accounts( const vector<string>& names_or_ids,
74  optional<bool> subscribe );
75  vector<account_statistics_object> get_top_voters(uint32_t limit)const;
76  optional<account_object> get_account_by_name( string name )const;
77  vector<account_id_type> get_account_references( const std::string account_id_or_name )const;
78  vector<optional<account_object>> lookup_account_names(const vector<string>& account_names)const;
79  map<string,account_id_type> lookup_accounts( const string& lower_bound_name,
80  uint32_t limit,
81  optional<bool> subscribe )const;
82  uint64_t get_account_count()const;
83 
84  // Balances
85  vector<asset> get_account_balances( const std::string& account_name_or_id,
86  const flat_set<asset_id_type>& assets )const;
87  vector<asset> get_named_account_balances(const std::string& name, const flat_set<asset_id_type>& assets)const;
88  vector<balance_object> get_balance_objects( const vector<address>& addrs )const;
89  vector<asset> get_vested_balances( const vector<balance_id_type>& objs )const;
90  vector<vesting_balance_object> get_vesting_balances( const std::string account_id_or_name )const;
91 
92  // Assets
93  uint64_t get_asset_count()const;
94  asset_id_type get_asset_id_from_string(const std::string& symbol_or_id)const;
95  vector<optional<extended_asset_object>> get_assets( const vector<std::string>& asset_symbols_or_ids,
96  optional<bool> subscribe )const;
97  vector<extended_asset_object> list_assets(const string& lower_bound_symbol, uint32_t limit)const;
98  vector<optional<extended_asset_object>> lookup_asset_symbols(const vector<string>& symbols_or_ids)const;
99  vector<extended_asset_object> get_assets_by_issuer(const std::string& issuer_name_or_id,
100  asset_id_type start, uint32_t limit)const;
101 
102  // Markets / feeds
103  vector<limit_order_object> get_limit_orders( const std::string& a, const std::string& b,
104  uint32_t limit)const;
105  vector<limit_order_object> get_limit_orders_by_account( const string& account_name_or_id,
106  optional<uint32_t> limit,
107  optional<limit_order_id_type> start_id );
108  vector<limit_order_object> get_account_limit_orders( const string& account_name_or_id,
109  const string &base,
110  const string &quote, uint32_t limit,
111  optional<limit_order_id_type> ostart_id,
112  optional<price> ostart_price );
113  vector<call_order_object> get_call_orders(const std::string& a, uint32_t limit)const;
114  vector<call_order_object> get_call_orders_by_account(const std::string& account_name_or_id,
115  asset_id_type start, uint32_t limit)const;
116  vector<force_settlement_object> get_settle_orders(const std::string& a, uint32_t limit)const;
117  vector<force_settlement_object> get_settle_orders_by_account(const std::string& account_name_or_id,
118  force_settlement_id_type start,
119  uint32_t limit)const;
120  vector<call_order_object> get_margin_positions( const std::string account_id_or_name )const;
121  vector<collateral_bid_object> get_collateral_bids( const std::string& asset,
122  uint32_t limit, uint32_t start)const;
123 
124  void subscribe_to_market( std::function<void(const variant&)> callback,
125  const std::string& a, const std::string& b );
126  void unsubscribe_from_market(const std::string& a, const std::string& b);
127 
128  market_ticker get_ticker( const string& base, const string& quote,
129  bool skip_order_book = false )const;
130  market_volume get_24_volume( const string& base, const string& quote )const;
131  order_book get_order_book( const string& base, const string& quote,
132  unsigned limit = 50 )const;
133  vector<market_ticker> get_top_markets( uint32_t limit )const;
134  vector<market_trade> get_trade_history( const string& base, const string& quote,
136  unsigned limit = 100 )const;
137  vector<market_trade> get_trade_history_by_sequence( const string& base, const string& quote,
138  int64_t start, fc::time_point_sec stop,
139  unsigned limit = 100 )const;
140 
141  // Liquidity pools
142  vector<liquidity_pool_object> get_liquidity_pools_by_asset_a(
143  std::string asset_symbol_or_id,
144  optional<uint32_t> limit = 101,
145  optional<liquidity_pool_id_type> start_id = optional<liquidity_pool_id_type>() )const;
146  vector<liquidity_pool_object> get_liquidity_pools_by_asset_b(
147  std::string asset_symbol_or_id,
148  optional<uint32_t> limit = 101,
149  optional<liquidity_pool_id_type> start_id = optional<liquidity_pool_id_type>() )const;
150  vector<liquidity_pool_object> get_liquidity_pools_by_both_assets(
151  std::string asset_symbol_or_id_a,
152  std::string asset_symbol_or_id_b,
153  optional<uint32_t> limit = 101,
154  optional<liquidity_pool_id_type> start_id = optional<liquidity_pool_id_type>() )const;
155  vector<optional<liquidity_pool_object>> get_liquidity_pools_by_share_asset(
156  const vector<std::string>& asset_symbols_or_ids,
157  optional<bool> subscribe = optional<bool>() )const;
158 
159  // Witnesses
160  vector<optional<witness_object>> get_witnesses(const vector<witness_id_type>& witness_ids)const;
161  fc::optional<witness_object> get_witness_by_account(const std::string account_id_or_name)const;
162  map<string, witness_id_type> lookup_witness_accounts(const string& lower_bound_name, uint32_t limit)const;
163  uint64_t get_witness_count()const;
164 
165  // Committee members
166  vector<optional<committee_member_object>> get_committee_members(
167  const vector<committee_member_id_type>& committee_member_ids )const;
169  const std::string account_id_or_name )const;
170  map<string, committee_member_id_type> lookup_committee_member_accounts(
171  const string& lower_bound_name, uint32_t limit )const;
172  uint64_t get_committee_count()const;
173 
174  // Workers
175  vector<worker_object> get_all_workers( const optional<bool> is_expired = optional<bool>() )const;
176  vector<worker_object> get_workers_by_account(const std::string account_id_or_name)const;
177  uint64_t get_worker_count()const;
178 
179  // Votes
180  vector<variant> lookup_vote_ids( const vector<vote_id_type>& votes )const;
181 
182  // Authority / validation
183  std::string get_transaction_hex(const signed_transaction& trx)const;
184  std::string get_transaction_hex_without_sig(const signed_transaction& trx)const;
185 
186  set<public_key_type> get_required_signatures( const signed_transaction& trx,
187  const flat_set<public_key_type>& available_keys )const;
188  set<public_key_type> get_potential_signatures( const signed_transaction& trx )const;
189  set<address> get_potential_address_signatures( const signed_transaction& trx )const;
190  bool verify_authority( const signed_transaction& trx )const;
191  bool verify_account_authority( const string& account_name_or_id,
192  const flat_set<public_key_type>& signers )const;
193  processed_transaction validate_transaction( const signed_transaction& trx )const;
194  vector< fc::variant > get_required_fees( const vector<operation>& ops,
195  const std::string& asset_id_or_symbol )const;
196 
197  // Proposed transactions
198  vector<proposal_object> get_proposed_transactions( const std::string account_id_or_name )const;
199 
200  // Blinded balances
201  vector<blinded_balance_object> get_blinded_balances( const flat_set<commitment_type>& commitments )const;
202 
203  // Withdrawals
204  vector<withdraw_permission_object> get_withdraw_permissions_by_giver( const std::string account_id_or_name,
205  withdraw_permission_id_type start,
206  uint32_t limit )const;
207  vector<withdraw_permission_object> get_withdraw_permissions_by_recipient( const std::string account_id_or_name,
208  withdraw_permission_id_type start,
209  uint32_t limit )const;
210 
211  // HTLC
212  optional<htlc_object> get_htlc( htlc_id_type id, optional<bool> subscribe ) const;
213  vector<htlc_object> get_htlc_by_from( const std::string account_id_or_name,
214  htlc_id_type start, uint32_t limit ) const;
215  vector<htlc_object> get_htlc_by_to( const std::string account_id_or_name,
216  htlc_id_type start, uint32_t limit) const;
217  vector<htlc_object> list_htlcs(const htlc_id_type lower_bound_id, uint32_t limit) const;
218 
219  //private:
220 
222  // Accounts
224 
225  const account_object* get_account_from_string( const std::string& name_or_id,
226  bool throw_if_not_found = true ) const;
227 
229  // Assets
231 
232  template<class ASSET>
234  {
235  asset_id_type id = a.id;
236  extended_asset_object result = extended_asset_object( std::forward<ASSET>( a ) );
238  {
240  if( result.bitasset_data_id.valid() )
242  }
243  return result;
244  }
245 
246  const asset_object* get_asset_from_string( const std::string& symbol_or_id,
247  bool throw_if_not_found = true ) const;
248  // helper function
249  vector<optional<extended_asset_object>> get_assets( const vector<asset_id_type>& asset_ids,
250  optional<bool> subscribe = optional<bool>() )const;
251 
253  // Markets
255 
256  // helper function
257  vector<limit_order_object> get_limit_orders( const asset_id_type a, const asset_id_type b,
258  const uint32_t limit )const;
259 
261  // Liquidity pools
263 
264  // template function to reduce duplicate code
265  template <typename X>
266  vector<liquidity_pool_object> get_liquidity_pools_by_asset_x(
267  std::string asset_symbol_or_id,
268  optional<uint32_t> olimit,
269  optional<liquidity_pool_id_type> ostart_id )const
270  {
271  uint32_t limit = olimit.valid() ? *olimit : 101;
272 
273  FC_ASSERT( _app_options, "Internal error" );
274  const auto configured_limit = _app_options->api_limit_get_liquidity_pools;
275  FC_ASSERT( limit <= configured_limit,
276  "limit can not be greater than ${configured_limit}",
277  ("configured_limit", configured_limit) );
278 
279  vector<liquidity_pool_object> results;
280 
281  const asset_id_type asset_id = get_asset_from_string(asset_symbol_or_id)->id;
282 
283  liquidity_pool_id_type start_id = ostart_id.valid() ? *ostart_id : liquidity_pool_id_type();
284 
285  const auto& idx = _db.get_index_type<liquidity_pool_index>().indices().get<X>();
286  auto lower_itr = idx.lower_bound( std::make_tuple( asset_id, start_id ) );
287  auto upper_itr = idx.upper_bound( asset_id );
288 
289  results.reserve( limit );
290  uint32_t count = 0;
291  for ( ; lower_itr != upper_itr && count < limit; ++lower_itr, ++count)
292  {
293  results.emplace_back( *lower_itr );
294  }
295 
296  return results;
297  }
298 
300  // Subscription
302 
303  // Decides whether to subscribe using member variables and given parameter
304  bool get_whether_to_subscribe( optional<bool> subscribe )const
305  {
306  if( !_subscribe_callback )
307  return false;
308  if( subscribe.valid() )
309  return *subscribe;
311  }
312 
313  // Note:
314  // Different type of object_id<T> objects could become identical after packed.
315  // For example, both `account_id_type a=1.2.0` and `asset_id_type b=1.3.0` will become `0` after packed.
316  // In order to avoid collision, we don't use a template function here, instead, we implicitly convert all
317  // object IDs to `object_id_type` when subscribing.
318  //
319  // If need to subscribe to other data types, override this function with the types as parameter.
320  // For example, we had a `get_subscription_key( const public_key_type& item )` function here, which was
321  // removed lately since we no longer subscribe to public keys.
322  vector<char> get_subscription_key( const object_id_type& item )const
323  {
324  return fc::raw::pack(item);
325  }
326 
327  template<typename T>
328  void subscribe_to_item( const T& item )const
329  {
330  if( !_subscribe_callback )
331  return;
332 
333  vector<char> key = get_subscription_key( item );
334  if( !_subscribe_filter.contains( key.data(), key.size() ) )
335  {
336  _subscribe_filter.insert( key.data(), key.size() );
337  }
338  }
339 
340  template<typename T>
341  bool is_subscribed_to_item( const T& item )const
342  {
343  if( !_subscribe_callback )
344  return false;
345 
346  vector<char> key = get_subscription_key( item );
347  return _subscribe_filter.contains( key.data(), key.size() );
348  }
349 
350  // for full-account subscription
351  bool is_impacted_account( const flat_set<account_id_type>& accounts );
352 
353  // for market subscription
354  template<typename T>
355  const std::pair<asset_id_type,asset_id_type> get_order_market( const T& order )
356  {
357  return order.get_market();
358  }
359 
360  // for market subscription
361  const std::pair<asset_id_type,asset_id_type> get_order_market( const force_settlement_object& order )
362  {
363  // TODO cache the result to avoid repeatly fetching from db
364  asset_id_type backing_id = order.balance.asset_id( _db ).bitasset_data( _db ).options.short_backing_asset;
365  auto tmp = std::make_pair( order.balance.asset_id, backing_id );
366  if( tmp.first > tmp.second ) std::swap( tmp.first, tmp.second );
367  return tmp;
368  }
369 
370  template<typename T>
371  void enqueue_if_subscribed_to_market(const object* obj, market_queue_type& queue, bool full_object=true)
372  {
373  const T* order = dynamic_cast<const T*>(obj);
374  FC_ASSERT( order != nullptr);
375 
376  const auto& market = get_order_market( *order );
377 
378  auto sub = _market_subscriptions.find( market );
379  if( sub != _market_subscriptions.end() ) {
380  queue[market].emplace_back( full_object ? obj->to_variant() : fc::variant(obj->id, 1) );
381  }
382  }
383 
384  void broadcast_updates( const vector<variant>& updates );
385  void broadcast_market_updates( const market_queue_type& queue);
386  void handle_object_changed( bool force_notify,
387  bool full_object,
388  const vector<object_id_type>& ids,
389  const flat_set<account_id_type>& impacted_accounts,
390  std::function<const object*(object_id_type id)> find_object );
391 
393  void on_objects_new(const vector<object_id_type>& ids, const flat_set<account_id_type>& impacted_accounts);
394  void on_objects_changed(const vector<object_id_type>& ids, const flat_set<account_id_type>& impacted_accounts);
395  void on_objects_removed(const vector<object_id_type>& ids, const vector<const object*>& objs,
396  const flat_set<account_id_type>& impacted_accounts);
397  void on_applied_block();
398 
400  // Member variables
402 
403  bool _notify_remove_create = false;
405 
407  std::set<account_id_type> _subscribed_accounts;
408 
409  std::function<void(const fc::variant&)> _subscribe_callback;
410  std::function<void(const fc::variant&)> _pending_trx_callback;
411  std::function<void(const fc::variant&)> _block_applied_callback;
412 
418 
419  map< pair<asset_id_type,asset_id_type>, std::function<void(const variant&)> > _market_subscriptions;
420 
423 
425 };
426 
427 } } // graphene::app
void insert(const unsigned char *key_begin, const std::size_t &length)
std::string get_transaction_hex_without_sig(const signed_transaction &trx) const
set< address > get_potential_address_signatures(const signed_transaction &trx) const
map< pair< asset_id_type, asset_id_type >, std::function< void(const variant &)> > _market_subscriptions
optional< signed_block > get_block(uint32_t block_num) const
void on_objects_changed(const vector< object_id_type > &ids, const flat_set< account_id_type > &impacted_accounts)
vector< liquidity_pool_object > get_liquidity_pools_by_both_assets(std::string asset_symbol_or_id_a, std::string asset_symbol_or_id_b, optional< uint32_t > limit=101, optional< liquidity_pool_id_type > start_id=optional< liquidity_pool_id_type >()) const
void set_subscribe_callback(std::function< void(const variant &)> cb, bool notify_remove_create)
vector< optional< committee_member_object > > get_committee_members(const vector< committee_member_id_type > &committee_member_ids) const
market_ticker get_ticker(const string &base, const string &quote, bool skip_order_book=false) const
processed_transaction get_transaction(uint32_t block_num, uint32_t trx_in_block) const
vector< worker_object > get_workers_by_account(const std::string account_id_or_name) const
void set_block_applied_callback(std::function< void(const variant &block_id)> cb)
set< public_key_type > get_potential_signatures(const signed_transaction &trx) const
optional< block_header > get_block_header(uint32_t block_num) const
const asset_object * get_asset_from_string(const std::string &symbol_or_id, bool throw_if_not_found=true) const
void pack(Stream &s, const flat_set< T, A... > &value, uint32_t _max_depth)
Definition: flat.hpp:11
bool verify_account_authority(const string &account_name_or_id, const flat_set< public_key_type > &signers) const
std::function< void(const fc::variant &)> _pending_trx_callback
bool is_public_key_registered(string public_key) const
boost::signals2::scoped_connection _change_connection
void set_auto_subscription(bool enable)
void subscribe_to_market(std::function< void(const variant &)> callback, const std::string &a, const std::string &b)
dynamic_global_property_object get_dynamic_global_properties() const
vector< withdraw_permission_object > get_withdraw_permissions_by_giver(const std::string account_id_or_name, withdraw_permission_id_type start, uint32_t limit) const
void unsubscribe_from_market(const std::string &a, const std::string &b)
This class represents an account on the object graphAccounts are the primary unit of authority on the...
bool is_impacted_account(const flat_set< account_id_type > &accounts)
Maintains global state information (committee_member list, current fees)This is an implementation det...
tracks the blockchain state in an extensible manner
Definition: database.hpp:70
An order-perserving dictionary of variant&#39;s.
Definition: api.cpp:56
void on_objects_removed(const vector< object_id_type > &ids, const vector< const object * > &objs, const flat_set< account_id_type > &impacted_accounts)
vector< balance_object > get_balance_objects(const vector< address > &addrs) const
const std::pair< asset_id_type, asset_id_type > get_order_market(const force_settlement_object &order)
vector< char > get_subscription_key(const object_id_type &item) const
database_api_impl(graphene::chain::database &db, const application_options *app_options)
std::vector< variant > variants
Definition: variant.hpp:170
void set_pending_transaction_callback(std::function< void(const variant &)> cb)
void broadcast_updates(const vector< variant > &updates)
bool valid() const
Definition: optional.hpp:186
std::function< void(const fc::variant &)> _block_applied_callback
vector< liquidity_pool_object > get_liquidity_pools_by_asset_x(std::string asset_symbol_or_id, optional< uint32_t > olimit, optional< liquidity_pool_id_type > ostart_id) const
vector< htlc_object > list_htlcs(const htlc_id_type lower_bound_id, uint32_t limit) const
asset_id_type get_asset_id_from_string(const std::string &symbol_or_id) const
boost::signals2::scoped_connection _pending_trx_connection
optional< share_type > total_backing_collateral
bool get_whether_to_subscribe(optional< bool > subscribe) const
vector< extended_asset_object > get_assets_by_issuer(const std::string &issuer_name_or_id, asset_id_type start, uint32_t limit) const
vector< limit_order_object > get_limit_orders(const std::string &a, const std::string &b, uint32_t limit) const
market_volume get_24_volume(const string &base, const string &quote) const
vector< optional< witness_object > > get_witnesses(const vector< witness_id_type > &witness_ids) const
provides stack-based nullable value similar to boost::optional
Definition: optional.hpp:20
void enqueue_if_subscribed_to_market(const object *obj, market_queue_type &queue, bool full_object=true)
vector< liquidity_pool_object > get_liquidity_pools_by_asset_b(std::string asset_symbol_or_id, optional< uint32_t > limit=101, optional< liquidity_pool_id_type > start_id=optional< liquidity_pool_id_type >()) const
vector< call_order_object > get_call_orders(const std::string &a, uint32_t limit) const
account_id_type get_account_id_from_string(const std::string &name_or_id) const
fc::optional< committee_member_object > get_committee_member_by_account(const std::string account_id_or_name) const
vector< htlc_object > get_htlc_by_to(const std::string account_id_or_name, htlc_id_type start, uint32_t limit) const
std::set< account_id_type > _subscribed_accounts
vector< worker_object > get_all_workers(const optional< bool > is_expired=optional< bool >()) const
chain_property_object get_chain_properties() const
vector< fc::variant > get_required_fees(const vector< operation > &ops, const std::string &asset_id_or_symbol) const
vector< market_trade > get_trade_history(const string &base, const string &quote, fc::time_point_sec start, fc::time_point_sec stop, unsigned limit=100) const
object_id_type id
Definition: object.hpp:69
vector< limit_order_object > get_account_limit_orders(const string &account_name_or_id, const string &base, const string &quote, uint32_t limit, optional< limit_order_id_type > ostart_id, optional< price > ostart_price)
void handle_object_changed(bool force_notify, bool full_object, const vector< object_id_type > &ids, const flat_set< account_id_type > &impacted_accounts, std::function< const object *(object_id_type id)> find_object)
contains only the public point of an elliptic curve key.
Definition: elliptic.hpp:35
fc::variants get_objects(const vector< object_id_type > &ids, optional< bool > subscribe) const
This secondary index tracks how much of each asset is locked up as collateral for MPAs...
std::map< string, full_account > get_full_accounts(const vector< string > &names_or_ids, optional< bool > subscribe)
optional< account_object > get_account_by_name(string name) const
std::function< void(const fc::variant &)> _subscribe_callback
tracks bitassets scheduled for force settlement at some point in the future.
virtual bool contains(const unsigned char *key_begin, const std::size_t length) const
vector< asset > get_account_balances(const std::string &account_name_or_id, const flat_set< asset_id_type > &assets) const
#define FC_ASSERT(TEST,...)
Checks a condition and throws an assert_exception if the test is FALSE.
Definition: exception.hpp:345
graphene::chain::database & _db
vector< optional< extended_asset_object > > lookup_asset_symbols(const vector< string > &symbols_or_ids) const
order_book get_order_book(const string &base, const string &quote, unsigned limit=50) const
chain_id_type get_chain_id() const
stores null, int64, uint64, double, bool, string, std::vector<variant>, and variant_object&#39;s.
Definition: variant.hpp:198
processed_transaction validate_transaction(const signed_transaction &trx) const
extended_asset_object extend_asset(ASSET &&a) const
optional< htlc_object > get_htlc(htlc_id_type id, optional< bool > subscribe) const
vector< call_order_object > get_margin_positions(const std::string account_id_or_name) const
vector< account_id_type > get_account_references(const std::string account_id_or_name) const
vector< flat_set< account_id_type > > get_key_references(vector< public_key_type > key) const
vector< account_statistics_object > get_top_voters(uint32_t limit) const
void subscribe_to_item(const T &item) const
vector< force_settlement_object > get_settle_orders_by_account(const std::string &account_name_or_id, force_settlement_id_type start, uint32_t limit) const
vector< asset > get_vested_balances(const vector< balance_id_type > &objs) const
std::string get_transaction_hex(const signed_transaction &trx) const
boost::signals2::scoped_connection _new_connection
vector< limit_order_object > get_limit_orders_by_account(const string &account_name_or_id, optional< uint32_t > limit, optional< limit_order_id_type > start_id)
boost::signals2::scoped_connection _applied_block_connection
std::map< std::pair< graphene::chain::asset_id_type, graphene::chain::asset_id_type >, std::vector< fc::variant > > market_queue_type
share_type get_amount_in_collateral(const asset_id_type &asset) const
vector< htlc_object > get_htlc_by_from(const std::string account_id_or_name, htlc_id_type start, uint32_t limit) const
fc::variant_object get_config() const
map< uint32_t, optional< block_header > > get_block_header_batch(const vector< uint32_t > block_nums) const
vector< proposal_object > get_proposed_transactions(const std::string account_id_or_name) const
void on_objects_new(const vector< object_id_type > &ids, const flat_set< account_id_type > &impacted_accounts)
tracks the parameters of an assetAll assets have a globally unique symbol name that controls how they...
vector< liquidity_pool_object > get_liquidity_pools_by_asset_a(std::string asset_symbol_or_id, optional< uint32_t > limit=101, optional< liquidity_pool_id_type > start_id=optional< liquidity_pool_id_type >()) const
const account_object * get_account_from_string(const std::string &name_or_id, bool throw_if_not_found=true) const
share_type get_backing_collateral(const asset_id_type &asset) const
void broadcast_market_updates(const market_queue_type &queue)
vector< force_settlement_object > get_settle_orders(const std::string &a, uint32_t limit) const
map< string, committee_member_id_type > lookup_committee_member_accounts(const string &lower_bound_name, uint32_t limit) const
vector< optional< liquidity_pool_object > > get_liquidity_pools_by_share_asset(const vector< std::string > &asset_symbols_or_ids, optional< bool > subscribe=optional< bool >()) const
const object & get(object_id_type id) const
Definition: index.hpp:111
asset_id_type asset_id
Definition: asset.hpp:39
bool verify_authority(const signed_transaction &trx) const
map< string, account_id_type > lookup_accounts(const string &lower_bound_name, uint32_t limit, optional< bool > subscribe) const
set< public_key_type > get_required_signatures(const signed_transaction &trx, const flat_set< public_key_type > &available_keys) const
vector< optional< account_object > > get_accounts(const vector< std::string > &account_names_or_ids, optional< bool > subscribe) const
bool is_subscribed_to_item(const T &item) const
map< string, witness_id_type > lookup_witness_accounts(const string &lower_bound_name, uint32_t limit) const
Maintains global state information (committee_member list, current fees)This is an implementation det...
const std::pair< asset_id_type, asset_id_type > get_order_market(const T &order)
optional< share_type > total_in_collateral
optional< asset_bitasset_data_id_type > bitasset_data_id
Extra data associated with BitAssets. This field is non-null if and only if is_market_issued() return...
boost::signals2::scoped_connection scoped_connection
Definition: signals.hpp:22
void cancel_all_subscriptions(bool reset_callback, bool reset_market_subscriptions)
vector< market_ticker > get_top_markets(uint32_t limit) const
vector< optional< account_object > > lookup_account_names(const vector< string > &account_names) const
vector< collateral_bid_object > get_collateral_bids(const std::string &asset, uint32_t limit, uint32_t start) const
vector< call_order_object > get_call_orders_by_account(const std::string &account_name_or_id, asset_id_type start, uint32_t limit) const
global_property_object get_global_properties() const
vector< vesting_balance_object > get_vesting_balances(const std::string account_id_or_name) const
vector< market_trade > get_trade_history_by_sequence(const string &base, const string &quote, int64_t start, fc::time_point_sec stop, unsigned limit=100) const
fc::optional< witness_object > get_witness_by_account(const std::string account_id_or_name) const
vector< blinded_balance_object > get_blinded_balances(const flat_set< commitment_type > &commitments) const
const application_options * _app_options
captures the result of evaluating the operations contained in the transaction
vector< asset > get_named_account_balances(const std::string &name, const flat_set< asset_id_type > &assets) const
vector< optional< extended_asset_object > > get_assets(const vector< std::string > &asset_symbols_or_ids, optional< bool > subscribe) const
const graphene::api_helper_indexes::amount_in_collateral_index * amount_in_collateral_index
vector< variant > lookup_vote_ids(const vector< vote_id_type > &votes) const
const IndexType & get_index_type() const
boost::signals2::scoped_connection _removed_connection
vector< withdraw_permission_object > get_withdraw_permissions_by_recipient(const std::string account_id_or_name, withdraw_permission_id_type start, uint32_t limit) const
vector< extended_asset_object > list_assets(const string &lower_bound_symbol, uint32_t limit) const