BitShares-Core  5.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  optional<object_id_type> mto_id;
112 
115  const fc::time_point_sec& now,
116  const asset_object& asset_base,
117  const asset_object& asset_quote,
118  const order_book& orders);
120  const asset_object& asset_base,
121  const asset_object& asset_quote);
122  };
123 
125  {
127  string base;
128  string quote;
129  string base_volume;
130  string quote_volume;
131  };
132 
134  {
135  int64_t sequence = 0;
137  string price;
138  string amount;
139  string value;
140  string type;
141  account_id_type side1_account_id = GRAPHENE_NULL_ACCOUNT;
142  account_id_type side2_account_id = GRAPHENE_NULL_ACCOUNT;
143  };
144 
146  {
148  explicit extended_asset_object( const asset_object& a ) : asset_object( a ) {}
149  explicit extended_asset_object( asset_object&& a ) : asset_object( std::move(a) ) {}
150 
153  };
154 
155 } }
156 
158  (balances) (vesting_balances) (limit_orders) (call_orders)
159  (settle_orders) (proposals) (assets) (withdraws_from) (withdraws_to) (htlcs_from) (htlcs_to)
160  )
161 
163  (account)
164  (statistics)
165  (registrar_name)
166  (referrer_name)
167  (lifetime_referrer_name)
168  (votes)
169  (cashback_balance)
170  (balances)
171  (vesting_balances)
172  (limit_orders)
173  (call_orders)
174  (settle_orders)
175  (proposals)
176  (assets)
177  (withdraws_from)
178  (withdraws_to)
179  (htlcs_from)
180  (htlcs_to)
181  (more_data_available)
182  )
183 
184 FC_REFLECT( graphene::app::order, (price)(quote)(base) );
185 FC_REFLECT( graphene::app::order_book, (base)(quote)(bids)(asks) );
187  (time)(base)(quote)(latest)(lowest_ask)(lowest_ask_base_size)(lowest_ask_quote_size)
188  (highest_bid)(highest_bid_base_size)(highest_bid_quote_size)(percent_change)(base_volume)(quote_volume)(mto_id) );
189 FC_REFLECT( graphene::app::market_volume, (time)(base)(quote)(base_volume)(quote_volume) );
190 FC_REFLECT( graphene::app::market_trade, (sequence)(date)(price)(amount)(value)(type)
191  (side1_account_id)(side2_account_id));
192 
194  (total_in_collateral)(total_backing_collateral) );
195 
196 
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< object_id_type > mto_id
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)