Electroneum
daemon_messages.cpp
Go to the documentation of this file.
1 // Copyright (c) 2016-2019, The Monero Project
2 //
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without modification, are
6 // permitted provided that the following conditions are met:
7 //
8 // 1. Redistributions of source code must retain the above copyright notice, this list of
9 // conditions and the following disclaimer.
10 //
11 // 2. Redistributions in binary form must reproduce the above copyright notice, this list
12 // of conditions and the following disclaimer in the documentation and/or other
13 // materials provided with the distribution.
14 //
15 // 3. Neither the name of the copyright holder nor the names of its contributors may be
16 // used to endorse or promote products derived from this software without specific
17 // prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
20 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
22 // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
27 // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 
29 #include "daemon_messages.h"
31 
32 namespace cryptonote
33 {
34 
35 namespace rpc
36 {
37 
38 const char* const GetHeight::name = "get_height";
39 const char* const GetBlocksFast::name = "get_blocks_fast";
40 const char* const GetHashesFast::name = "get_hashes_fast";
41 const char* const GetTransactions::name = "get_transactions";
42 const char* const KeyImagesSpent::name = "key_images_spent";
43 const char* const GetTxGlobalOutputIndices::name = "get_tx_global_output_indices";
44 const char* const SendRawTx::name = "send_raw_tx";
45 const char* const SendRawTxHex::name = "send_raw_tx_hex";
46 const char* const StartMining::name = "start_mining";
47 const char* const StopMining::name = "stop_mining";
48 const char* const MiningStatus::name = "mining_status";
49 const char* const GetInfo::name = "get_info";
50 const char* const SaveBC::name = "save_bc";
51 const char* const GetBlockHash::name = "get_block_hash";
52 const char* const GetLastBlockHeader::name = "get_last_block_header";
53 const char* const GetBlockHeaderByHash::name = "get_block_header_by_hash";
54 const char* const GetBlockHeaderByHeight::name = "get_block_header_by_height";
55 const char* const GetBlockHeadersByHeight::name = "get_block_headers_by_height";
56 const char* const GetPeerList::name = "get_peer_list";
57 const char* const SetLogLevel::name = "set_log_level";
58 const char* const GetTransactionPool::name = "get_transaction_pool";
59 const char* const HardForkInfo::name = "hard_fork_info";
60 const char* const GetOutputHistogram::name = "get_output_histogram";
61 const char* const GetOutputKeys::name = "get_output_keys";
62 const char* const GetRPCVersion::name = "get_rpc_version";
63 const char* const GetFeeEstimate::name = "get_dynamic_fee_estimate";
64 const char* const GetOutputDistribution::name = "get_output_distribution";
65 
66 
67 
68 
69 rapidjson::Value GetHeight::Request::toJson(rapidjson::Document& doc) const
70 {
71  return Message::toJson(doc);
72 }
73 
74 void GetHeight::Request::fromJson(rapidjson::Value& val)
75 {
76 }
77 
78 rapidjson::Value GetHeight::Response::toJson(rapidjson::Document& doc) const
79 {
80  auto val = Message::toJson(doc);
81 
82  auto& al = doc.GetAllocator();
83 
84  val.AddMember("height", height, al);
85 
86  return val;
87 }
88 
89 void GetHeight::Response::fromJson(rapidjson::Value& val)
90 {
92 }
93 
94 
95 rapidjson::Value GetBlocksFast::Request::toJson(rapidjson::Document& doc) const
96 {
97  auto val = Message::toJson(doc);
98 
99  auto& al = doc.GetAllocator();
100 
101  INSERT_INTO_JSON_OBJECT(val, doc, block_ids, block_ids);
102  val.AddMember("start_height", start_height, al);
103  val.AddMember("prune", prune, al);
104 
105  return val;
106 }
107 
108 void GetBlocksFast::Request::fromJson(rapidjson::Value& val)
109 {
110  GET_FROM_JSON_OBJECT(val, block_ids, block_ids);
111  GET_FROM_JSON_OBJECT(val, start_height, start_height);
112  GET_FROM_JSON_OBJECT(val, prune, prune);
113 }
114 
115 rapidjson::Value GetBlocksFast::Response::toJson(rapidjson::Document& doc) const
116 {
117  auto val = Message::toJson(doc);
118 
119  auto& al = doc.GetAllocator();
120 
122  val.AddMember("start_height", start_height, al);
123  val.AddMember("current_height", current_height, al);
124  INSERT_INTO_JSON_OBJECT(val, doc, output_indices, output_indices);
125 
126  return val;
127 }
128 
129 void GetBlocksFast::Response::fromJson(rapidjson::Value& val)
130 {
132  GET_FROM_JSON_OBJECT(val, start_height, start_height);
133  GET_FROM_JSON_OBJECT(val, current_height, current_height);
134  GET_FROM_JSON_OBJECT(val, output_indices, output_indices);
135 }
136 
137 
138 rapidjson::Value GetHashesFast::Request::toJson(rapidjson::Document& doc) const
139 {
140  auto val = Message::toJson(doc);
141 
142  auto& al = doc.GetAllocator();
143 
144  INSERT_INTO_JSON_OBJECT(val, doc, known_hashes, known_hashes);
145  val.AddMember("start_height", start_height, al);
146 
147  return val;
148 }
149 
150 void GetHashesFast::Request::fromJson(rapidjson::Value& val)
151 {
152  GET_FROM_JSON_OBJECT(val, known_hashes, known_hashes);
153  GET_FROM_JSON_OBJECT(val, start_height, start_height);
154 }
155 
156 rapidjson::Value GetHashesFast::Response::toJson(rapidjson::Document& doc) const
157 {
158  auto val = Message::toJson(doc);
159 
160  auto& al = doc.GetAllocator();
161 
163  val.AddMember("start_height", start_height, al);
164  val.AddMember("current_height", current_height, al);
165 
166  return val;
167 }
168 
169 void GetHashesFast::Response::fromJson(rapidjson::Value& val)
170 {
172  GET_FROM_JSON_OBJECT(val, start_height, start_height);
173  GET_FROM_JSON_OBJECT(val, current_height, current_height);
174 }
175 
176 
177 rapidjson::Value GetTransactions::Request::toJson(rapidjson::Document& doc) const
178 {
179  auto val = Message::toJson(doc);
180 
181  INSERT_INTO_JSON_OBJECT(val, doc, tx_hashes, tx_hashes);
182 
183  return val;
184 }
185 
186 void GetTransactions::Request::fromJson(rapidjson::Value& val)
187 {
188  GET_FROM_JSON_OBJECT(val, tx_hashes, tx_hashes);
189 }
190 
191 rapidjson::Value GetTransactions::Response::toJson(rapidjson::Document& doc) const
192 {
194 
195  INSERT_INTO_JSON_OBJECT(val, doc, txs, txs);
196  INSERT_INTO_JSON_OBJECT(val, doc, missed_hashes, missed_hashes);
197 
198  return val;
199 }
200 
201 void GetTransactions::Response::fromJson(rapidjson::Value& val)
202 {
203  GET_FROM_JSON_OBJECT(val, txs, txs);
204  GET_FROM_JSON_OBJECT(val, missed_hashes, missed_hashes);
205 }
206 
207 
208 rapidjson::Value KeyImagesSpent::Request::toJson(rapidjson::Document& doc) const
209 {
210  auto val = Message::toJson(doc);
211 
212  INSERT_INTO_JSON_OBJECT(val, doc, key_images, key_images);
213 
214  return val;
215 }
216 
217 void KeyImagesSpent::Request::fromJson(rapidjson::Value& val)
218 {
219  GET_FROM_JSON_OBJECT(val, key_images, key_images);
220 }
221 
222 rapidjson::Value KeyImagesSpent::Response::toJson(rapidjson::Document& doc) const
223 {
224  auto val = Message::toJson(doc);
225 
226  INSERT_INTO_JSON_OBJECT(val, doc, spent_status, spent_status);
227 
228  return val;
229 }
230 
231 void KeyImagesSpent::Response::fromJson(rapidjson::Value& val)
232 {
233  GET_FROM_JSON_OBJECT(val, spent_status, spent_status);
234 }
235 
236 
237 rapidjson::Value GetTxGlobalOutputIndices::Request::toJson(rapidjson::Document& doc) const
238 {
239  auto val = Message::toJson(doc);
240 
241  INSERT_INTO_JSON_OBJECT(val, doc, tx_hash, tx_hash);
242 
243  return val;
244 }
245 
246 void GetTxGlobalOutputIndices::Request::fromJson(rapidjson::Value& val)
247 {
248  GET_FROM_JSON_OBJECT(val, tx_hash, tx_hash);
249 }
250 
251 rapidjson::Value GetTxGlobalOutputIndices::Response::toJson(rapidjson::Document& doc) const
252 {
253  auto val = Message::toJson(doc);
254 
255  INSERT_INTO_JSON_OBJECT(val, doc, output_indices, output_indices);
256 
257  return val;
258 }
259 
260 void GetTxGlobalOutputIndices::Response::fromJson(rapidjson::Value& val)
261 {
262  GET_FROM_JSON_OBJECT(val, output_indices, output_indices);
263 }
264 
265 rapidjson::Value SendRawTx::Request::toJson(rapidjson::Document& doc) const
266 {
267  auto val = Message::toJson(doc);
268 
269  INSERT_INTO_JSON_OBJECT(val, doc, tx, tx);
270  INSERT_INTO_JSON_OBJECT(val, doc, relay, relay);
271 
272  return val;
273 }
274 
275 void SendRawTx::Request::fromJson(rapidjson::Value& val)
276 {
277  GET_FROM_JSON_OBJECT(val, tx, tx);
278  GET_FROM_JSON_OBJECT(val, relay, relay);
279 }
280 
281 rapidjson::Value SendRawTx::Response::toJson(rapidjson::Document& doc) const
282 {
283  auto val = Message::toJson(doc);
284 
285  INSERT_INTO_JSON_OBJECT(val, doc, relayed, relayed);
286 
287  return val;
288 }
289 
290 
291 void SendRawTx::Response::fromJson(rapidjson::Value& val)
292 {
293  GET_FROM_JSON_OBJECT(val, relayed, relayed);
294 }
295 
296 rapidjson::Value SendRawTxHex::Request::toJson(rapidjson::Document& doc) const
297 {
298  auto val = Message::toJson(doc);
299 
300  INSERT_INTO_JSON_OBJECT(val, doc, tx_as_hex, tx_as_hex);
301  INSERT_INTO_JSON_OBJECT(val, doc, relay, relay);
302 
303  return val;
304 }
305 
306 void SendRawTxHex::Request::fromJson(rapidjson::Value& val)
307 {
308  GET_FROM_JSON_OBJECT(val, tx_as_hex, tx_as_hex);
309  GET_FROM_JSON_OBJECT(val, relay, relay);
310 }
311 
312 rapidjson::Value StartMining::Request::toJson(rapidjson::Document& doc) const
313 {
314  auto val = Message::toJson(doc);
315 
316  INSERT_INTO_JSON_OBJECT(val, doc, miner_address, miner_address);
317  INSERT_INTO_JSON_OBJECT(val, doc, threads_count, threads_count);
318  INSERT_INTO_JSON_OBJECT(val, doc, do_background_mining, do_background_mining);
319  INSERT_INTO_JSON_OBJECT(val, doc, ignore_battery, ignore_battery);
320 
321  return val;
322 }
323 
324 void StartMining::Request::fromJson(rapidjson::Value& val)
325 {
326  GET_FROM_JSON_OBJECT(val, miner_address, miner_address);
327  GET_FROM_JSON_OBJECT(val, threads_count, threads_count);
328  GET_FROM_JSON_OBJECT(val, do_background_mining, do_background_mining);
329  GET_FROM_JSON_OBJECT(val, ignore_battery, ignore_battery);
330 }
331 
332 rapidjson::Value StartMining::Response::toJson(rapidjson::Document& doc) const
333 {
334  return Message::toJson(doc);
335 }
336 
337 void StartMining::Response::fromJson(rapidjson::Value& val)
338 {
339 }
340 
341 
342 rapidjson::Value StopMining::Request::toJson(rapidjson::Document& doc) const
343 {
344  return Message::toJson(doc);
345 }
346 
347 void StopMining::Request::fromJson(rapidjson::Value& val)
348 {
349 }
350 
351 rapidjson::Value StopMining::Response::toJson(rapidjson::Document& doc) const
352 {
353  return Message::toJson(doc);
354 }
355 
356 void StopMining::Response::fromJson(rapidjson::Value& val)
357 {
358 }
359 
360 
361 rapidjson::Value MiningStatus::Request::toJson(rapidjson::Document& doc) const
362 {
363  return Message::toJson(doc);
364 }
365 
366 void MiningStatus::Request::fromJson(rapidjson::Value& val)
367 {
368 }
369 
370 rapidjson::Value MiningStatus::Response::toJson(rapidjson::Document& doc) const
371 {
372  auto val = Message::toJson(doc);
373 
374  INSERT_INTO_JSON_OBJECT(val, doc, active, active);
375  INSERT_INTO_JSON_OBJECT(val, doc, speed, speed);
376  INSERT_INTO_JSON_OBJECT(val, doc, threads_count, threads_count);
378  INSERT_INTO_JSON_OBJECT(val, doc, is_background_mining_enabled, is_background_mining_enabled);
379 
380  return val;
381 }
382 
383 void MiningStatus::Response::fromJson(rapidjson::Value& val)
384 {
385  GET_FROM_JSON_OBJECT(val, active, active);
386  GET_FROM_JSON_OBJECT(val, speed, speed);
387  GET_FROM_JSON_OBJECT(val, threads_count, threads_count);
389  GET_FROM_JSON_OBJECT(val, is_background_mining_enabled, is_background_mining_enabled);
390 }
391 
392 
393 rapidjson::Value GetInfo::Request::toJson(rapidjson::Document& doc) const
394 {
395  return Message::toJson(doc);
396 }
397 
398 void GetInfo::Request::fromJson(rapidjson::Value& val)
399 {
400 }
401 
402 rapidjson::Value GetInfo::Response::toJson(rapidjson::Document& doc) const
403 {
404  auto val = Message::toJson(doc);
405 
406  INSERT_INTO_JSON_OBJECT(val, doc, info, info);
407 
408  return val;
409 }
410 
411 void GetInfo::Response::fromJson(rapidjson::Value& val)
412 {
414 }
415 
416 
417 rapidjson::Value SaveBC::Request::toJson(rapidjson::Document& doc) const
418 {
419  auto val = Message::toJson(doc);
420 
421  return val;
422 }
423 
424 void SaveBC::Request::fromJson(rapidjson::Value& val)
425 {
426 }
427 
428 rapidjson::Value SaveBC::Response::toJson(rapidjson::Document& doc) const
429 {
430  auto val = Message::toJson(doc);
431 
432  return val;
433 }
434 
435 void SaveBC::Response::fromJson(rapidjson::Value& val)
436 {
437 }
438 
439 
440 rapidjson::Value GetBlockHash::Request::toJson(rapidjson::Document& doc) const
441 {
442  auto val = Message::toJson(doc);
443 
445 
446  return val;
447 }
448 
449 void GetBlockHash::Request::fromJson(rapidjson::Value& val)
450 {
452 }
453 
454 rapidjson::Value GetBlockHash::Response::toJson(rapidjson::Document& doc) const
455 {
456  auto val = Message::toJson(doc);
457 
458  INSERT_INTO_JSON_OBJECT(val, doc, hash, hash);
459 
460  return val;
461 }
462 
463 void GetBlockHash::Response::fromJson(rapidjson::Value& val)
464 {
466 }
467 
468 
469 rapidjson::Value GetLastBlockHeader::Request::toJson(rapidjson::Document& doc) const
470 {
471  auto val = Message::toJson(doc);
472 
473  return val;
474 }
475 
476 void GetLastBlockHeader::Request::fromJson(rapidjson::Value& val)
477 {
478 }
479 
480 rapidjson::Value GetLastBlockHeader::Response::toJson(rapidjson::Document& doc) const
481 {
482  auto val = Message::toJson(doc);
483 
484  INSERT_INTO_JSON_OBJECT(val, doc, header, header);
485 
486  return val;
487 }
488 
489 void GetLastBlockHeader::Response::fromJson(rapidjson::Value& val)
490 {
491  GET_FROM_JSON_OBJECT(val, header, header);
492 }
493 
494 
495 rapidjson::Value GetBlockHeaderByHash::Request::toJson(rapidjson::Document& doc) const
496 {
497  auto val = Message::toJson(doc);
498 
499  INSERT_INTO_JSON_OBJECT(val, doc, hash, hash);
500 
501  return val;
502 }
503 
504 void GetBlockHeaderByHash::Request::fromJson(rapidjson::Value& val)
505 {
507 }
508 
509 rapidjson::Value GetBlockHeaderByHash::Response::toJson(rapidjson::Document& doc) const
510 {
511  auto val = Message::toJson(doc);
512 
513  INSERT_INTO_JSON_OBJECT(val, doc, header, header);
514 
515  return val;
516 }
517 
518 void GetBlockHeaderByHash::Response::fromJson(rapidjson::Value& val)
519 {
520  GET_FROM_JSON_OBJECT(val, header, header);
521 }
522 
523 
524 rapidjson::Value GetBlockHeaderByHeight::Request::toJson(rapidjson::Document& doc) const
525 {
526  auto val = Message::toJson(doc);
527 
529 
530  return val;
531 }
532 
533 void GetBlockHeaderByHeight::Request::fromJson(rapidjson::Value& val)
534 {
536 }
537 
538 rapidjson::Value GetBlockHeaderByHeight::Response::toJson(rapidjson::Document& doc) const
539 {
540  auto val = Message::toJson(doc);
541 
542  INSERT_INTO_JSON_OBJECT(val, doc, header, header);
543 
544  return val;
545 }
546 
547 void GetBlockHeaderByHeight::Response::fromJson(rapidjson::Value& val)
548 {
549  GET_FROM_JSON_OBJECT(val, header, header);
550 }
551 
552 
553 rapidjson::Value GetBlockHeadersByHeight::Request::toJson(rapidjson::Document& doc) const
554 {
555  auto val = Message::toJson(doc);
556 
557  INSERT_INTO_JSON_OBJECT(val, doc, heights, heights);
558 
559  return val;
560 }
561 
562 void GetBlockHeadersByHeight::Request::fromJson(rapidjson::Value& val)
563 {
564  GET_FROM_JSON_OBJECT(val, heights, heights);
565 }
566 
567 rapidjson::Value GetBlockHeadersByHeight::Response::toJson(rapidjson::Document& doc) const
568 {
569  auto val = Message::toJson(doc);
570 
571  INSERT_INTO_JSON_OBJECT(val, doc, headers, headers);
572 
573  return val;
574 }
575 
576 void GetBlockHeadersByHeight::Response::fromJson(rapidjson::Value& val)
577 {
578  GET_FROM_JSON_OBJECT(val, headers, headers);
579 }
580 
581 
582 rapidjson::Value GetPeerList::Request::toJson(rapidjson::Document& doc) const
583 {
584  auto val = Message::toJson(doc);
585 
586  return val;
587 }
588 
589 void GetPeerList::Request::fromJson(rapidjson::Value& val)
590 {
591 }
592 
593 rapidjson::Value GetPeerList::Response::toJson(rapidjson::Document& doc) const
594 {
595  auto val = Message::toJson(doc);
596 
597  INSERT_INTO_JSON_OBJECT(val, doc, white_list, white_list);
598  INSERT_INTO_JSON_OBJECT(val, doc, gray_list, gray_list);
599 
600  return val;
601 }
602 
603 void GetPeerList::Response::fromJson(rapidjson::Value& val)
604 {
605  GET_FROM_JSON_OBJECT(val, white_list, white_list);
606  GET_FROM_JSON_OBJECT(val, gray_list, gray_list);
607 }
608 
609 
610 rapidjson::Value SetLogLevel::Request::toJson(rapidjson::Document& doc) const
611 {
612  auto val = Message::toJson(doc);
613 
614  auto& al = doc.GetAllocator();
615 
616  val.AddMember("level", level, al);
617 
618  return val;
619 }
620 
621 void SetLogLevel::Request::fromJson(rapidjson::Value& val)
622 {
623  GET_FROM_JSON_OBJECT(val, level, level);
624 }
625 
626 rapidjson::Value SetLogLevel::Response::toJson(rapidjson::Document& doc) const
627 {
628  return Message::toJson(doc);
629 }
630 
631 void SetLogLevel::Response::fromJson(rapidjson::Value& val)
632 {
633 }
634 
635 
636 rapidjson::Value GetTransactionPool::Request::toJson(rapidjson::Document& doc) const
637 {
638  return Message::toJson(doc);
639 }
640 
641 void GetTransactionPool::Request::fromJson(rapidjson::Value& val)
642 {
643 }
644 
645 rapidjson::Value GetTransactionPool::Response::toJson(rapidjson::Document& doc) const
646 {
647  auto val = Message::toJson(doc);
648 
649  INSERT_INTO_JSON_OBJECT(val, doc, transactions, transactions);
650  INSERT_INTO_JSON_OBJECT(val, doc, key_images, key_images);
651 
652  return val;
653 }
654 
655 void GetTransactionPool::Response::fromJson(rapidjson::Value& val)
656 {
657  GET_FROM_JSON_OBJECT(val, transactions, transactions);
658  GET_FROM_JSON_OBJECT(val, key_images, key_images);
659 }
660 
661 
662 rapidjson::Value HardForkInfo::Request::toJson(rapidjson::Document& doc) const
663 {
664  auto val = Message::toJson(doc);
665 
667 
668  return val;
669 }
670 
671 void HardForkInfo::Request::fromJson(rapidjson::Value& val)
672 {
674 }
675 
676 rapidjson::Value HardForkInfo::Response::toJson(rapidjson::Document& doc) const
677 {
678  auto val = Message::toJson(doc);
679 
680  INSERT_INTO_JSON_OBJECT(val, doc, info, info);
681 
682  return val;
683 }
684 
685 void HardForkInfo::Response::fromJson(rapidjson::Value& val)
686 {
688 }
689 
690 
691 rapidjson::Value GetOutputHistogram::Request::toJson(rapidjson::Document& doc) const
692 {
693  auto val = Message::toJson(doc);
694 
695  INSERT_INTO_JSON_OBJECT(val, doc, amounts, amounts);
696  INSERT_INTO_JSON_OBJECT(val, doc, min_count, min_count);
697  INSERT_INTO_JSON_OBJECT(val, doc, max_count, max_count);
698  INSERT_INTO_JSON_OBJECT(val, doc, unlocked, unlocked);
699  INSERT_INTO_JSON_OBJECT(val, doc, recent_cutoff, recent_cutoff);
700 
701  return val;
702 }
703 
704 void GetOutputHistogram::Request::fromJson(rapidjson::Value& val)
705 {
706  GET_FROM_JSON_OBJECT(val, amounts, amounts);
707  GET_FROM_JSON_OBJECT(val, min_count, min_count);
708  GET_FROM_JSON_OBJECT(val, max_count, max_count);
709  GET_FROM_JSON_OBJECT(val, unlocked, unlocked);
710  GET_FROM_JSON_OBJECT(val, recent_cutoff, recent_cutoff);
711 }
712 
713 rapidjson::Value GetOutputHistogram::Response::toJson(rapidjson::Document& doc) const
714 {
715  auto val = Message::toJson(doc);
716 
717  INSERT_INTO_JSON_OBJECT(val, doc, histogram, histogram);
718 
719  return val;
720 }
721 
722 void GetOutputHistogram::Response::fromJson(rapidjson::Value& val)
723 {
724  GET_FROM_JSON_OBJECT(val, histogram, histogram);
725 }
726 
727 
728 rapidjson::Value GetOutputKeys::Request::toJson(rapidjson::Document& doc) const
729 {
730  auto val = Message::toJson(doc);
731 
732  INSERT_INTO_JSON_OBJECT(val, doc, outputs, outputs);
733 
734  return val;
735 }
736 
737 void GetOutputKeys::Request::fromJson(rapidjson::Value& val)
738 {
739  GET_FROM_JSON_OBJECT(val, outputs, outputs);
740 }
741 
742 rapidjson::Value GetOutputKeys::Response::toJson(rapidjson::Document& doc) const
743 {
744  auto val = Message::toJson(doc);
745 
746  INSERT_INTO_JSON_OBJECT(val, doc, keys, keys);
747 
748  return val;
749 }
750 
751 void GetOutputKeys::Response::fromJson(rapidjson::Value& val)
752 {
753  GET_FROM_JSON_OBJECT(val, keys, keys);
754 }
755 
756 
757 rapidjson::Value GetRPCVersion::Request::toJson(rapidjson::Document& doc) const
758 {
759  return Message::toJson(doc);
760 }
761 
762 void GetRPCVersion::Request::fromJson(rapidjson::Value& val)
763 {
764 }
765 
766 rapidjson::Value GetRPCVersion::Response::toJson(rapidjson::Document& doc) const
767 {
768  auto val = Message::toJson(doc);
769 
771 
772  return val;
773 }
774 
775 void GetRPCVersion::Response::fromJson(rapidjson::Value& val)
776 {
778 }
779 
780 rapidjson::Value GetFeeEstimate::Request::toJson(rapidjson::Document& doc) const
781 {
782  auto val = Message::toJson(doc);
783 
784  INSERT_INTO_JSON_OBJECT(val, doc, num_grace_blocks, num_grace_blocks);
785 
786  return val;
787 }
788 
789 void GetFeeEstimate::Request::fromJson(rapidjson::Value& val)
790 {
791  GET_FROM_JSON_OBJECT(val, num_grace_blocks, num_grace_blocks);
792 }
793 
794 rapidjson::Value GetFeeEstimate::Response::toJson(rapidjson::Document& doc) const
795 {
796  auto val = Message::toJson(doc);
797 
798  INSERT_INTO_JSON_OBJECT(val, doc, estimated_base_fee, estimated_base_fee);
799  INSERT_INTO_JSON_OBJECT(val, doc, fee_mask, fee_mask);
800  INSERT_INTO_JSON_OBJECT(val, doc, size_scale, size_scale);
801  INSERT_INTO_JSON_OBJECT(val, doc, hard_fork_version, hard_fork_version);
802 
803  return val;
804 }
805 
806 void GetFeeEstimate::Response::fromJson(rapidjson::Value& val)
807 {
808  GET_FROM_JSON_OBJECT(val, estimated_base_fee, estimated_base_fee);
809  GET_FROM_JSON_OBJECT(val, fee_mask, fee_mask);
810  GET_FROM_JSON_OBJECT(val, size_scale, size_scale);
811  GET_FROM_JSON_OBJECT(val, hard_fork_version, hard_fork_version);
812 }
813 
814 rapidjson::Value GetOutputDistribution::Request::toJson(rapidjson::Document& doc) const
815 {
816  auto val = Message::toJson(doc);
817 
818  INSERT_INTO_JSON_OBJECT(val, doc, amounts, amounts);
819  INSERT_INTO_JSON_OBJECT(val, doc, from_height, from_height);
820  INSERT_INTO_JSON_OBJECT(val, doc, to_height, to_height);
821  INSERT_INTO_JSON_OBJECT(val, doc, cumulative, cumulative);
822 
823  return val;
824 }
825 
826 void GetOutputDistribution::Request::fromJson(rapidjson::Value& val)
827 {
828  GET_FROM_JSON_OBJECT(val, amounts, amounts);
829  GET_FROM_JSON_OBJECT(val, from_height, from_height);
830  GET_FROM_JSON_OBJECT(val, to_height, to_height);
831  GET_FROM_JSON_OBJECT(val, cumulative, cumulative);
832 }
833 
834 rapidjson::Value GetOutputDistribution::Response::toJson(rapidjson::Document& doc) const
835 {
836  auto val = Message::toJson(doc);
837 
838  INSERT_INTO_JSON_OBJECT(val, doc, status, status);
839  INSERT_INTO_JSON_OBJECT(val, doc, distributions, distributions);
840 
841  return val;
842 }
843 
844 void GetOutputDistribution::Response::fromJson(rapidjson::Value& val)
845 {
846  GET_FROM_JSON_OBJECT(val, status, status);
847  GET_FROM_JSON_OBJECT(val, distributions, distributions);
848 }
849 
850 } // namespace rpc
851 
852 } // namespace cryptonote
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47
object
Definition: rapidjson.h:624
uint64_t height
Definition: blockchain.cpp:91
virtual rapidjson::Value toJson(rapidjson::Document &doc) const
Definition: message.cpp:57
#define GET_FROM_JSON_OBJECT(source, dst, key)
Definition: json_object.h:52
const char * name
struct hash_func hashes[]
Holds cryptonote related classes and helpers.
Definition: ban.cpp:40
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition: document.h:2116
GenericDocument< UTF8<> > Document
GenericDocument with UTF8 encoding.
Definition: document.h:2512
version
Supported socks variants.
Definition: socks.h:57
CXA_THROW_INFO_T * info
Definition: stack_trace.cpp:91
POD_CLASS hash
Definition: hash.h:50
const char * address
Definition: multisig.cpp:37