BitShares-Core  4.0.0
BitShares blockchain implementation and command-line interface software
api_objects.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 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 #pragma once
25 
33 
36 
37 #include <fc/optional.hpp>
38 
39 namespace graphene { namespace app {
40  using namespace graphene::chain;
41  using namespace graphene::market_history;
42 
43  struct more_data
44  {
45  bool balances = false;
46  bool vesting_balances = false;
47  bool limit_orders = false;
48  bool call_orders = false;
49  bool settle_orders = false;
50  bool proposals = false;
51  bool assets = false;
52  bool withdraws_from = false;
53  bool withdraws_to = false;
54  bool htlcs_from = false;
55  bool htlcs_to = false;
56  };
57 
58  struct full_account
59  {
63  string referrer_name;
65  vector<variant> votes;
66  optional<vesting_balance_object> cashback_balance;
67  vector<account_balance_object> balances;
68  vector<vesting_balance_object> vesting_balances;
69  vector<limit_order_object> limit_orders;
70  vector<call_order_object> call_orders;
71  vector<force_settlement_object> settle_orders;
72  vector<proposal_object> proposals;
73  vector<asset_id_type> assets;
74  vector<withdraw_permission_object> withdraws_from;
75  vector<withdraw_permission_object> withdraws_to;
76  vector<htlc_object> htlcs_from;
77  vector<htlc_object> htlcs_to;
79  };
80 
81  struct order
82  {
83  string price;
84  string quote;
85  string base;
86  };
87 
88  struct order_book
89  {
90  string base;
91  string quote;
92  vector< order > bids;
93  vector< order > asks;
94  };
95 
97  {
99  string base;
100  string quote;
101  string latest;
102  string lowest_ask;
105  string highest_bid;
109  string base_volume;
110  string quote_volume;
111 
114  const fc::time_point_sec& now,
115  const asset_object& asset_base,
116  const asset_object& asset_quote,
117  const order_book& orders);
119  const asset_object& asset_base,
120  const asset_object& asset_quote);
121  };
122 
124  {
126  string base;
127  string quote;
128  string base_volume;
129  string quote_volume;
130  };
131 
133  {
134  int64_t sequence = 0;
136  string price;
137  string amount;
138  string value;
139  string type;
140  account_id_type side1_account_id = GRAPHENE_NULL_ACCOUNT;
141  account_id_type side2_account_id = GRAPHENE_NULL_ACCOUNT;
142  };
143 
145  {
147  explicit extended_asset_object( const asset_object& a ) : asset_object( a ) {}
148  explicit extended_asset_object( asset_object&& a ) : asset_object( std::move(a) ) {}
149 
152  };
153 
154 } }
155 
157  (balances) (vesting_balances) (limit_orders) (call_orders)
158  (settle_orders) (proposals) (assets) (withdraws_from) (withdraws_to) (htlcs_from) (htlcs_to)
159  )
160 
162  (account)
163  (statistics)
164  (registrar_name)
165  (referrer_name)
166  (lifetime_referrer_name)
167  (votes)
168  (cashback_balance)
169  (balances)
170  (vesting_balances)
171  (limit_orders)
172  (call_orders)
173  (settle_orders)
174  (proposals)
175  (assets)
176  (withdraws_from)
177  (withdraws_to)
178  (htlcs_from)
179  (htlcs_to)
180  (more_data_available)
181  )
182 
183 FC_REFLECT( graphene::app::order, (price)(quote)(base) );
184 FC_REFLECT( graphene::app::order_book, (base)(quote)(bids)(asks) );
186  (time)(base)(quote)(latest)(lowest_ask)(lowest_ask_base_size)(lowest_ask_quote_size)
187  (highest_bid)(highest_bid_base_size)(highest_bid_quote_size)(percent_change)(base_volume)(quote_volume) );
188 FC_REFLECT( graphene::app::market_volume, (time)(base)(quote)(base_volume)(quote_volume) );
189 FC_REFLECT( graphene::app::market_trade, (sequence)(date)(price)(amount)(value)(type)
190  (side1_account_id)(side2_account_id));
191 
193  (total_in_collateral)(total_backing_collateral) );
vector< proposal_object > proposals
Definition: api_objects.hpp:72
vector< vesting_balance_object > vesting_balances
Definition: api_objects.hpp:68
vector< call_order_object > call_orders
Definition: api_objects.hpp:70
vector< withdraw_permission_object > withdraws_to
Definition: api_objects.hpp:75
vector< account_balance_object > balances
Definition: api_objects.hpp:67
This class represents an account on the object graphAccounts are the primary unit of authority on the...
Definition: api.cpp:56
vector< htlc_object > htlcs_to
Definition: api_objects.hpp:77
fc::time_point_sec date
optional< vesting_balance_object > cashback_balance
Definition: api_objects.hpp:66
FC_REFLECT(graphene::app::more_data,(balances)(vesting_balances)(limit_orders)(call_orders)(settle_orders)(proposals)(assets)(withdraws_from)(withdraws_to)(htlcs_from)(htlcs_to)) FC_REFLECT(graphene FC_REFLECT(graphene::app::order_book,(base)(quote)(bids)(asks))
optional< share_type > total_backing_collateral
vector< force_settlement_object > settle_orders
Definition: api_objects.hpp:71
FC_REFLECT_DERIVED(graphene::app::extended_asset_object,(graphene::chain::asset_object),(total_in_collateral)(total_backing_collateral))
provides stack-based nullable value similar to boost::optional
Definition: optional.hpp:20
vector< variant > votes
Definition: api_objects.hpp:65
The price struct stores asset prices in the BitShares system.
Definition: asset.hpp:114
vector< asset_id_type > assets
Definition: api_objects.hpp:73
#define GRAPHENE_NULL_ACCOUNT
Represents the canonical account with NO authority (nobody can access funds in null account) ...
Definition: config.hpp:131
account_statistics_object statistics
Definition: api_objects.hpp:61
tracks the parameters of an assetAll assets have a globally unique symbol name that controls how they...
vector< limit_order_object > limit_orders
Definition: api_objects.hpp:69
optional< share_type > total_in_collateral
vector< htlc_object > htlcs_from
Definition: api_objects.hpp:76
vector< withdraw_permission_object > withdraws_from
Definition: api_objects.hpp:74
extended_asset_object(const asset_object &a)