28 namespace graphene {
namespace wallet {
namespace detail {
55 ss << string(i.
id) <<
" ";
63 m[
"get_account_history"] = format_account_history;
64 m[
"get_relative_account_history"] = format_account_history;
66 m[
"get_account_history_by_operations"] = [
this](
const variant& result,
const fc::variants&) {
70 ss <<
"result_count : " << r.result_count <<
" \n";
75 ss << string(i.
id) <<
" ";
77 ss <<
" transaction_id : ";
88 vector<asset_object> asset_recs;
90 return get_asset(a.asset_id);
94 for(
unsigned i = 0; i < asset_recs.size(); ++i )
95 ss << asset_recs[i].amount_to_pretty_string(r[i]) <<
"\n";
100 m[
"list_account_balances"] = format_balances;
101 m[
"get_blind_balances"] = format_balances;
106 std::stringstream ss;
109 for(
const auto& out : r.outputs )
111 auto a =
get_asset( out.decrypted_memo.amount.asset_id );
112 ss << a.amount_to_pretty_string( out.decrypted_memo.amount ) <<
" to " << out.label
113 <<
"\n\t receipt: " << out.confirmation_receipt <<
"\n\n";
118 m[
"transfer_to_blind"] = format_blind_transfers;
119 m[
"blind_transfer"] = format_blind_transfers;
124 std::stringstream ss;
125 auto as =
get_asset( r.amount.asset_id );
126 ss << as.amount_to_pretty_string( r.amount ) <<
" " << r.from_label <<
" => "
127 << r.to_label <<
" " << r.memo <<
"\n";
134 std::stringstream ss;
136 <<
" " <<
"AMOUNT" <<
" " <<
"FROM" <<
" => " <<
"TO" <<
" " <<
"MEMO" <<
"\n";
137 ss <<
"====================================================================================\n";
138 for(
auto& r : records )
140 auto as =
get_asset( r.amount.asset_id );
142 <<
" " << as.amount_to_pretty_string( r.amount ) <<
" " << r.from_label <<
" => " << r.to_label
143 <<
" " << r.memo <<
"\n";
151 auto bids = orders.
bids;
152 auto asks = orders.asks;
153 std::stringstream ss;
154 std::stringstream sum_stream;
155 sum_stream <<
"Sum(" << orders.base <<
')';
158 const int spacing = 20;
160 auto prettify_num = [&ss](
double n )
162 if (abs( round( n ) - n ) < 0.00000000001 )
166 else if (n - floor(n) < 0.000001)
168 ss << setiosflags( ios::fixed ) << setprecision(10) << n;
172 ss << setiosflags( ios::fixed ) << setprecision(6) << n;
175 auto prettify_num_string = [&](
string& num_string )
181 ss << setprecision( 8 ) << setiosflags( ios::fixed ) << setiosflags( ios::left );
183 ss <<
' ' << setw( (spacing * 4) + 6 ) <<
"BUY ORDERS" <<
"SELL ORDERS\n"
184 <<
' ' << setw( spacing + 1 ) <<
"Price" << setw( spacing ) << orders.quote <<
' ' << setw( spacing )
185 << orders.base <<
' ' << setw( spacing ) << sum_stream.str()
186 <<
" " << setw( spacing + 1 ) <<
"Price" << setw( spacing ) << orders.quote <<
' ' << setw( spacing )
187 << orders.base <<
' ' << setw( spacing ) << sum_stream.str()
188 <<
"\n====================================================================================="
189 <<
"|=====================================================================================\n";
191 for (
unsigned int i = 0; i < bids.size() || i < asks.size() ; i++)
193 if ( i < bids.size() )
196 ss <<
' ' << setw( spacing );
197 prettify_num_string( bids[i].
price );
198 ss <<
' ' << setw( spacing );
199 prettify_num_string( bids[i].quote );
200 ss <<
' ' << setw( spacing );
201 prettify_num_string( bids[i].base );
202 ss <<
' ' << setw( spacing );
203 prettify_num( bid_sum );
208 ss << setw( (spacing * 4) + 5 ) <<
' ';
213 if ( i < asks.size() )
216 ss <<
' ' << setw( spacing );
217 prettify_num_string( asks[i].
price );
218 ss <<
' ' << setw( spacing );
219 prettify_num_string( asks[i].quote );
220 ss <<
' ' << setw( spacing );
221 prettify_num_string( asks[i].base );
222 ss <<
' ' << setw( spacing );
223 prettify_num( ask_sum );
230 <<
"Buy Total: " << bid_sum <<
' ' << orders.base << endl
231 <<
"Sell Total: " << ask_sum <<
' ' << orders.base << endl;
241 encapsulated << ENC_HEADER;
242 encapsulated << r.message <<
'\n';
243 encapsulated << ENC_META;
244 encapsulated <<
"account=" << r.meta.account <<
'\n';
245 encapsulated <<
"memokey=" << std::string( r.meta.memo_key ) <<
'\n';
246 encapsulated <<
"block=" << r.meta.block <<
'\n';
247 encapsulated <<
"timestamp=" << r.meta.time <<
'\n';
248 encapsulated << ENC_SIG;
249 encapsulated <<
fc::to_hex( (
const char*)r.signature->data(), r.signature->size() ) <<
'\n';
250 encapsulated << ENC_FOOTER;
252 return encapsulated.str();