BitShares-Core  7.0.2
BitShares blockchain node software and command-line wallet 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 
34 
37 
38 #include <fc/optional.hpp>
39 
40 namespace graphene { namespace app {
41  using namespace graphene::chain;
42  using namespace graphene::market_history;
43 
44  struct more_data
45  {
46  bool balances = false;
47  bool vesting_balances = false;
48  bool limit_orders = false;
49  bool call_orders = false;
50  bool settle_orders = false;
51  bool proposals = false;
52  bool assets = false;
53  bool withdraws_from = false;
54  bool withdraws_to = false;
55  bool htlcs_from = false;
56  bool htlcs_to = false;
57  };
58 
59  struct full_account
60  {
64  string referrer_name;
66  vector<variant> votes;
67  optional<vesting_balance_object> cashback_balance;
68  vector<account_balance_object> balances;
69  vector<vesting_balance_object> vesting_balances;
70  vector<limit_order_object> limit_orders;
71  vector<call_order_object> call_orders;
72  vector<force_settlement_object> settle_orders;
73  vector<proposal_object> proposals;
74  vector<asset_id_type> assets;
75  vector<withdraw_permission_object> withdraws_from;
76  vector<withdraw_permission_object> withdraws_to;
77  vector<htlc_object> htlcs_from;
78  vector<htlc_object> htlcs_to;
80  };
81 
82  struct order
83  {
84  string price;
85  string quote;
86  string base;
87  limit_order_id_type id;
88  account_id_type owner_id;
89  string owner_name;
90  time_point_sec expiration;
91 
92  order() = default;
93  order( const string& _price,
94  const string& _quote,
95  const string& _base,
96  const limit_order_id_type& _id,
97  const account_id_type& _oid,
98  const string& _oname,
99  const time_point_sec& _exp );
100  };
101 
102  struct order_book
103  {
104  string base;
105  string quote;
106  vector< order > bids;
107  vector< order > asks;
108  order_book() = default;
109  order_book( const string& _base, const string& _quote );
110  };
111 
113  {
115  string base;
116  string quote;
117  string latest;
118  string lowest_ask;
121  string highest_bid;
125  string base_volume;
126  string quote_volume;
128 
131  const fc::time_point_sec& now,
132  const asset_object& asset_base,
133  const asset_object& asset_quote,
134  const order_book& orders);
136  const asset_object& asset_base,
137  const asset_object& asset_quote);
138  };
139 
141  {
143  string base;
144  string quote;
145  string base_volume;
146  string quote_volume;
147  };
148 
150  {
151  int64_t sequence = 0;
153  string price;
154  string amount;
155  string value;
156  string type;
157  account_id_type side1_account_id = GRAPHENE_NULL_ACCOUNT;
158  account_id_type side2_account_id = GRAPHENE_NULL_ACCOUNT;
159  };
160 
162  {
164  explicit extended_asset_object( const asset_object& a ) : asset_object( a ) {}
165  explicit extended_asset_object( asset_object&& a ) : asset_object( std::move(a) ) {}
166 
169  };
170 
172  {
176 
177  optional<liquidity_pool_ticker_object> statistics;
178  };
179 
181  {
182  maybe_signed_block_header() = default;
183  explicit maybe_signed_block_header( const signed_block_header& bh, bool with_witness_signature = true );
184 
185  optional<signature_type> witness_signature;
186  };
187 
188 } }
189 
191  (balances) (vesting_balances) (limit_orders) (call_orders)
192  (settle_orders) (proposals) (assets) (withdraws_from) (withdraws_to) (htlcs_from) (htlcs_to)
193  )
194 
196  (account)
197  (statistics)
198  (registrar_name)
199  (referrer_name)
200  (lifetime_referrer_name)
201  (votes)
202  (cashback_balance)
203  (balances)
204  (vesting_balances)
205  (limit_orders)
206  (call_orders)
207  (settle_orders)
208  (proposals)
209  (assets)
210  (withdraws_from)
211  (withdraws_to)
212  (htlcs_from)
213  (htlcs_to)
214  (more_data_available)
215  )
216 
217 FC_REFLECT( graphene::app::order, (price)(quote)(base)(id)(owner_id)(owner_name)(expiration) )
218 FC_REFLECT( graphene::app::order_book, (base)(quote)(bids)(asks) )
220  (time)(base)(quote)(latest)(lowest_ask)(lowest_ask_base_size)(lowest_ask_quote_size)
221  (highest_bid)(highest_bid_base_size)(highest_bid_quote_size)(percent_change)(base_volume)(quote_volume)
222  (mto_id) )
223 FC_REFLECT( graphene::app::market_volume, (time)(base)(quote)(base_volume)(quote_volume) )
224 FC_REFLECT( graphene::app::market_trade, (sequence)(date)(price)(amount)(value)(type)
225  (side1_account_id)(side2_account_id) )
226 
228  (total_in_collateral)(total_backing_collateral) )
229 
231  (statistics) )
232 
234  (witness_signature) )
graphene::app::market_ticker::base_volume
string base_volume
Definition: api_objects.hpp:125
graphene::app::extended_asset_object::total_in_collateral
optional< share_type > total_in_collateral
Definition: api_objects.hpp:167
graphene::app::market_ticker::highest_bid
string highest_bid
Definition: api_objects.hpp:121
graphene::app::order
Definition: api_objects.hpp:82
graphene::app::market_ticker
Definition: api_objects.hpp:112
liquidity_pool_object.hpp
graphene::app::market_ticker::lowest_ask_quote_size
string lowest_ask_quote_size
Definition: api_objects.hpp:120
graphene::app::full_account::lifetime_referrer_name
string lifetime_referrer_name
Definition: api_objects.hpp:65
asset_object.hpp
graphene::app::extended_asset_object
Definition: api_objects.hpp:161
graphene::app::full_account::statistics
account_statistics_object statistics
Definition: api_objects.hpp:62
graphene::app::order_book::base
string base
Definition: api_objects.hpp:104
graphene::app::maybe_signed_block_header::witness_signature
optional< signature_type > witness_signature
Definition: api_objects.hpp:185
graphene::app::maybe_signed_block_header
Definition: api_objects.hpp:180
graphene::app::order_book::asks
vector< order > asks
Definition: api_objects.hpp:107
graphene::app::full_account::account
account_object account
Definition: api_objects.hpp:61
graphene::app::order::id
limit_order_id_type id
Definition: api_objects.hpp:87
graphene::app::market_ticker::base
string base
Definition: api_objects.hpp:115
market_history_plugin.hpp
graphene::app::extended_asset_object::extended_asset_object
extended_asset_object()
Definition: api_objects.hpp:163
graphene::app::market_volume::quote_volume
string quote_volume
Definition: api_objects.hpp:146
graphene::chain::asset_object
tracks the parameters of an asset
Definition: asset_object.hpp:75
graphene::app::market_trade::date
fc::time_point_sec date
Definition: api_objects.hpp:152
graphene::app::full_account::balances
vector< account_balance_object > balances
Definition: api_objects.hpp:68
graphene::app::extended_asset_object::total_backing_collateral
optional< share_type > total_backing_collateral
Definition: api_objects.hpp:168
graphene::app::full_account::limit_orders
vector< limit_order_object > limit_orders
Definition: api_objects.hpp:70
graphene::app::market_ticker::highest_bid_base_size
string highest_bid_base_size
Definition: api_objects.hpp:122
graphene::app::order_book::quote
string quote
Definition: api_objects.hpp:105
proposal_object.hpp
graphene::app::extended_liquidity_pool_object::extended_liquidity_pool_object
extended_liquidity_pool_object(const liquidity_pool_object &o)
Definition: api_objects.hpp:174
graphene::app::market_ticker::latest
string latest
Definition: api_objects.hpp:117
graphene::app::market_ticker::lowest_ask
string lowest_ask
Definition: api_objects.hpp:118
graphene::app::full_account::assets
vector< asset_id_type > assets
Definition: api_objects.hpp:74
graphene::app::full_account::vesting_balances
vector< vesting_balance_object > vesting_balances
Definition: api_objects.hpp:69
graphene::app::full_account::withdraws_from
vector< withdraw_permission_object > withdraws_from
Definition: api_objects.hpp:75
graphene::app::market_volume
Definition: api_objects.hpp:140
graphene::chain::account_statistics_object
Definition: account_object.hpp:46
graphene::app::full_account::withdraws_to
vector< withdraw_permission_object > withdraws_to
Definition: api_objects.hpp:76
graphene::app::market_trade::price
string price
Definition: api_objects.hpp:153
graphene::app::market_ticker::mto_id
optional< object_id_type > mto_id
Definition: api_objects.hpp:127
graphene::app::market_ticker::lowest_ask_base_size
string lowest_ask_base_size
Definition: api_objects.hpp:119
graphene::app::market_ticker::quote_volume
string quote_volume
Definition: api_objects.hpp:126
graphene::app::market_volume::time
time_point_sec time
Definition: api_objects.hpp:142
FC_REFLECT_DERIVED
#define FC_REFLECT_DERIVED(TYPE, INHERITS, MEMBERS)
Specializes fc::reflector for TYPE where type inherits other reflected classes.
Definition: reflect.hpp:305
graphene::chain::account_object
This class represents an account on the object graph.
Definition: account_object.hpp:180
graphene::app::full_account::referrer_name
string referrer_name
Definition: api_objects.hpp:64
fc::time_point_sec
Definition: time.hpp:74
account_object.hpp
graphene::app::order::expiration
time_point_sec expiration
Definition: api_objects.hpp:90
htlc_object.hpp
graphene::app::market_volume::base
string base
Definition: api_objects.hpp:143
vesting_balance_object.hpp
graphene::app::market_volume::quote
string quote
Definition: api_objects.hpp:144
graphene::app::market_ticker::quote
string quote
Definition: api_objects.hpp:116
graphene::app::order::price
string price
Definition: api_objects.hpp:84
graphene::app::full_account::htlcs_from
vector< htlc_object > htlcs_from
Definition: api_objects.hpp:77
graphene::app::full_account::cashback_balance
optional< vesting_balance_object > cashback_balance
Definition: api_objects.hpp:67
graphene::app::full_account::votes
vector< variant > votes
Definition: api_objects.hpp:66
graphene::app::extended_liquidity_pool_object::statistics
optional< liquidity_pool_ticker_object > statistics
Definition: api_objects.hpp:177
graphene::app::order_book
Definition: api_objects.hpp:102
api_helper_indexes.hpp
graphene::app::extended_liquidity_pool_object
Definition: api_objects.hpp:171
graphene::app::market_ticker::time
time_point_sec time
Definition: api_objects.hpp:114
graphene::app::extended_asset_object::extended_asset_object
extended_asset_object(asset_object &&a)
Definition: api_objects.hpp:165
graphene::app::extended_liquidity_pool_object::extended_liquidity_pool_object
extended_liquidity_pool_object(liquidity_pool_object &&o)
Definition: api_objects.hpp:175
graphene::app::market_trade
Definition: api_objects.hpp:149
graphene::market_history
Definition: market_history_plugin.hpp:35
graphene::chain::liquidity_pool_object
A liquidity pool.
Definition: liquidity_pool_object.hpp:44
graphene::app::full_account::proposals
vector< proposal_object > proposals
Definition: api_objects.hpp:73
graphene::protocol::signed_block_header
Definition: block.hpp:47
std
Definition: zeroed_array.hpp:76
graphene::app::order::owner_id
account_id_type owner_id
Definition: api_objects.hpp:88
graphene::app::market_trade::amount
string amount
Definition: api_objects.hpp:154
graphene::app::full_account::htlcs_to
vector< htlc_object > htlcs_to
Definition: api_objects.hpp:78
graphene::app::more_data
Definition: api_objects.hpp:44
FC_REFLECT
#define FC_REFLECT(TYPE, MEMBERS)
Specializes fc::reflector for TYPE.
Definition: reflect.hpp:388
graphene::app::market_volume::base_volume
string base_volume
Definition: api_objects.hpp:145
graphene::app::order::owner_name
string owner_name
Definition: api_objects.hpp:89
GRAPHENE_NULL_ACCOUNT
#define GRAPHENE_NULL_ACCOUNT
Represents the canonical account with NO authority (nobody can access funds in null account)
Definition: config.hpp:146
fc::optional
provides stack-based nullable value similar to boost::optional
Definition: optional.hpp:20
graphene::app::market_trade::value
string value
Definition: api_objects.hpp:155
graphene::app::order::base
string base
Definition: api_objects.hpp:86
graphene::app::market_ticker::market_ticker
market_ticker()
Definition: api_objects.hpp:129
graphene::app::extended_asset_object::extended_asset_object
extended_asset_object(const asset_object &a)
Definition: api_objects.hpp:164
graphene::app::order_book::bids
vector< order > bids
Definition: api_objects.hpp:106
graphene::app::extended_liquidity_pool_object::extended_liquidity_pool_object
extended_liquidity_pool_object()
Definition: api_objects.hpp:173
graphene::app::market_trade::type
string type
Definition: api_objects.hpp:156
market_object.hpp
graphene::app::full_account::settle_orders
vector< force_settlement_object > settle_orders
Definition: api_objects.hpp:72
withdraw_permission_object.hpp
graphene::app::order::quote
string quote
Definition: api_objects.hpp:85
graphene::chain
Definition: util.hpp:32
graphene::app::market_ticker::highest_bid_quote_size
string highest_bid_quote_size
Definition: api_objects.hpp:123
graphene::app::full_account
Definition: api_objects.hpp:59
graphene
Definition: api.cpp:48
graphene::market_history::market_ticker_object
Definition: market_history_plugin.hpp:138
graphene::app::market_ticker::percent_change
string percent_change
Definition: api_objects.hpp:124
graphene::app::full_account::more_data_available
more_data more_data_available
Definition: api_objects.hpp:79
graphene::app::full_account::registrar_name
string registrar_name
Definition: api_objects.hpp:63
optional.hpp
graphene::protocol::block_header
Definition: block.hpp:29
graphene::app::full_account::call_orders
vector< call_order_object > call_orders
Definition: api_objects.hpp:71