Electroneum
cryptonote::json Namespace Reference

Classes

struct  BAD_INPUT
 
struct  JSON_ERROR
 
struct  MISSING_KEY
 
struct  PARSE_FAIL
 
struct  WRONG_TYPE
 

Functions

void toJsonValue (rapidjson::Document &doc, const std::string &i, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, std::string &str)
 
void toJsonValue (rapidjson::Document &doc, bool i, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, bool &b)
 
void fromJsonValue (const rapidjson::Value &val, unsigned char &i)
 
void fromJsonValue (const rapidjson::Value &val, char &i)
 
void fromJsonValue (const rapidjson::Value &val, signed char &i)
 
void fromJsonValue (const rapidjson::Value &val, unsigned short &i)
 
void fromJsonValue (const rapidjson::Value &val, short &i)
 
void toJsonValue (rapidjson::Document &doc, const unsigned int i, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, unsigned int &i)
 
void toJsonValue (rapidjson::Document &doc, const unsigned long long i, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, unsigned long long &i)
 
void toJsonValue (rapidjson::Document &doc, const long long i, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, long long &i)
 
void fromJsonValue (const rapidjson::Value &val, unsigned long &i)
 
void fromJsonValue (const rapidjson::Value &val, long &i)
 
void toJsonValue (rapidjson::Document &doc, const cryptonote::transaction &tx, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, cryptonote::transaction &tx)
 
void toJsonValue (rapidjson::Document &doc, const cryptonote::block &b, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, cryptonote::block &b)
 
void toJsonValue (rapidjson::Document &doc, const cryptonote::txin_v &txin, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, cryptonote::txin_v &txin)
 
void toJsonValue (rapidjson::Document &doc, const cryptonote::txin_gen &txin, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, cryptonote::txin_gen &txin)
 
void toJsonValue (rapidjson::Document &doc, const cryptonote::txin_to_script &txin, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, cryptonote::txin_to_script &txin)
 
void toJsonValue (rapidjson::Document &doc, const cryptonote::txin_to_scripthash &txin, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, cryptonote::txin_to_scripthash &txin)
 
void toJsonValue (rapidjson::Document &doc, const cryptonote::txin_to_key &txin, rapidjson::Value &val)
 
void toJsonValue (rapidjson::Document &doc, const cryptonote::txin_to_key_public &txin, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, cryptonote::txin_to_key &txin)
 
void fromJsonValue (const rapidjson::Value &val, cryptonote::txin_to_key_public &txin)
 
void toJsonValue (rapidjson::Document &doc, const cryptonote::txout_to_script &txout, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, cryptonote::txout_to_script &txout)
 
void toJsonValue (rapidjson::Document &doc, const cryptonote::txout_to_scripthash &txout, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, cryptonote::txout_to_scripthash &txout)
 
void toJsonValue (rapidjson::Document &doc, const cryptonote::txout_to_key &txout, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, cryptonote::txout_to_key_public &txout)
 
void toJsonValue (rapidjson::Document &doc, const cryptonote::txout_to_key_public &txout, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, cryptonote::txout_to_key &txout)
 
void toJsonValue (rapidjson::Document &doc, const cryptonote::tx_out &txout, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, cryptonote::tx_out &txout)
 
void toJsonValue (rapidjson::Document &doc, const cryptonote::connection_info &info, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, cryptonote::connection_info &info)
 
void toJsonValue (rapidjson::Document &doc, const cryptonote::block_complete_entry &blk, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, cryptonote::block_complete_entry &blk)
 
void toJsonValue (rapidjson::Document &doc, const cryptonote::rpc::block_with_transactions &blk, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, cryptonote::rpc::block_with_transactions &blk)
 
void toJsonValue (rapidjson::Document &doc, const cryptonote::rpc::transaction_info &tx_info, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, cryptonote::rpc::transaction_info &tx_info)
 
void toJsonValue (rapidjson::Document &doc, const cryptonote::rpc::output_key_and_amount_index &out, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, cryptonote::rpc::output_key_and_amount_index &out)
 
void toJsonValue (rapidjson::Document &doc, const cryptonote::rpc::amount_with_random_outputs &out, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, cryptonote::rpc::amount_with_random_outputs &out)
 
void toJsonValue (rapidjson::Document &doc, const cryptonote::rpc::peer &peer, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, cryptonote::rpc::peer &peer)
 
void toJsonValue (rapidjson::Document &doc, const cryptonote::rpc::tx_in_pool &tx, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, cryptonote::rpc::tx_in_pool &tx)
 
void toJsonValue (rapidjson::Document &doc, const cryptonote::rpc::hard_fork_info &info, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, cryptonote::rpc::hard_fork_info &info)
 
void toJsonValue (rapidjson::Document &doc, const cryptonote::rpc::output_amount_count &out, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, cryptonote::rpc::output_amount_count &out)
 
void toJsonValue (rapidjson::Document &doc, const cryptonote::rpc::output_amount_and_index &out, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, cryptonote::rpc::output_amount_and_index &out)
 
void toJsonValue (rapidjson::Document &doc, const cryptonote::rpc::output_key_mask_unlocked &out, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, cryptonote::rpc::output_key_mask_unlocked &out)
 
void toJsonValue (rapidjson::Document &doc, const cryptonote::rpc::error &err, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, cryptonote::rpc::error &error)
 
void toJsonValue (rapidjson::Document &doc, const cryptonote::rpc::BlockHeaderResponse &response, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, cryptonote::rpc::BlockHeaderResponse &response)
 
void toJsonValue (rapidjson::Document &doc, const rct::rctSig &sig, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, rct::rctSig &sig)
 
void toJsonValue (rapidjson::Document &doc, const rct::ecdhTuple &tuple, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, rct::ecdhTuple &tuple)
 
void toJsonValue (rapidjson::Document &doc, const rct::rangeSig &sig, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, rct::rangeSig &sig)
 
void toJsonValue (rapidjson::Document &doc, const rct::Bulletproof &p, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, rct::Bulletproof &p)
 
void toJsonValue (rapidjson::Document &doc, const rct::boroSig &sig, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, rct::boroSig &sig)
 
void toJsonValue (rapidjson::Document &doc, const rct::mgSig &sig, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, rct::mgSig &sig)
 
void toJsonValue (rapidjson::Document &doc, const cryptonote::rpc::DaemonInfo &info, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, cryptonote::rpc::DaemonInfo &info)
 
void toJsonValue (rapidjson::Document &doc, const cryptonote::rpc::output_distribution &dist, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, cryptonote::rpc::output_distribution &dist)
 
template<typename Type >
constexpr bool is_to_hex ()
 
template<class Type >
std::enable_if< is_to_hex< Type >)>::type toJsonValue (rapidjson::Document &doc, const Type &pod, rapidjson::Value &value)
 
template<class Type >
std::enable_if< is_to_hex< Type >)>::type fromJsonValue (const rapidjson::Value &val, Type &t)
 
void toJsonValue (rapidjson::Document &doc, const unsigned i, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, unsigned &i)
 
void toJsonValue (rapidjson::Document &doc, const unsigned long i, rapidjson::Value &val)
 
void toJsonValue (rapidjson::Document &doc, const long i, rapidjson::Value &val)
 
void toJsonValue (rapidjson::Document &doc, const cryptonote::txout_target_v &txout, rapidjson::Value &val)
 
void fromJsonValue (const rapidjson::Value &val, cryptonote::txout_target_v &txout)
 
template<typename Map >
std::enable_if< sfinae::is_map_like< Map >::value, void >::type toJsonValue (rapidjson::Document &doc, const Map &map, rapidjson::Value &val)
 
template<typename Map >
std::enable_if< sfinae::is_map_like< Map >::value, void >::type fromJsonValue (const rapidjson::Value &val, Map &map)
 
template<typename Vec >
std::enable_if< sfinae::is_vector_like< Vec >::value, void >::type toJsonValue (rapidjson::Document &doc, const Vec &vec, rapidjson::Value &val)
 
template<typename Vec >
std::enable_if< sfinae::is_vector_like< Vec >::value, void >::type fromJsonValue (const rapidjson::Value &val, Vec &vec)
 

Function Documentation

◆ fromJsonValue() [1/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
std::string &  str 
)

Definition at line 117 of file json_object.cpp.

118 {
119  if (!val.IsString())
120  {
121  throw WRONG_TYPE("string");
122  }
123 
124  str = val.GetString();
125 }
Here is the caller graph for this function:

◆ fromJsonValue() [2/52]

template<class Type >
std::enable_if<is_to_hex<Type>)>::type cryptonote::json::fromJsonValue ( const rapidjson::Value val,
Type t 
)

Definition at line 126 of file json_object.h.

127 {
128  if (!val.IsString())
129  {
130  throw WRONG_TYPE("string");
131  }
132 
133  //TODO: handle failure to convert hex string to POD type
134  bool success = epee::string_tools::hex_to_pod(val.GetString(), t);
135 
136  if (!success)
137  {
138  throw BAD_INPUT();
139  }
140 }
bool hex_to_pod(const std::string &hex_str, t_pod_type &s)
Definition: string_tools.h:324
expect< void > success() noexcept
Definition: expect.h:397
Here is the call graph for this function:

◆ fromJsonValue() [3/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
bool b 
)

Definition at line 132 of file json_object.cpp.

133 {
134  if (!val.IsBool())
135  {
136  throw WRONG_TYPE("boolean");
137  }
138  b = val.GetBool();
139 }

◆ fromJsonValue() [4/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
unsigned char &  i 
)

Definition at line 141 of file json_object.cpp.

142 {
143  to_uint(val, i);
144 }

◆ fromJsonValue() [5/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
char &  i 
)

Definition at line 146 of file json_object.cpp.

147 {
148  to_int(val, i);
149 }

◆ fromJsonValue() [6/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
signed char &  i 
)

Definition at line 151 of file json_object.cpp.

152 {
153  to_int(val, i);
154 }

◆ fromJsonValue() [7/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
unsigned short &  i 
)

Definition at line 156 of file json_object.cpp.

157 {
158  to_uint(val, i);
159 }

◆ fromJsonValue() [8/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
short &  i 
)

Definition at line 161 of file json_object.cpp.

162 {
163  to_int(val, i);
164 }

◆ fromJsonValue() [9/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
unsigned &  i 
)

◆ fromJsonValue() [10/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
unsigned int &  i 
)

Definition at line 171 of file json_object.cpp.

172 {
173  to_uint(val, i);
174 }

◆ fromJsonValue() [11/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
unsigned long long &  i 
)

Definition at line 192 of file json_object.cpp.

193 {
194  to_uint64(val, i);
195 }

◆ fromJsonValue() [12/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
long long &  i 
)

Definition at line 203 of file json_object.cpp.

204 {
205  to_int64(val, i);
206 }

◆ fromJsonValue() [13/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
unsigned long &  i 
)

Definition at line 208 of file json_object.cpp.

209 {
210  to_uint64(val, i);
211 }

◆ fromJsonValue() [14/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
cryptonote::txout_target_v txout 
)

◆ fromJsonValue() [15/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
long &  i 
)

Definition at line 213 of file json_object.cpp.

214 {
215  to_int64(val, i);
216 }

◆ fromJsonValue() [16/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
cryptonote::transaction tx 
)

Definition at line 232 of file json_object.cpp.

233 {
234  if (!val.IsObject())
235  {
236  throw WRONG_TYPE("json object");
237  }
238 
240  GET_FROM_JSON_OBJECT(val, tx.unlock_time, unlock_time);
241  GET_FROM_JSON_OBJECT(val, tx.vin, inputs);
242  GET_FROM_JSON_OBJECT(val, tx.vout, outputs);
243  GET_FROM_JSON_OBJECT(val, tx.extra, extra);
244  GET_FROM_JSON_OBJECT(val, tx.signatures, signatures);
245  GET_FROM_JSON_OBJECT(val, tx.rct_signatures, ringct);
246 }
#define GET_FROM_JSON_OBJECT(source, dst, key)
Definition: json_object.h:52
std::vector< uint8_t > extra
version
Supported socks variants.
Definition: socks.h:57
std::vector< std::vector< crypto::signature > > signatures

◆ fromJsonValue() [17/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
cryptonote::block b 
)

Definition at line 262 of file json_object.cpp.

263 {
264  if (!val.IsObject())
265  {
266  throw WRONG_TYPE("json object");
267  }
268 
269  GET_FROM_JSON_OBJECT(val, b.major_version, major_version);
270  GET_FROM_JSON_OBJECT(val, b.minor_version, minor_version);
271  GET_FROM_JSON_OBJECT(val, b.timestamp, timestamp);
272  GET_FROM_JSON_OBJECT(val, b.prev_id, prev_id);
273  GET_FROM_JSON_OBJECT(val, b.nonce, nonce);
274  GET_FROM_JSON_OBJECT(val, b.miner_tx, miner_tx);
275  GET_FROM_JSON_OBJECT(val, b.tx_hashes, tx_hashes);
276 }
std::vector< crypto::hash > tx_hashes
#define GET_FROM_JSON_OBJECT(source, dst, key)
Definition: json_object.h:52

◆ fromJsonValue() [18/52]

template<typename Map >
std::enable_if< sfinae::is_map_like< Map >::value, void >::type cryptonote::json::fromJsonValue ( const rapidjson::Value val,
Map &  map 
)

Definition at line 327 of file json_object.h.

328 {
329  if (!val.IsObject())
330  {
331  throw WRONG_TYPE("json object");
332  }
333 
334  auto itr = val.MemberBegin();
335 
336  while (itr != val.MemberEnd())
337  {
338  typename Map::key_type k;
339  typename Map::mapped_type m;
340  fromJsonValue(itr->name, k);
341  fromJsonValue(itr->value, m);
342  map.emplace(k, m);
343  ++itr;
344  }
345 }
std::enable_if< sfinae::is_vector_like< Vec >::value, void >::type fromJsonValue(const rapidjson::Value &val, Vec &vec)
Definition: json_object.h:361
Here is the call graph for this function:

◆ fromJsonValue() [19/52]

template<typename Vec >
std::enable_if< sfinae::is_vector_like< Vec >::value, void >::type cryptonote::json::fromJsonValue ( const rapidjson::Value val,
Vec &  vec 
)

Definition at line 361 of file json_object.h.

362 {
363  if (!val.IsArray())
364  {
365  throw WRONG_TYPE("json array");
366  }
367 
368  for (rapidjson::SizeType i=0; i < val.Size(); i++)
369  {
370  typename Vec::value_type v;
371  fromJsonValue(val[i], v);
372  vec.push_back(v);
373  }
374 }
RAPIDJSON_NAMESPACE_BEGIN typedef unsigned SizeType
Size type (for string lengths, array sizes, etc.)
Definition: rapidjson.h:389
std::enable_if< sfinae::is_vector_like< Vec >::value, void >::type fromJsonValue(const rapidjson::Value &val, Vec &vec)
Definition: json_object.h:361
Here is the call graph for this function:

◆ fromJsonValue() [20/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
cryptonote::txin_v txin 
)

Definition at line 314 of file json_object.cpp.

315 {
316  if (!val.IsObject())
317  {
318  throw WRONG_TYPE("json object");
319  }
320 
321  if (val.MemberCount() != 1)
322  {
323  throw MISSING_KEY("Invalid input object");
324  }
325 
326  for (auto const& elem : val.GetObject())
327  {
328  if (elem.name == "to_key")
329  {
331  fromJsonValue(elem.value, tmpVal);
332  txin = std::move(tmpVal);
333  }
334  else if (elem.name == "gen")
335  {
336  cryptonote::txin_gen tmpVal;
337  fromJsonValue(elem.value, tmpVal);
338  txin = std::move(tmpVal);
339  }
340  else if (elem.name == "to_script")
341  {
343  fromJsonValue(elem.value, tmpVal);
344  txin = std::move(tmpVal);
345  }
346  else if (elem.name == "to_scripthash")
347  {
349  fromJsonValue(elem.value, tmpVal);
350  txin = std::move(tmpVal);
351  }
352  }
353 }
void fromJsonValue(const rapidjson::Value &val, cryptonote::rpc::output_distribution &dist)
const T & move(const T &t)
Definition: gtest-port.h:1317
Here is the call graph for this function:

◆ fromJsonValue() [21/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
cryptonote::txin_gen txin 
)

Definition at line 363 of file json_object.cpp.

364 {
365  if (!val.IsObject())
366  {
367  throw WRONG_TYPE("json object");
368  }
369 
370  GET_FROM_JSON_OBJECT(val, txin.height, height);
371 }
uint64_t height
Definition: blockchain.cpp:91
#define GET_FROM_JSON_OBJECT(source, dst, key)
Definition: json_object.h:52

◆ fromJsonValue() [22/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
cryptonote::txin_to_script txin 
)

Definition at line 383 of file json_object.cpp.

384 {
385  if (!val.IsObject())
386  {
387  throw WRONG_TYPE("json object");
388  }
389 
390  GET_FROM_JSON_OBJECT(val, txin.prev, prev);
391  GET_FROM_JSON_OBJECT(val, txin.prevout, prevout);
392  GET_FROM_JSON_OBJECT(val, txin.sigset, sigset);
393 }
#define GET_FROM_JSON_OBJECT(source, dst, key)
Definition: json_object.h:52
std::vector< uint8_t > sigset

◆ fromJsonValue() [23/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
cryptonote::txin_to_scripthash txin 
)

Definition at line 406 of file json_object.cpp.

407 {
408  if (!val.IsObject())
409  {
410  throw WRONG_TYPE("json object");
411  }
412 
413  GET_FROM_JSON_OBJECT(val, txin.prev, prev);
414  GET_FROM_JSON_OBJECT(val, txin.prevout, prevout);
415  GET_FROM_JSON_OBJECT(val, txin.script, script);
416  GET_FROM_JSON_OBJECT(val, txin.sigset, sigset);
417 }
#define GET_FROM_JSON_OBJECT(source, dst, key)
Definition: json_object.h:52
std::vector< uint8_t > sigset

◆ fromJsonValue() [24/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
cryptonote::txin_to_key txin 
)

Definition at line 437 of file json_object.cpp.

438 {
439  if (!val.IsObject())
440  {
441  throw WRONG_TYPE("json object");
442  }
443 
444  GET_FROM_JSON_OBJECT(val, txin.amount, amount);
445  GET_FROM_JSON_OBJECT(val, txin.key_offsets, key_offsets);
447 }
std::vector< uint64_t > key_offsets
#define GET_FROM_JSON_OBJECT(source, dst, key)
Definition: json_object.h:52
POD_CLASS key_image
Definition: crypto.h:102
crypto::key_image k_image

◆ fromJsonValue() [25/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
cryptonote::txin_to_key_public txin 
)

Definition at line 449 of file json_object.cpp.

450 {
451  if (!val.IsObject())
452  {
453  throw WRONG_TYPE("json object");
454  }
455 
456  GET_FROM_JSON_OBJECT(val, txin.amount, amount);
457  GET_FROM_JSON_OBJECT(val, txin.tx_hash, tx_hash);
458  GET_FROM_JSON_OBJECT(val, txin.relative_offset, relative_offset);
459 }
#define GET_FROM_JSON_OBJECT(source, dst, key)
Definition: json_object.h:52

◆ fromJsonValue() [26/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
cryptonote::txout_to_script txout 
)

Definition at line 470 of file json_object.cpp.

471 {
472  if (!val.IsObject())
473  {
474  throw WRONG_TYPE("json object");
475  }
476 
477  GET_FROM_JSON_OBJECT(val, txout.keys, keys);
478  GET_FROM_JSON_OBJECT(val, txout.script, script);
479 }
#define GET_FROM_JSON_OBJECT(source, dst, key)
Definition: json_object.h:52
std::vector< uint8_t > script
std::vector< crypto::public_key > keys

◆ fromJsonValue() [27/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
cryptonote::txout_to_scripthash txout 
)

Definition at line 489 of file json_object.cpp.

490 {
491  if (!val.IsObject())
492  {
493  throw WRONG_TYPE("json object");
494  }
495 
496  GET_FROM_JSON_OBJECT(val, txout.hash, hash);
497 }
#define GET_FROM_JSON_OBJECT(source, dst, key)
Definition: json_object.h:52
POD_CLASS hash
Definition: hash.h:50

◆ fromJsonValue() [28/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
cryptonote::txout_to_key_public txout 
)

Definition at line 506 of file json_object.cpp.

507 {
508  if (!val.IsObject())
509  {
510  throw WRONG_TYPE("json object");
511  }
512 
513  GET_FROM_JSON_OBJECT(val, txout.m_address_prefix, prefix);
514  GET_FROM_JSON_OBJECT(val, txout.address, address);
515 }
cryptonote::account_public_address address
#define GET_FROM_JSON_OBJECT(source, dst, key)
Definition: json_object.h:52
const char * address
Definition: multisig.cpp:37

◆ fromJsonValue() [29/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
cryptonote::txout_to_key txout 
)

Definition at line 525 of file json_object.cpp.

526 {
527  if (!val.IsObject())
528  {
529  throw WRONG_TYPE("json object");
530  }
531 
532  GET_FROM_JSON_OBJECT(val, txout.key, key);
533 }
const char * key
Definition: hmac_keccak.cpp:39
#define GET_FROM_JSON_OBJECT(source, dst, key)
Definition: json_object.h:52
crypto::public_key key

◆ fromJsonValue() [30/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
cryptonote::tx_out txout 
)

Definition at line 568 of file json_object.cpp.

569 {
570  if (!val.IsObject())
571  {
572  throw WRONG_TYPE("json object");
573  }
574 
575  if (val.MemberCount() != 2)
576  {
577  throw MISSING_KEY("Invalid input object");
578  }
579 
580  for (auto const& elem : val.GetObject())
581  {
582  if (elem.name == "amount")
583  {
584  fromJsonValue(elem.value, txout.amount);
585  }
586 
587  if (elem.name == "to_key")
588  {
590  fromJsonValue(elem.value, tmpVal);
591  txout.target = std::move(tmpVal);
592  }
593  else if (elem.name == "to_key_public")
594  {
596  fromJsonValue(elem.value, tmpVal);
597  txout.target = std::move(tmpVal);
598  }
599  else if (elem.name == "to_script")
600  {
602  fromJsonValue(elem.value, tmpVal);
603  txout.target = std::move(tmpVal);
604  }
605  else if (elem.name == "to_scripthash")
606  {
608  fromJsonValue(elem.value, tmpVal);
609  txout.target = std::move(tmpVal);
610  }
611  }
612 }
void fromJsonValue(const rapidjson::Value &val, cryptonote::rpc::output_distribution &dist)
const T & move(const T &t)
Definition: gtest-port.h:1317
txout_target_v target
Here is the call graph for this function:

◆ fromJsonValue() [31/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
cryptonote::connection_info info 
)

Definition at line 646 of file json_object.cpp.

647 {
648  if (!val.IsObject())
649  {
650  throw WRONG_TYPE("json object");
651  }
652 
653  GET_FROM_JSON_OBJECT(val, info.incoming, incoming);
654  GET_FROM_JSON_OBJECT(val, info.localhost, localhost);
655  GET_FROM_JSON_OBJECT(val, info.local_ip, local_ip);
656 
657  GET_FROM_JSON_OBJECT(val, info.ip, ip);
658  GET_FROM_JSON_OBJECT(val, info.port, port);
659  GET_FROM_JSON_OBJECT(val, info.rpc_port, rpc_port);
660 
661  GET_FROM_JSON_OBJECT(val, info.peer_id, peer_id);
662 
663  GET_FROM_JSON_OBJECT(val, info.recv_count, recv_count);
664  GET_FROM_JSON_OBJECT(val, info.recv_idle_time, recv_idle_time);
665 
666  GET_FROM_JSON_OBJECT(val, info.send_count, send_count);
667  GET_FROM_JSON_OBJECT(val, info.send_idle_time, send_idle_time);
668 
669  GET_FROM_JSON_OBJECT(val, info.state, state);
670 
671  GET_FROM_JSON_OBJECT(val, info.live_time, live_time);
672 
673  GET_FROM_JSON_OBJECT(val, info.avg_download, avg_download);
674  GET_FROM_JSON_OBJECT(val, info.current_download, current_download);
675 
676  GET_FROM_JSON_OBJECT(val, info.avg_upload, avg_upload);
677  GET_FROM_JSON_OBJECT(val, info.current_upload, current_upload);
678 }
#define GET_FROM_JSON_OBJECT(source, dst, key)
Definition: json_object.h:52
boost::endian::big_uint32_t ip
Definition: socks.cpp:61
boost::endian::big_uint16_t port
Definition: socks.cpp:60
CXA_THROW_INFO_T * info
Definition: stack_trace.cpp:91
Definition: blake256.h:37

◆ fromJsonValue() [32/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
cryptonote::block_complete_entry blk 
)

Definition at line 689 of file json_object.cpp.

690 {
691  if (!val.IsObject())
692  {
693  throw WRONG_TYPE("json object");
694  }
695 
696  GET_FROM_JSON_OBJECT(val, blk.block, block);
697  GET_FROM_JSON_OBJECT(val, blk.txs, transactions);
698 }
std::vector< blobdata > txs
#define GET_FROM_JSON_OBJECT(source, dst, key)
Definition: json_object.h:52
blobdata block

◆ fromJsonValue() [33/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
cryptonote::rpc::block_with_transactions blk 
)

Definition at line 709 of file json_object.cpp.

710 {
711  if (!val.IsObject())
712  {
713  throw WRONG_TYPE("json object");
714  }
715 
716  GET_FROM_JSON_OBJECT(val, blk.block, block);
717  GET_FROM_JSON_OBJECT(val, blk.transactions, transactions);
718 }
#define GET_FROM_JSON_OBJECT(source, dst, key)
Definition: json_object.h:52
std::vector< cryptonote::transaction > transactions

◆ fromJsonValue() [34/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
cryptonote::rpc::transaction_info tx_info 
)

Definition at line 730 of file json_object.cpp.

731 {
732  if (!val.IsObject())
733  {
734  throw WRONG_TYPE("json object");
735  }
736 
737  GET_FROM_JSON_OBJECT(val, tx_info.height, height);
738  GET_FROM_JSON_OBJECT(val, tx_info.in_pool, in_pool);
739  GET_FROM_JSON_OBJECT(val, tx_info.transaction, transaction);
740 }
uint64_t height
Definition: blockchain.cpp:91
#define GET_FROM_JSON_OBJECT(source, dst, key)
Definition: json_object.h:52

◆ fromJsonValue() [35/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
cryptonote::rpc::output_key_and_amount_index out 
)

Definition at line 751 of file json_object.cpp.

752 {
753  if (!val.IsObject())
754  {
755  throw WRONG_TYPE("json object");
756  }
757 
758  GET_FROM_JSON_OBJECT(val, out.amount_index, amount_index);
759  GET_FROM_JSON_OBJECT(val, out.key, key);
760 }
const char * key
Definition: hmac_keccak.cpp:39
#define GET_FROM_JSON_OBJECT(source, dst, key)
Definition: json_object.h:52

◆ fromJsonValue() [36/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
cryptonote::rpc::amount_with_random_outputs out 
)

Definition at line 771 of file json_object.cpp.

772 {
773  if (!val.IsObject())
774  {
775  throw WRONG_TYPE("json object");
776  }
777 
778  GET_FROM_JSON_OBJECT(val, out.amount, amount);
779  GET_FROM_JSON_OBJECT(val, out.outputs, outputs);
780 }
#define GET_FROM_JSON_OBJECT(source, dst, key)
Definition: json_object.h:52

◆ fromJsonValue() [37/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
cryptonote::rpc::peer peer 
)

Definition at line 795 of file json_object.cpp.

796 {
797  if (!val.IsObject())
798  {
799  throw WRONG_TYPE("json object");
800  }
801 
802  GET_FROM_JSON_OBJECT(val, peer.id, id);
803  GET_FROM_JSON_OBJECT(val, peer.ip, ip);
804  GET_FROM_JSON_OBJECT(val, peer.port, port);
805  GET_FROM_JSON_OBJECT(val, peer.rpc_port, rpc_port);
806  GET_FROM_JSON_OBJECT(val, peer.last_seen, last_seen);
807  GET_FROM_JSON_OBJECT(val, peer.pruning_seed, pruning_seed);
808 }
#define GET_FROM_JSON_OBJECT(source, dst, key)
Definition: json_object.h:52
boost::endian::big_uint32_t ip
Definition: socks.cpp:61
boost::endian::big_uint16_t port
Definition: socks.cpp:60

◆ fromJsonValue() [38/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
cryptonote::rpc::tx_in_pool tx 
)

Definition at line 833 of file json_object.cpp.

834 {
835  if (!val.IsObject())
836  {
837  throw WRONG_TYPE("json object");
838  }
839 
840  GET_FROM_JSON_OBJECT(val, tx.tx, tx);
841  GET_FROM_JSON_OBJECT(val, tx.blob_size, blob_size);
842  GET_FROM_JSON_OBJECT(val, tx.weight, weight);
843  GET_FROM_JSON_OBJECT(val, tx.fee, fee);
844  GET_FROM_JSON_OBJECT(val, tx.max_used_block_hash, max_used_block_hash);
845  GET_FROM_JSON_OBJECT(val, tx.max_used_block_height, max_used_block_height);
846  GET_FROM_JSON_OBJECT(val, tx.kept_by_block, kept_by_block);
847  GET_FROM_JSON_OBJECT(val, tx.last_failed_block_hash, last_failed_block_hash);
848  GET_FROM_JSON_OBJECT(val, tx.last_failed_block_height, last_failed_block_height);
849  GET_FROM_JSON_OBJECT(val, tx.receive_time, receive_time);
850  GET_FROM_JSON_OBJECT(val, tx.last_relayed_time, last_relayed_time);
851  GET_FROM_JSON_OBJECT(val, tx.relayed, relayed);
852  GET_FROM_JSON_OBJECT(val, tx.do_not_relay, do_not_relay);
853  GET_FROM_JSON_OBJECT(val, tx.double_spend_seen, double_spend_seen);
854  GET_FROM_JSON_OBJECT(val, tx.nonexistent_utxo_seen, nonexistent_utxo_seen);
855 }
#define GET_FROM_JSON_OBJECT(source, dst, key)
Definition: json_object.h:52
cryptonote::transaction tx

◆ fromJsonValue() [39/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
cryptonote::rpc::hard_fork_info info 
)

Definition at line 872 of file json_object.cpp.

873 {
874  if (!val.IsObject())
875  {
876  throw WRONG_TYPE("json object");
877  }
878 
879  GET_FROM_JSON_OBJECT(val, info.version, version);
880  GET_FROM_JSON_OBJECT(val, info.enabled, enabled);
881  GET_FROM_JSON_OBJECT(val, info.window, window);
882  GET_FROM_JSON_OBJECT(val, info.votes, votes);
883  GET_FROM_JSON_OBJECT(val, info.threshold, threshold);
884  GET_FROM_JSON_OBJECT(val, info.voting, voting);
885  GET_FROM_JSON_OBJECT(val, info.state, state);
886  GET_FROM_JSON_OBJECT(val, info.earliest_height, earliest_height);
887 }
#define GET_FROM_JSON_OBJECT(source, dst, key)
Definition: json_object.h:52
version
Supported socks variants.
Definition: socks.h:57
CXA_THROW_INFO_T * info
Definition: stack_trace.cpp:91
Definition: blake256.h:37
uint8_t threshold
Definition: blockchain.cpp:92

◆ fromJsonValue() [40/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
cryptonote::rpc::output_amount_count out 
)

Definition at line 900 of file json_object.cpp.

901 {
902  if (!val.IsObject())
903  {
904  throw WRONG_TYPE("json object");
905  }
906 
907  GET_FROM_JSON_OBJECT(val, out.amount, amount);
908  GET_FROM_JSON_OBJECT(val, out.total_count, total_count);
909  GET_FROM_JSON_OBJECT(val, out.unlocked_count, unlocked_count);
910  GET_FROM_JSON_OBJECT(val, out.recent_count, recent_count);
911 }
#define GET_FROM_JSON_OBJECT(source, dst, key)
Definition: json_object.h:52

◆ fromJsonValue() [41/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
cryptonote::rpc::output_amount_and_index out 
)

Definition at line 922 of file json_object.cpp.

923 {
924  if (!val.IsObject())
925  {
926  throw WRONG_TYPE("json object");
927  }
928 
929  GET_FROM_JSON_OBJECT(val, out.amount, amount);
930  GET_FROM_JSON_OBJECT(val, out.index, index);
931 }
#define GET_FROM_JSON_OBJECT(source, dst, key)
Definition: json_object.h:52

◆ fromJsonValue() [42/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
cryptonote::rpc::output_key_mask_unlocked out 
)

Definition at line 942 of file json_object.cpp.

943 {
944  if (!val.IsObject())
945  {
946  throw WRONG_TYPE("json object");
947  }
948 
949  GET_FROM_JSON_OBJECT(val, out.key, key);
950  GET_FROM_JSON_OBJECT(val, out.mask, mask);
951  GET_FROM_JSON_OBJECT(val, out.unlocked, unlocked);
952 }
const char * key
Definition: hmac_keccak.cpp:39
#define GET_FROM_JSON_OBJECT(source, dst, key)
Definition: json_object.h:52

◆ fromJsonValue() [43/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
cryptonote::rpc::error error 
)

Definition at line 963 of file json_object.cpp.

964 {
965  if (!val.IsObject())
966  {
967  throw WRONG_TYPE("json object");
968  }
969 
970  GET_FROM_JSON_OBJECT(val, error.code, code);
971  GET_FROM_JSON_OBJECT(val, error.error_str, error_str);
972  GET_FROM_JSON_OBJECT(val, error.message, message);
973 }
#define GET_FROM_JSON_OBJECT(source, dst, key)
Definition: json_object.h:52
std::string message("Message requiring signing")
error
Tracks LMDB error codes.
Definition: error.h:44
Here is the call graph for this function:

◆ fromJsonValue() [44/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
cryptonote::rpc::BlockHeaderResponse response 
)

Definition at line 991 of file json_object.cpp.

992 {
993  if (!val.IsObject())
994  {
995  throw WRONG_TYPE("json object");
996  }
997 
998  GET_FROM_JSON_OBJECT(val, response.major_version, major_version);
999  GET_FROM_JSON_OBJECT(val, response.minor_version, minor_version);
1000  GET_FROM_JSON_OBJECT(val, response.timestamp, timestamp);
1001  GET_FROM_JSON_OBJECT(val, response.prev_id, prev_id);
1002  GET_FROM_JSON_OBJECT(val, response.nonce, nonce);
1003  GET_FROM_JSON_OBJECT(val, response.height, height);
1004  GET_FROM_JSON_OBJECT(val, response.depth, depth);
1005  GET_FROM_JSON_OBJECT(val, response.hash, hash);
1006  GET_FROM_JSON_OBJECT(val, response.difficulty, difficulty);
1007  GET_FROM_JSON_OBJECT(val, response.reward, reward);
1008 }
epee::misc_utils::struct_init< response_t > response
uint64_t height
Definition: blockchain.cpp:91
#define GET_FROM_JSON_OBJECT(source, dst, key)
Definition: json_object.h:52
POD_CLASS hash
Definition: hash.h:50

◆ fromJsonValue() [45/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
rct::rctSig sig 
)

Definition at line 1040 of file json_object.cpp.

1041 {
1042  using boost::adaptors::transform;
1043 
1044  if (!val.IsObject())
1045  {
1046  throw WRONG_TYPE("json object");
1047  }
1048 
1049  std::vector<rct::key> commitments;
1050 
1051  GET_FROM_JSON_OBJECT(val, sig.type, type);
1052  GET_FROM_JSON_OBJECT(val, sig.ecdhInfo, encrypted);
1053  GET_FROM_JSON_OBJECT(val, commitments, commitments);
1054  GET_FROM_JSON_OBJECT(val, sig.txnFee, fee);
1055 
1056  // prunable
1057  {
1058  OBJECT_HAS_MEMBER_OR_THROW(val, "prunable");
1059  const auto& prunable = val["prunable"];
1060 
1061  rct::keyV pseudo_outs;
1062 
1063  GET_FROM_JSON_OBJECT(prunable, sig.p.rangeSigs, range_proofs);
1064  GET_FROM_JSON_OBJECT(prunable, sig.p.bulletproofs, bulletproofs);
1065  GET_FROM_JSON_OBJECT(prunable, sig.p.MGs, mlsags);
1066  GET_FROM_JSON_OBJECT(prunable, pseudo_outs, pseudo_outs);
1067 
1068  sig.get_pseudo_outs() = std::move(pseudo_outs);
1069  }
1070 
1071  sig.outPk.reserve(commitments.size());
1072  for (rct::key const& commitment : commitments)
1073  {
1074  sig.outPk.push_back({{}, commitment});
1075  }
1076 }
etn_amount txnFee
Definition: rctTypes.h:248
std::vector< mgSig > MGs
Definition: rctTypes.h:321
std::vector< rangeSig > rangeSigs
Definition: rctTypes.h:319
#define GET_FROM_JSON_OBJECT(source, dst, key)
Definition: json_object.h:52
uint8_t type
Definition: rctTypes.h:241
std::vector< key > keyV
Definition: rctTypes.h:88
std::vector< ecdhTuple > ecdhInfo
Definition: rctTypes.h:246
rctSigPrunable p
Definition: rctTypes.h:437
#define OBJECT_HAS_MEMBER_OR_THROW(val, key)
Definition: json_object.h:38
const T & move(const T &t)
Definition: gtest-port.h:1317
ctkeyV outPk
Definition: rctTypes.h:247
std::vector< Bulletproof > bulletproofs
Definition: rctTypes.h:320
keyV & get_pseudo_outs()
Definition: rctTypes.h:439
Here is the call graph for this function:

◆ fromJsonValue() [46/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
rct::ecdhTuple tuple 
)

Definition at line 1086 of file json_object.cpp.

1087 {
1088  if (!val.IsObject())
1089  {
1090  throw WRONG_TYPE("json object");
1091  }
1092 
1093  GET_FROM_JSON_OBJECT(val, tuple.mask, mask);
1094  GET_FROM_JSON_OBJECT(val, tuple.amount, amount);
1095 }
#define GET_FROM_JSON_OBJECT(source, dst, key)
Definition: json_object.h:52

◆ fromJsonValue() [47/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
rct::rangeSig sig 
)

Definition at line 1107 of file json_object.cpp.

1108 {
1109  if (!val.IsObject())
1110  {
1111  throw WRONG_TYPE("json object");
1112  }
1113 
1114  const auto ci = val.FindMember("Ci");
1115  if (ci == val.MemberEnd())
1116  {
1117  throw MISSING_KEY("Ci");
1118  }
1119 
1120  GET_FROM_JSON_OBJECT(val, sig.asig, asig);
1121 
1122  std::vector<rct::key> keyVector;
1123  cryptonote::json::fromJsonValue(ci->value, keyVector);
1124  if (!(keyVector.size() == 64))
1125  {
1126  throw WRONG_TYPE("key64 (rct::key[64])");
1127  }
1128  for (size_t i=0; i < 64; i++)
1129  {
1130  sig.Ci[i] = keyVector[i];
1131  }
1132 }
#define GET_FROM_JSON_OBJECT(source, dst, key)
Definition: json_object.h:52
boroSig asig
Definition: rctTypes.h:170
void fromJsonValue(const rapidjson::Value &val, std::string &str)
Here is the call graph for this function:

◆ fromJsonValue() [48/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
rct::Bulletproof p 
)

Definition at line 1152 of file json_object.cpp.

1153 {
1154  if (!val.IsObject())
1155  {
1156  throw WRONG_TYPE("json object");
1157  }
1158 
1159  GET_FROM_JSON_OBJECT(val, p.V, V);
1160  GET_FROM_JSON_OBJECT(val, p.A, A);
1161  GET_FROM_JSON_OBJECT(val, p.S, S);
1162  GET_FROM_JSON_OBJECT(val, p.T1, T1);
1163  GET_FROM_JSON_OBJECT(val, p.T2, T2);
1164  GET_FROM_JSON_OBJECT(val, p.taux, taux);
1165  GET_FROM_JSON_OBJECT(val, p.mu, mu);
1166  GET_FROM_JSON_OBJECT(val, p.L, L);
1167  GET_FROM_JSON_OBJECT(val, p.R, R);
1168  GET_FROM_JSON_OBJECT(val, p.a, a);
1169  GET_FROM_JSON_OBJECT(val, p.b, b);
1170  GET_FROM_JSON_OBJECT(val, p.t, t);
1171 }
rct::key b
Definition: rctTypes.h:185
rct::key S
Definition: rctTypes.h:182
rct::key taux
Definition: rctTypes.h:183
rct::key mu
Definition: rctTypes.h:183
rct::key T2
Definition: rctTypes.h:182
#define GET_FROM_JSON_OBJECT(source, dst, key)
Definition: json_object.h:52
rct::keyV R
Definition: rctTypes.h:184
rct::key A
Definition: rctTypes.h:182
rct::key a
Definition: rctTypes.h:185
rct::keyV L
Definition: rctTypes.h:184
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition: pointer.h:1124
Matcher< T > A()
rct::key T1
Definition: rctTypes.h:182
rct::key t
Definition: rctTypes.h:185
rct::keyV V
Definition: rctTypes.h:181
Here is the call graph for this function:

◆ fromJsonValue() [49/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
rct::boroSig sig 
)

Definition at line 1186 of file json_object.cpp.

1187 {
1188  if (!val.IsObject())
1189  {
1190  throw WRONG_TYPE("json object");
1191  }
1192 
1193  OBJECT_HAS_MEMBER_OR_THROW(val, "s0")
1194  std::vector<rct::key> keyVector;
1195  cryptonote::json::fromJsonValue(val["s0"], keyVector);
1196  if (!(keyVector.size() == 64))
1197  {
1198  throw WRONG_TYPE("key64 (rct::key[64])");
1199  }
1200  for (size_t i=0; i < 64; i++)
1201  {
1202  sig.s0[i] = keyVector[i];
1203  }
1204 
1205  OBJECT_HAS_MEMBER_OR_THROW(val, "s1")
1206  keyVector.clear();
1207  cryptonote::json::fromJsonValue(val["s1"], keyVector);
1208  if (!(keyVector.size() == 64))
1209  {
1210  throw WRONG_TYPE("key64 (rct::key[64])");
1211  }
1212  for (size_t i=0; i < 64; i++)
1213  {
1214  sig.s1[i] = keyVector[i];
1215  }
1216 
1217  GET_FROM_JSON_OBJECT(val, sig.ee, ee);
1218 }
const char * key
Definition: hmac_keccak.cpp:39
STL namespace.
#define GET_FROM_JSON_OBJECT(source, dst, key)
Definition: json_object.h:52
key64 s0
Definition: rctTypes.h:140
Holds cryptonote related classes and helpers.
Definition: ban.cpp:40
#define OBJECT_HAS_MEMBER_OR_THROW(val, key)
Definition: json_object.h:38
void fromJsonValue(const rapidjson::Value &val, cryptonote::rpc::output_distribution &dist)
key64 s1
Definition: rctTypes.h:141
else if(0==res)
rapidjson::Document json
Definition: transport.cpp:49
Here is the call graph for this function:

◆ fromJsonValue() [50/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
rct::mgSig sig 
)

Definition at line 1228 of file json_object.cpp.

1229 {
1230  if (!val.IsObject())
1231  {
1232  throw WRONG_TYPE("key64 (rct::key[64])");
1233  }
1234 
1235  GET_FROM_JSON_OBJECT(val, sig.ss, ss);
1236  GET_FROM_JSON_OBJECT(val, sig.cc, cc);
1237 }
keyM ss
Definition: rctTypes.h:153
#define GET_FROM_JSON_OBJECT(source, dst, key)
Definition: json_object.h:52

◆ fromJsonValue() [51/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
cryptonote::rpc::DaemonInfo info 
)

Definition at line 1267 of file json_object.cpp.

1268 {
1269  if (!val.IsObject())
1270  {
1271  throw WRONG_TYPE("json object");
1272  }
1273 
1274  GET_FROM_JSON_OBJECT(val, info.height, height);
1275  GET_FROM_JSON_OBJECT(val, info.target_height, target_height);
1276  GET_FROM_JSON_OBJECT(val, info.difficulty, difficulty);
1277  GET_FROM_JSON_OBJECT(val, info.target, target);
1278  GET_FROM_JSON_OBJECT(val, info.tx_count, tx_count);
1279  GET_FROM_JSON_OBJECT(val, info.tx_pool_size, tx_pool_size);
1280  GET_FROM_JSON_OBJECT(val, info.alt_blocks_count, alt_blocks_count);
1281  GET_FROM_JSON_OBJECT(val, info.outgoing_connections_count, outgoing_connections_count);
1282  GET_FROM_JSON_OBJECT(val, info.incoming_connections_count, incoming_connections_count);
1283  GET_FROM_JSON_OBJECT(val, info.white_peerlist_size, white_peerlist_size);
1284  GET_FROM_JSON_OBJECT(val, info.grey_peerlist_size, grey_peerlist_size);
1285  GET_FROM_JSON_OBJECT(val, info.mainnet, mainnet);
1286  GET_FROM_JSON_OBJECT(val, info.testnet, testnet);
1287  GET_FROM_JSON_OBJECT(val, info.stagenet, stagenet);
1288  GET_FROM_JSON_OBJECT(val, info.nettype, nettype);
1289  GET_FROM_JSON_OBJECT(val, info.top_block_hash, top_block_hash);
1290  GET_FROM_JSON_OBJECT(val, info.cumulative_difficulty, cumulative_difficulty);
1291  GET_FROM_JSON_OBJECT(val, info.block_size_limit, block_size_limit);
1292  GET_FROM_JSON_OBJECT(val, info.block_weight_limit, block_weight_limit);
1293  GET_FROM_JSON_OBJECT(val, info.block_size_median, block_size_median);
1294  GET_FROM_JSON_OBJECT(val, info.block_weight_median, block_weight_median);
1295  GET_FROM_JSON_OBJECT(val, info.start_time, start_time);
1296 }
uint64_t height
Definition: blockchain.cpp:91
#define GET_FROM_JSON_OBJECT(source, dst, key)
Definition: json_object.h:52
CXA_THROW_INFO_T * info
Definition: stack_trace.cpp:91

◆ fromJsonValue() [52/52]

void cryptonote::json::fromJsonValue ( const rapidjson::Value val,
cryptonote::rpc::output_distribution dist 
)

Definition at line 1308 of file json_object.cpp.

1309 {
1310  if (!val.IsObject())
1311  {
1312  throw WRONG_TYPE("json object");
1313  }
1314 
1315  GET_FROM_JSON_OBJECT(val, dist.data.distribution, distribution);
1316  GET_FROM_JSON_OBJECT(val, dist.amount, amount);
1317  GET_FROM_JSON_OBJECT(val, dist.data.start_height, start_height);
1318  GET_FROM_JSON_OBJECT(val, dist.data.base, base);
1319 }
std::vector< std::uint64_t > distribution
Definition: rpc_handler.h:46
#define GET_FROM_JSON_OBJECT(source, dst, key)
Definition: json_object.h:52

◆ is_to_hex()

template<typename Type >
constexpr bool cryptonote::json::is_to_hex ( )
inline

Definition at line 112 of file json_object.h.

113 {
114  return std::is_pod<Type>() && !std::is_integral<Type>();
115 }

◆ toJsonValue() [1/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const std::string &  i,
rapidjson::Value val 
)

Definition at line 112 of file json_object.cpp.

113 {
114  val = rapidjson::Value(i.c_str(), doc.GetAllocator());
115 }
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition: document.h:2116
Here is the caller graph for this function:

◆ toJsonValue() [2/47]

template<class Type >
std::enable_if<is_to_hex<Type>)>::type cryptonote::json::toJsonValue ( rapidjson::Document doc,
const Type pod,
rapidjson::Value value 
)

Definition at line 120 of file json_object.h.

121 {
122  value = rapidjson::Value(epee::string_tools::pod_to_hex(pod).c_str(), doc.GetAllocator());
123 }
std::string pod_to_hex(const t_pod_type &s)
Definition: string_tools.h:317
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition: document.h:2116
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1225
Here is the call graph for this function:

◆ toJsonValue() [3/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
bool  i,
rapidjson::Value val 
)

Definition at line 127 of file json_object.cpp.

128 {
129  val.SetBool(i);
130 }

◆ toJsonValue() [4/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const unsigned  i,
rapidjson::Value val 
)

◆ toJsonValue() [5/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const unsigned int  i,
rapidjson::Value val 
)

Definition at line 166 of file json_object.cpp.

167 {
168  val = rapidjson::Value(i);
169 }
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition: document.h:2116

◆ toJsonValue() [6/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const unsigned long  i,
rapidjson::Value val 
)
inline

Definition at line 173 of file json_object.h.

173  {
174  toJsonValue(doc, static_cast<unsigned long long>(i), val);
175 }
std::enable_if< sfinae::is_vector_like< Vec >::value, void >::type toJsonValue(rapidjson::Document &doc, const Vec &vec, rapidjson::Value &val)
Definition: json_object.h:348
Here is the call graph for this function:

◆ toJsonValue() [7/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const long  i,
rapidjson::Value val 
)
inline

Definition at line 178 of file json_object.h.

178  {
179  toJsonValue(doc, static_cast<long long>(i), val);
180 }
std::enable_if< sfinae::is_vector_like< Vec >::value, void >::type toJsonValue(rapidjson::Document &doc, const Vec &vec, rapidjson::Value &val)
Definition: json_object.h:348
Here is the call graph for this function:

◆ toJsonValue() [8/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const unsigned long long  i,
rapidjson::Value val 
)

Definition at line 186 of file json_object.cpp.

187 {
188  static_assert(!precision_loss<unsigned long long, std::uint64_t>(), "precision loss");
190 }
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition: document.h:2116
unsigned __int64 uint64_t
Definition: stdint.h:136

◆ toJsonValue() [9/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const long long  i,
rapidjson::Value val 
)

Definition at line 197 of file json_object.cpp.

198 {
199  static_assert(!precision_loss<long long, std::int64_t>(), "precision loss");
200  val = rapidjson::Value(std::int64_t(i));
201 }
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition: document.h:2116
signed __int64 int64_t
Definition: stdint.h:135

◆ toJsonValue() [10/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const cryptonote::txout_target_v txout,
rapidjson::Value val 
)

◆ toJsonValue() [11/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const cryptonote::transaction tx,
rapidjson::Value val 
)

Definition at line 218 of file json_object.cpp.

219 {
220  val.SetObject();
221 
222  INSERT_INTO_JSON_OBJECT(val, doc, version, tx.version);
223  INSERT_INTO_JSON_OBJECT(val, doc, unlock_time, tx.unlock_time);
224  INSERT_INTO_JSON_OBJECT(val, doc, inputs, tx.vin);
225  INSERT_INTO_JSON_OBJECT(val, doc, outputs, tx.vout);
226  INSERT_INTO_JSON_OBJECT(val, doc, extra, tx.extra);
227  INSERT_INTO_JSON_OBJECT(val, doc, signatures, tx.signatures);
228  INSERT_INTO_JSON_OBJECT(val, doc, ringct, tx.rct_signatures);
229 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47
std::vector< uint8_t > extra
version
Supported socks variants.
Definition: socks.h:57
std::vector< std::vector< crypto::signature > > signatures

◆ toJsonValue() [12/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const cryptonote::block b,
rapidjson::Value val 
)

Definition at line 248 of file json_object.cpp.

249 {
250  val.SetObject();
251 
252  INSERT_INTO_JSON_OBJECT(val, doc, major_version, b.major_version);
253  INSERT_INTO_JSON_OBJECT(val, doc, minor_version, b.minor_version);
254  INSERT_INTO_JSON_OBJECT(val, doc, timestamp, b.timestamp);
255  INSERT_INTO_JSON_OBJECT(val, doc, prev_id, b.prev_id);
256  INSERT_INTO_JSON_OBJECT(val, doc, nonce, b.nonce);
257  INSERT_INTO_JSON_OBJECT(val, doc, miner_tx, b.miner_tx);
258  INSERT_INTO_JSON_OBJECT(val, doc, tx_hashes, b.tx_hashes);
259 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47
std::vector< crypto::hash > tx_hashes

◆ toJsonValue() [13/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const cryptonote::txin_v txin,
rapidjson::Value val 
)

Definition at line 278 of file json_object.cpp.

279 {
280  val.SetObject();
281 
282  struct add_input
283  {
284  using result_type = void;
285 
286  rapidjson::Document& doc;
287  rapidjson::Value& val;
288 
289  void operator()(cryptonote::txin_to_key const& input) const
290  {
291  INSERT_INTO_JSON_OBJECT(val, doc, to_key, input);
292  }
293  void operator()(cryptonote::txin_to_key_public const& input) const
294  {
295  INSERT_INTO_JSON_OBJECT(val, doc, to_key, input);
296  }
297  void operator()(cryptonote::txin_gen const& input) const
298  {
299  INSERT_INTO_JSON_OBJECT(val, doc, gen, input);
300  }
301  void operator()(cryptonote::txin_to_script const& input) const
302  {
303  INSERT_INTO_JSON_OBJECT(val, doc, to_script, input);
304  }
305  void operator()(cryptonote::txin_to_scripthash const& input) const
306  {
307  INSERT_INTO_JSON_OBJECT(val, doc, to_scripthash, input);
308  }
309  };
310  boost::apply_visitor(add_input{doc, val}, txin);
311 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition: document.h:2116
GenericDocument< UTF8<> > Document
GenericDocument with UTF8 encoding.
Definition: document.h:2512

◆ toJsonValue() [14/47]

template<typename Map >
std::enable_if< sfinae::is_map_like< Map >::value, void >::type cryptonote::json::toJsonValue ( rapidjson::Document doc,
const Map &  map,
rapidjson::Value val 
)

Definition at line 310 of file json_object.h.

311 {
312  val.SetObject();
313 
314  auto& al = doc.GetAllocator();
315 
316  for (const auto& i : map)
317  {
320  toJsonValue(doc, i.first, k);
321  toJsonValue(doc, i.second, m);
322  val.AddMember(k, m, al);
323  }
324 }
std::enable_if< sfinae::is_vector_like< Vec >::value, void >::type toJsonValue(rapidjson::Document &doc, const Vec &vec, rapidjson::Value &val)
Definition: json_object.h:348
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition: document.h:2116
Here is the call graph for this function:

◆ toJsonValue() [15/47]

template<typename Vec >
std::enable_if< sfinae::is_vector_like< Vec >::value, void >::type cryptonote::json::toJsonValue ( rapidjson::Document doc,
const Vec &  vec,
rapidjson::Value val 
)

Definition at line 348 of file json_object.h.

349 {
350  val.SetArray();
351 
352  for (const auto& t : vec)
353  {
355  toJsonValue(doc, t, v);
356  val.PushBack(v, doc.GetAllocator());
357  }
358 }
std::enable_if< sfinae::is_vector_like< Vec >::value, void >::type toJsonValue(rapidjson::Document &doc, const Vec &vec, rapidjson::Value &val)
Definition: json_object.h:348
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition: document.h:2116
Here is the call graph for this function:

◆ toJsonValue() [16/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const cryptonote::txin_gen txin,
rapidjson::Value val 
)

Definition at line 355 of file json_object.cpp.

356 {
357  val.SetObject();
358 
359  INSERT_INTO_JSON_OBJECT(val, doc, height, txin.height);
360 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47
uint64_t height
Definition: blockchain.cpp:91

◆ toJsonValue() [17/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const cryptonote::txin_to_script txin,
rapidjson::Value val 
)

Definition at line 373 of file json_object.cpp.

374 {
375  val.SetObject();
376 
377  INSERT_INTO_JSON_OBJECT(val, doc, prev, txin.prev);
378  INSERT_INTO_JSON_OBJECT(val, doc, prevout, txin.prevout);
379  INSERT_INTO_JSON_OBJECT(val, doc, sigset, txin.sigset);
380 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47
std::vector< uint8_t > sigset

◆ toJsonValue() [18/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const cryptonote::txin_to_scripthash txin,
rapidjson::Value val 
)

Definition at line 395 of file json_object.cpp.

396 {
397  val.SetObject();
398 
399  INSERT_INTO_JSON_OBJECT(val, doc, prev, txin.prev);
400  INSERT_INTO_JSON_OBJECT(val, doc, prevout, txin.prevout);
401  INSERT_INTO_JSON_OBJECT(val, doc, script, txin.script);
402  INSERT_INTO_JSON_OBJECT(val, doc, sigset, txin.sigset);
403 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47
std::vector< uint8_t > sigset

◆ toJsonValue() [19/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const cryptonote::txin_to_key txin,
rapidjson::Value val 
)

Definition at line 419 of file json_object.cpp.

420 {
421  val.SetObject();
422 
423  INSERT_INTO_JSON_OBJECT(val, doc, amount, txin.amount);
424  INSERT_INTO_JSON_OBJECT(val, doc, key_offsets, txin.key_offsets);
425  INSERT_INTO_JSON_OBJECT(val, doc, key_image, txin.k_image);
426 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47
std::vector< uint64_t > key_offsets
POD_CLASS key_image
Definition: crypto.h:102
crypto::key_image k_image

◆ toJsonValue() [20/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const cryptonote::txin_to_key_public txin,
rapidjson::Value val 
)

Definition at line 428 of file json_object.cpp.

429 {
430  val.SetObject();
431 
432  INSERT_INTO_JSON_OBJECT(val, doc, amount, txin.amount);
433  INSERT_INTO_JSON_OBJECT(val, doc, tx_hash, txin.tx_hash);
434  INSERT_INTO_JSON_OBJECT(val, doc, relative_offset, txin.relative_offset);
435 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47

◆ toJsonValue() [21/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const cryptonote::txout_to_script txout,
rapidjson::Value val 
)

Definition at line 461 of file json_object.cpp.

462 {
463  val.SetObject();
464 
465  INSERT_INTO_JSON_OBJECT(val, doc, keys, txout.keys);
466  INSERT_INTO_JSON_OBJECT(val, doc, script, txout.script);
467 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47
std::vector< uint8_t > script
std::vector< crypto::public_key > keys

◆ toJsonValue() [22/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const cryptonote::txout_to_scripthash txout,
rapidjson::Value val 
)

Definition at line 481 of file json_object.cpp.

482 {
483  val.SetObject();
484 
485  INSERT_INTO_JSON_OBJECT(val, doc, hash, txout.hash);
486 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47
POD_CLASS hash
Definition: hash.h:50

◆ toJsonValue() [23/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const cryptonote::txout_to_key txout,
rapidjson::Value val 
)

Definition at line 499 of file json_object.cpp.

500 {
501  val.SetObject();
502 
503  INSERT_INTO_JSON_OBJECT(val, doc, key, txout.key);
504 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47
const char * key
Definition: hmac_keccak.cpp:39
crypto::public_key key

◆ toJsonValue() [24/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const cryptonote::txout_to_key_public txout,
rapidjson::Value val 
)

Definition at line 517 of file json_object.cpp.

518 {
519  val.SetObject();
520 
521  INSERT_INTO_JSON_OBJECT(val, doc, prefix, txout.m_address_prefix);
522  INSERT_INTO_JSON_OBJECT(val, doc, address, txout.address);
523 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47
cryptonote::account_public_address address
const char * address
Definition: multisig.cpp:37

◆ toJsonValue() [25/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const cryptonote::tx_out txout,
rapidjson::Value val 
)

Definition at line 535 of file json_object.cpp.

536 {
537  val.SetObject();
538 
539  INSERT_INTO_JSON_OBJECT(val, doc, amount, txout.amount);
540 
541  struct add_output
542  {
543  using result_type = void;
544 
545  rapidjson::Document& doc;
546  rapidjson::Value& val;
547 
548  void operator()(cryptonote::txout_to_key const& output) const
549  {
550  INSERT_INTO_JSON_OBJECT(val, doc, to_key, output);
551  }
552  void operator()(cryptonote::txout_to_key_public const& output) const
553  {
554  INSERT_INTO_JSON_OBJECT(val, doc, to_key_public, output);
555  }
556  void operator()(cryptonote::txout_to_script const& output) const
557  {
558  INSERT_INTO_JSON_OBJECT(val, doc, to_script, output);
559  }
560  void operator()(cryptonote::txout_to_scripthash const& output) const
561  {
562  INSERT_INTO_JSON_OBJECT(val, doc, to_scripthash, output);
563  }
564  };
565  boost::apply_visitor(add_output{doc, val}, txout.target);
566 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition: document.h:2116
GenericDocument< UTF8<> > Document
GenericDocument with UTF8 encoding.
Definition: document.h:2512
txout_target_v target

◆ toJsonValue() [26/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const cryptonote::connection_info info,
rapidjson::Value val 
)

Definition at line 614 of file json_object.cpp.

615 {
616  val.SetObject();
617 
618  INSERT_INTO_JSON_OBJECT(val, doc, incoming, info.incoming);
619  INSERT_INTO_JSON_OBJECT(val, doc, localhost, info.localhost);
620  INSERT_INTO_JSON_OBJECT(val, doc, local_ip, info.local_ip);
621 
622  INSERT_INTO_JSON_OBJECT(val, doc, ip, info.ip);
623  INSERT_INTO_JSON_OBJECT(val, doc, port, info.port);
624  INSERT_INTO_JSON_OBJECT(val, doc, rpc_port, info.rpc_port);
625 
626  INSERT_INTO_JSON_OBJECT(val, doc, peer_id, info.peer_id);
627 
628  INSERT_INTO_JSON_OBJECT(val, doc, recv_count, info.recv_count);
629  INSERT_INTO_JSON_OBJECT(val, doc, recv_idle_time, info.recv_idle_time);
630 
631  INSERT_INTO_JSON_OBJECT(val, doc, send_count, info.send_count);
632  INSERT_INTO_JSON_OBJECT(val, doc, send_idle_time, info.send_idle_time);
633 
634  INSERT_INTO_JSON_OBJECT(val, doc, state, info.state);
635 
636  INSERT_INTO_JSON_OBJECT(val, doc, live_time, info.live_time);
637 
638  INSERT_INTO_JSON_OBJECT(val, doc, avg_download, info.avg_download);
639  INSERT_INTO_JSON_OBJECT(val, doc, current_download, info.current_download);
640 
641  INSERT_INTO_JSON_OBJECT(val, doc, avg_upload, info.avg_upload);
642  INSERT_INTO_JSON_OBJECT(val, doc, current_upload, info.current_upload);
643 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47
boost::endian::big_uint32_t ip
Definition: socks.cpp:61
boost::endian::big_uint16_t port
Definition: socks.cpp:60
CXA_THROW_INFO_T * info
Definition: stack_trace.cpp:91
Definition: blake256.h:37

◆ toJsonValue() [27/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const cryptonote::block_complete_entry blk,
rapidjson::Value val 
)

Definition at line 680 of file json_object.cpp.

681 {
682  val.SetObject();
683 
684  INSERT_INTO_JSON_OBJECT(val, doc, block, blk.block);
685  INSERT_INTO_JSON_OBJECT(val, doc, transactions, blk.txs);
686 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47
std::vector< blobdata > txs
blobdata block

◆ toJsonValue() [28/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const cryptonote::rpc::block_with_transactions blk,
rapidjson::Value val 
)

Definition at line 700 of file json_object.cpp.

701 {
702  val.SetObject();
703 
704  INSERT_INTO_JSON_OBJECT(val, doc, block, blk.block);
705  INSERT_INTO_JSON_OBJECT(val, doc, transactions, blk.transactions);
706 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47
std::vector< cryptonote::transaction > transactions

◆ toJsonValue() [29/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const cryptonote::rpc::transaction_info tx_info,
rapidjson::Value val 
)

Definition at line 720 of file json_object.cpp.

721 {
722  val.SetObject();
723 
724  INSERT_INTO_JSON_OBJECT(val, doc, height, tx_info.height);
725  INSERT_INTO_JSON_OBJECT(val, doc, in_pool, tx_info.in_pool);
726  INSERT_INTO_JSON_OBJECT(val, doc, transaction, tx_info.transaction);
727 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47
uint64_t height
Definition: blockchain.cpp:91

◆ toJsonValue() [30/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const cryptonote::rpc::output_key_and_amount_index out,
rapidjson::Value val 
)

Definition at line 742 of file json_object.cpp.

743 {
744  val.SetObject();
745 
746  INSERT_INTO_JSON_OBJECT(val, doc, amount_index, out.amount_index);
747  INSERT_INTO_JSON_OBJECT(val, doc, key, out.key);
748 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47
const char * key
Definition: hmac_keccak.cpp:39

◆ toJsonValue() [31/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const cryptonote::rpc::amount_with_random_outputs out,
rapidjson::Value val 
)

Definition at line 762 of file json_object.cpp.

763 {
764  val.SetObject();
765 
766  INSERT_INTO_JSON_OBJECT(val, doc, amount, out.amount);
767  INSERT_INTO_JSON_OBJECT(val, doc, outputs, out.outputs);
768 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47

◆ toJsonValue() [32/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const cryptonote::rpc::peer peer,
rapidjson::Value val 
)

Definition at line 782 of file json_object.cpp.

783 {
784  val.SetObject();
785 
786  INSERT_INTO_JSON_OBJECT(val, doc, id, peer.id);
787  INSERT_INTO_JSON_OBJECT(val, doc, ip, peer.ip);
788  INSERT_INTO_JSON_OBJECT(val, doc, port, peer.port);
789  INSERT_INTO_JSON_OBJECT(val, doc, rpc_port, peer.rpc_port);
790  INSERT_INTO_JSON_OBJECT(val, doc, last_seen, peer.last_seen);
791  INSERT_INTO_JSON_OBJECT(val, doc, pruning_seed, peer.pruning_seed);
792 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47
boost::endian::big_uint32_t ip
Definition: socks.cpp:61
boost::endian::big_uint16_t port
Definition: socks.cpp:60

◆ toJsonValue() [33/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const cryptonote::rpc::tx_in_pool tx,
rapidjson::Value val 
)

Definition at line 810 of file json_object.cpp.

811 {
812  val.SetObject();
813 
814  INSERT_INTO_JSON_OBJECT(val, doc, tx, tx.tx);
815  INSERT_INTO_JSON_OBJECT(val, doc, tx_hash, tx.tx_hash);
816  INSERT_INTO_JSON_OBJECT(val, doc, blob_size, tx.blob_size);
817  INSERT_INTO_JSON_OBJECT(val, doc, weight, tx.weight);
818  INSERT_INTO_JSON_OBJECT(val, doc, fee, tx.fee);
819  INSERT_INTO_JSON_OBJECT(val, doc, max_used_block_hash, tx.max_used_block_hash);
820  INSERT_INTO_JSON_OBJECT(val, doc, max_used_block_height, tx.max_used_block_height);
821  INSERT_INTO_JSON_OBJECT(val, doc, kept_by_block, tx.kept_by_block);
822  INSERT_INTO_JSON_OBJECT(val, doc, last_failed_block_hash, tx.last_failed_block_hash);
823  INSERT_INTO_JSON_OBJECT(val, doc, last_failed_block_height, tx.last_failed_block_height);
824  INSERT_INTO_JSON_OBJECT(val, doc, receive_time, tx.receive_time);
825  INSERT_INTO_JSON_OBJECT(val, doc, last_relayed_time, tx.last_relayed_time);
826  INSERT_INTO_JSON_OBJECT(val, doc, relayed, tx.relayed);
827  INSERT_INTO_JSON_OBJECT(val, doc, do_not_relay, tx.do_not_relay);
828  INSERT_INTO_JSON_OBJECT(val, doc, double_spend_seen, tx.double_spend_seen);
829  INSERT_INTO_JSON_OBJECT(val, doc, nonexistent_utxo_seen, tx.nonexistent_utxo_seen);
830 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47
cryptonote::transaction tx

◆ toJsonValue() [34/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const cryptonote::rpc::hard_fork_info info,
rapidjson::Value val 
)

Definition at line 857 of file json_object.cpp.

858 {
859  val.SetObject();
860 
861  INSERT_INTO_JSON_OBJECT(val, doc, version, info.version);
862  INSERT_INTO_JSON_OBJECT(val, doc, enabled, info.enabled);
863  INSERT_INTO_JSON_OBJECT(val, doc, window, info.window);
864  INSERT_INTO_JSON_OBJECT(val, doc, votes, info.votes);
865  INSERT_INTO_JSON_OBJECT(val, doc, threshold, info.threshold);
866  INSERT_INTO_JSON_OBJECT(val, doc, voting, info.voting);
867  INSERT_INTO_JSON_OBJECT(val, doc, state, info.state);
868  INSERT_INTO_JSON_OBJECT(val, doc, earliest_height, info.earliest_height);
869 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47
version
Supported socks variants.
Definition: socks.h:57
CXA_THROW_INFO_T * info
Definition: stack_trace.cpp:91
Definition: blake256.h:37
uint8_t threshold
Definition: blockchain.cpp:92

◆ toJsonValue() [35/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const cryptonote::rpc::output_amount_count out,
rapidjson::Value val 
)

Definition at line 889 of file json_object.cpp.

890 {
891  val.SetObject();
892 
893  INSERT_INTO_JSON_OBJECT(val, doc, amount, out.amount);
894  INSERT_INTO_JSON_OBJECT(val, doc, total_count, out.total_count);
895  INSERT_INTO_JSON_OBJECT(val, doc, unlocked_count, out.unlocked_count);
896  INSERT_INTO_JSON_OBJECT(val, doc, recent_count, out.recent_count);
897 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47

◆ toJsonValue() [36/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const cryptonote::rpc::output_amount_and_index out,
rapidjson::Value val 
)

Definition at line 913 of file json_object.cpp.

914 {
915  val.SetObject();
916 
917  INSERT_INTO_JSON_OBJECT(val, doc, amount, out.amount);
918  INSERT_INTO_JSON_OBJECT(val, doc, index, out.index);
919 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47

◆ toJsonValue() [37/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const cryptonote::rpc::output_key_mask_unlocked out,
rapidjson::Value val 
)

Definition at line 933 of file json_object.cpp.

934 {
935  val.SetObject();
936 
937  INSERT_INTO_JSON_OBJECT(val, doc, key, out.key);
938  INSERT_INTO_JSON_OBJECT(val, doc, mask, out.mask);
939  INSERT_INTO_JSON_OBJECT(val, doc, unlocked, out.unlocked);
940 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47
const char * key
Definition: hmac_keccak.cpp:39

◆ toJsonValue() [38/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const cryptonote::rpc::error err,
rapidjson::Value val 
)

Definition at line 954 of file json_object.cpp.

955 {
956  val.SetObject();
957 
958  INSERT_INTO_JSON_OBJECT(val, doc, code, err.code);
959  INSERT_INTO_JSON_OBJECT(val, doc, error_str, err.error_str);
960  INSERT_INTO_JSON_OBJECT(val, doc, message, err.message);
961 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47
std::string message("Message requiring signing")
Here is the call graph for this function:

◆ toJsonValue() [39/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const cryptonote::rpc::BlockHeaderResponse response,
rapidjson::Value val 
)

Definition at line 975 of file json_object.cpp.

976 {
977  val.SetObject();
978 
979  INSERT_INTO_JSON_OBJECT(val, doc, major_version, response.major_version);
980  INSERT_INTO_JSON_OBJECT(val, doc, minor_version, response.minor_version);
981  INSERT_INTO_JSON_OBJECT(val, doc, timestamp, response.timestamp);
982  INSERT_INTO_JSON_OBJECT(val, doc, prev_id, response.prev_id);
983  INSERT_INTO_JSON_OBJECT(val, doc, nonce, response.nonce);
984  INSERT_INTO_JSON_OBJECT(val, doc, height, response.height);
985  INSERT_INTO_JSON_OBJECT(val, doc, depth, response.depth);
986  INSERT_INTO_JSON_OBJECT(val, doc, hash, response.hash);
987  INSERT_INTO_JSON_OBJECT(val, doc, difficulty, response.difficulty);
988  INSERT_INTO_JSON_OBJECT(val, doc, reward, response.reward);
989 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47
epee::misc_utils::struct_init< response_t > response
uint64_t height
Definition: blockchain.cpp:91
POD_CLASS hash
Definition: hash.h:50

◆ toJsonValue() [40/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const rct::rctSig sig,
rapidjson::Value val 
)

Definition at line 1010 of file json_object.cpp.

1011 {
1012  using boost::adaptors::transform;
1013 
1014  val.SetObject();
1015 
1016  const auto just_mask = [] (rct::ctkey const& key) -> rct::key const&
1017  {
1018  return key.mask;
1019  };
1020 
1021  INSERT_INTO_JSON_OBJECT(val, doc, type, sig.type);
1022  INSERT_INTO_JSON_OBJECT(val, doc, encrypted, sig.ecdhInfo);
1023  INSERT_INTO_JSON_OBJECT(val, doc, commitments, transform(sig.outPk, just_mask));
1024  INSERT_INTO_JSON_OBJECT(val, doc, fee, sig.txnFee);
1025 
1026  // prunable
1027  {
1028  rapidjson::Value prunable;
1029  prunable.SetObject();
1030 
1031  INSERT_INTO_JSON_OBJECT(prunable, doc, range_proofs, sig.p.rangeSigs);
1032  INSERT_INTO_JSON_OBJECT(prunable, doc, bulletproofs, sig.p.bulletproofs);
1033  INSERT_INTO_JSON_OBJECT(prunable, doc, mlsags, sig.p.MGs);
1034  INSERT_INTO_JSON_OBJECT(prunable, doc, pseudo_outs, sig.get_pseudo_outs());
1035 
1036  val.AddMember("prunable", prunable, doc.GetAllocator());
1037  }
1038 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47
etn_amount txnFee
Definition: rctTypes.h:248
std::vector< mgSig > MGs
Definition: rctTypes.h:321
std::vector< rangeSig > rangeSigs
Definition: rctTypes.h:319
const char * key
Definition: hmac_keccak.cpp:39
uint8_t type
Definition: rctTypes.h:241
std::vector< ecdhTuple > ecdhInfo
Definition: rctTypes.h:246
rctSigPrunable p
Definition: rctTypes.h:437
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition: document.h:2116
ctkeyV outPk
Definition: rctTypes.h:247
std::vector< Bulletproof > bulletproofs
Definition: rctTypes.h:320
keyV & get_pseudo_outs()
Definition: rctTypes.h:439
Here is the call graph for this function:

◆ toJsonValue() [41/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const rct::ecdhTuple tuple,
rapidjson::Value val 
)

Definition at line 1078 of file json_object.cpp.

1079 {
1080  val.SetObject();
1081 
1082  INSERT_INTO_JSON_OBJECT(val, doc, mask, tuple.mask);
1083  INSERT_INTO_JSON_OBJECT(val, doc, amount, tuple.amount);
1084 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47

◆ toJsonValue() [42/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const rct::rangeSig sig,
rapidjson::Value val 
)

Definition at line 1097 of file json_object.cpp.

1098 {
1099  val.SetObject();
1100 
1101  INSERT_INTO_JSON_OBJECT(val, doc, asig, sig.asig);
1102 
1103  std::vector<rct::key> keyVector(sig.Ci, std::end(sig.Ci));
1104  INSERT_INTO_JSON_OBJECT(val, doc, Ci, keyVector);
1105 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47
boroSig asig
Definition: rctTypes.h:170

◆ toJsonValue() [43/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const rct::Bulletproof p,
rapidjson::Value val 
)

Definition at line 1134 of file json_object.cpp.

1135 {
1136  val.SetObject();
1137 
1138  INSERT_INTO_JSON_OBJECT(val, doc, V, p.V);
1139  INSERT_INTO_JSON_OBJECT(val, doc, A, p.A);
1140  INSERT_INTO_JSON_OBJECT(val, doc, S, p.S);
1141  INSERT_INTO_JSON_OBJECT(val, doc, T1, p.T1);
1142  INSERT_INTO_JSON_OBJECT(val, doc, T2, p.T2);
1143  INSERT_INTO_JSON_OBJECT(val, doc, taux, p.taux);
1144  INSERT_INTO_JSON_OBJECT(val, doc, mu, p.mu);
1145  INSERT_INTO_JSON_OBJECT(val, doc, L, p.L);
1146  INSERT_INTO_JSON_OBJECT(val, doc, R, p.R);
1147  INSERT_INTO_JSON_OBJECT(val, doc, a, p.a);
1148  INSERT_INTO_JSON_OBJECT(val, doc, b, p.b);
1149  INSERT_INTO_JSON_OBJECT(val, doc, t, p.t);
1150 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47
rct::key b
Definition: rctTypes.h:185
rct::key S
Definition: rctTypes.h:182
rct::key taux
Definition: rctTypes.h:183
rct::key mu
Definition: rctTypes.h:183
rct::key T2
Definition: rctTypes.h:182
rct::keyV R
Definition: rctTypes.h:184
rct::key A
Definition: rctTypes.h:182
rct::key a
Definition: rctTypes.h:185
rct::keyV L
Definition: rctTypes.h:184
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition: pointer.h:1124
Matcher< T > A()
rct::key T1
Definition: rctTypes.h:182
rct::key t
Definition: rctTypes.h:185
rct::keyV V
Definition: rctTypes.h:181
Here is the call graph for this function:

◆ toJsonValue() [44/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const rct::boroSig sig,
rapidjson::Value val 
)

Definition at line 1173 of file json_object.cpp.

1174 {
1175  val.SetObject();
1176 
1177  std::vector<rct::key> keyVector(sig.s0, std::end(sig.s0));
1178  INSERT_INTO_JSON_OBJECT(val, doc, s0, keyVector);
1179 
1180  keyVector.assign(sig.s1, std::end(sig.s1));
1181  INSERT_INTO_JSON_OBJECT(val, doc, s1, keyVector);
1182 
1183  INSERT_INTO_JSON_OBJECT(val, doc, ee, sig.ee);
1184 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47
key64 s0
Definition: rctTypes.h:140
key64 s1
Definition: rctTypes.h:141

◆ toJsonValue() [45/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const rct::mgSig sig,
rapidjson::Value val 
)

Definition at line 1220 of file json_object.cpp.

1221 {
1222  val.SetObject();
1223 
1224  INSERT_INTO_JSON_OBJECT(val, doc, ss, sig.ss);
1225  INSERT_INTO_JSON_OBJECT(val, doc, cc, sig.cc);
1226 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47
keyM ss
Definition: rctTypes.h:153

◆ toJsonValue() [46/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const cryptonote::rpc::DaemonInfo info,
rapidjson::Value val 
)

Definition at line 1239 of file json_object.cpp.

1240 {
1241  val.SetObject();
1242 
1243  INSERT_INTO_JSON_OBJECT(val, doc, height, info.height);
1244  INSERT_INTO_JSON_OBJECT(val, doc, target_height, info.target_height);
1245  INSERT_INTO_JSON_OBJECT(val, doc, difficulty, info.difficulty);
1246  INSERT_INTO_JSON_OBJECT(val, doc, target, info.target);
1247  INSERT_INTO_JSON_OBJECT(val, doc, tx_count, info.tx_count);
1248  INSERT_INTO_JSON_OBJECT(val, doc, tx_pool_size, info.tx_pool_size);
1249  INSERT_INTO_JSON_OBJECT(val, doc, alt_blocks_count, info.alt_blocks_count);
1250  INSERT_INTO_JSON_OBJECT(val, doc, outgoing_connections_count, info.outgoing_connections_count);
1251  INSERT_INTO_JSON_OBJECT(val, doc, incoming_connections_count, info.incoming_connections_count);
1252  INSERT_INTO_JSON_OBJECT(val, doc, white_peerlist_size, info.white_peerlist_size);
1253  INSERT_INTO_JSON_OBJECT(val, doc, grey_peerlist_size, info.grey_peerlist_size);
1254  INSERT_INTO_JSON_OBJECT(val, doc, mainnet, info.mainnet);
1255  INSERT_INTO_JSON_OBJECT(val, doc, testnet, info.testnet);
1256  INSERT_INTO_JSON_OBJECT(val, doc, stagenet, info.stagenet);
1257  INSERT_INTO_JSON_OBJECT(val, doc, nettype, info.nettype);
1258  INSERT_INTO_JSON_OBJECT(val, doc, top_block_hash, info.top_block_hash);
1259  INSERT_INTO_JSON_OBJECT(val, doc, cumulative_difficulty, info.cumulative_difficulty);
1260  INSERT_INTO_JSON_OBJECT(val, doc, block_size_limit, info.block_size_limit);
1261  INSERT_INTO_JSON_OBJECT(val, doc, block_weight_limit, info.block_weight_limit);
1262  INSERT_INTO_JSON_OBJECT(val, doc, block_size_median, info.block_size_median);
1263  INSERT_INTO_JSON_OBJECT(val, doc, block_weight_median, info.block_weight_median);
1264  INSERT_INTO_JSON_OBJECT(val, doc, start_time, info.start_time);
1265 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47
uint64_t height
Definition: blockchain.cpp:91
CXA_THROW_INFO_T * info
Definition: stack_trace.cpp:91

◆ toJsonValue() [47/47]

void cryptonote::json::toJsonValue ( rapidjson::Document doc,
const cryptonote::rpc::output_distribution dist,
rapidjson::Value val 
)

Definition at line 1298 of file json_object.cpp.

1299 {
1300  val.SetObject();
1301 
1302  INSERT_INTO_JSON_OBJECT(val, doc, distribution, dist.data.distribution);
1303  INSERT_INTO_JSON_OBJECT(val, doc, amount, dist.amount);
1304  INSERT_INTO_JSON_OBJECT(val, doc, start_height, dist.data.start_height);
1305  INSERT_INTO_JSON_OBJECT(val, doc, base, dist.data.base);
1306 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47
std::vector< std::uint64_t > distribution
Definition: rpc_handler.h:46