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

#include "daemon_messages.h"
#include "serialization/json_object.h"

namespace cryptonote
{

namespace rpc
{

const char* const GetHeight::name = "get_height";
const char* const GetBlocksFast::name = "get_blocks_fast";
const char* const GetHashesFast::name = "get_hashes_fast";
const char* const GetTransactions::name = "get_transactions";
const char* const KeyImagesSpent::name = "key_images_spent";
const char* const GetTxGlobalOutputIndices::name = "get_tx_global_output_indices";
const char* const SendRawTx::name = "send_raw_tx";
const char* const SendRawTxHex::name = "send_raw_tx_hex";
const char* const StartMining::name = "start_mining";
const char* const StopMining::name = "stop_mining";
const char* const MiningStatus::name = "mining_status";
const char* const GetInfo::name = "get_info";
const char* const SaveBC::name = "save_bc";
const char* const GetBlockHash::name = "get_block_hash";
const char* const GetLastBlockHeader::name = "get_last_block_header";
const char* const GetBlockHeaderByHash::name = "get_block_header_by_hash";
const char* const GetBlockHeaderByHeight::name = "get_block_header_by_height";
const char* const GetBlockHeadersByHeight::name = "get_block_headers_by_height";
const char* const GetPeerList::name = "get_peer_list";
const char* const SetLogLevel::name = "set_log_level";
const char* const GetTransactionPool::name = "get_transaction_pool";
const char* const HardForkInfo::name = "hard_fork_info";
const char* const GetOutputHistogram::name = "get_output_histogram";
const char* const GetOutputKeys::name = "get_output_keys";
const char* const GetRPCVersion::name = "get_rpc_version";
const char* const GetFeeEstimate::name = "get_dynamic_fee_estimate";
const char* const GetOutputDistribution::name = "get_output_distribution";




rapidjson::Value GetHeight::Request::toJson(rapidjson::Document& doc) const
{
  return Message::toJson(doc);
}

void GetHeight::Request::fromJson(rapidjson::Value& val)
{
}

rapidjson::Value GetHeight::Response::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  auto& al = doc.GetAllocator();

  val.AddMember("height", height, al);

  return val;
}

void GetHeight::Response::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, height, height);
}


rapidjson::Value GetBlocksFast::Request::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  auto& al = doc.GetAllocator();

  INSERT_INTO_JSON_OBJECT(val, doc, block_ids, block_ids);
  val.AddMember("start_height", start_height, al);
  val.AddMember("prune", prune, al);

  return val;
}

void GetBlocksFast::Request::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, block_ids, block_ids);
  GET_FROM_JSON_OBJECT(val, start_height, start_height);
  GET_FROM_JSON_OBJECT(val, prune, prune);
}

rapidjson::Value GetBlocksFast::Response::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  auto& al = doc.GetAllocator();

  INSERT_INTO_JSON_OBJECT(val, doc, blocks, blocks);
  val.AddMember("start_height", start_height, al);
  val.AddMember("current_height", current_height, al);
  INSERT_INTO_JSON_OBJECT(val, doc, output_indices, output_indices);

  return val;
}

void GetBlocksFast::Response::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, blocks, blocks);
  GET_FROM_JSON_OBJECT(val, start_height, start_height);
  GET_FROM_JSON_OBJECT(val, current_height, current_height);
  GET_FROM_JSON_OBJECT(val, output_indices, output_indices);
}


rapidjson::Value GetHashesFast::Request::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  auto& al = doc.GetAllocator();

  INSERT_INTO_JSON_OBJECT(val, doc, known_hashes, known_hashes);
  val.AddMember("start_height", start_height, al);

  return val;
}

void GetHashesFast::Request::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, known_hashes, known_hashes);
  GET_FROM_JSON_OBJECT(val, start_height, start_height);
}

rapidjson::Value GetHashesFast::Response::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  auto& al = doc.GetAllocator();

  INSERT_INTO_JSON_OBJECT(val, doc, hashes, hashes);
  val.AddMember("start_height", start_height, al);
  val.AddMember("current_height", current_height, al);

  return val;
}

void GetHashesFast::Response::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, hashes, hashes);
  GET_FROM_JSON_OBJECT(val, start_height, start_height);
  GET_FROM_JSON_OBJECT(val, current_height, current_height);
}


rapidjson::Value GetTransactions::Request::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  INSERT_INTO_JSON_OBJECT(val, doc, tx_hashes, tx_hashes);

  return val;
}

void GetTransactions::Request::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, tx_hashes, tx_hashes);
}

rapidjson::Value GetTransactions::Response::toJson(rapidjson::Document& doc) const
{
  rapidjson::Value val(rapidjson::kObjectType);

  INSERT_INTO_JSON_OBJECT(val, doc, txs, txs);
  INSERT_INTO_JSON_OBJECT(val, doc, missed_hashes, missed_hashes);

  return val;
}

void GetTransactions::Response::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, txs, txs);
  GET_FROM_JSON_OBJECT(val, missed_hashes, missed_hashes);
}


rapidjson::Value KeyImagesSpent::Request::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  INSERT_INTO_JSON_OBJECT(val, doc, key_images, key_images);

  return val;
}

void KeyImagesSpent::Request::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, key_images, key_images);
}

rapidjson::Value KeyImagesSpent::Response::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  INSERT_INTO_JSON_OBJECT(val, doc, spent_status, spent_status);

  return val;
}

void KeyImagesSpent::Response::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, spent_status, spent_status);
}


rapidjson::Value GetTxGlobalOutputIndices::Request::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  INSERT_INTO_JSON_OBJECT(val, doc, tx_hash, tx_hash);

  return val;
}

void GetTxGlobalOutputIndices::Request::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, tx_hash, tx_hash);
}

rapidjson::Value GetTxGlobalOutputIndices::Response::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  INSERT_INTO_JSON_OBJECT(val, doc, output_indices, output_indices);

  return val;
}

void GetTxGlobalOutputIndices::Response::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, output_indices, output_indices);
}

rapidjson::Value SendRawTx::Request::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  INSERT_INTO_JSON_OBJECT(val, doc, tx, tx);
  INSERT_INTO_JSON_OBJECT(val, doc, relay, relay);

  return val;
}

void SendRawTx::Request::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, tx, tx);
  GET_FROM_JSON_OBJECT(val, relay, relay);
}

rapidjson::Value SendRawTx::Response::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  INSERT_INTO_JSON_OBJECT(val, doc, relayed, relayed);

  return val;
}


void SendRawTx::Response::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, relayed, relayed);
}

rapidjson::Value SendRawTxHex::Request::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  INSERT_INTO_JSON_OBJECT(val, doc, tx_as_hex, tx_as_hex);
  INSERT_INTO_JSON_OBJECT(val, doc, relay, relay);

  return val;
}

void SendRawTxHex::Request::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, tx_as_hex, tx_as_hex);
  GET_FROM_JSON_OBJECT(val, relay, relay);
}

rapidjson::Value StartMining::Request::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  INSERT_INTO_JSON_OBJECT(val, doc, miner_address, miner_address);
  INSERT_INTO_JSON_OBJECT(val, doc, threads_count, threads_count);
  INSERT_INTO_JSON_OBJECT(val, doc, do_background_mining, do_background_mining);
  INSERT_INTO_JSON_OBJECT(val, doc, ignore_battery, ignore_battery);

  return val;
}

void StartMining::Request::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, miner_address, miner_address);
  GET_FROM_JSON_OBJECT(val, threads_count, threads_count);
  GET_FROM_JSON_OBJECT(val, do_background_mining, do_background_mining);
  GET_FROM_JSON_OBJECT(val, ignore_battery, ignore_battery);
}

rapidjson::Value StartMining::Response::toJson(rapidjson::Document& doc) const
{
  return Message::toJson(doc);
}

void StartMining::Response::fromJson(rapidjson::Value& val)
{
}


rapidjson::Value StopMining::Request::toJson(rapidjson::Document& doc) const
{
  return Message::toJson(doc);
}

void StopMining::Request::fromJson(rapidjson::Value& val)
{
}

rapidjson::Value StopMining::Response::toJson(rapidjson::Document& doc) const
{
  return Message::toJson(doc);
}

void StopMining::Response::fromJson(rapidjson::Value& val)
{
}


rapidjson::Value MiningStatus::Request::toJson(rapidjson::Document& doc) const
{
  return Message::toJson(doc);
}

void MiningStatus::Request::fromJson(rapidjson::Value& val)
{
}

rapidjson::Value MiningStatus::Response::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  INSERT_INTO_JSON_OBJECT(val, doc, active, active);
  INSERT_INTO_JSON_OBJECT(val, doc, speed, speed);
  INSERT_INTO_JSON_OBJECT(val, doc, threads_count, threads_count);
  INSERT_INTO_JSON_OBJECT(val, doc, address, address);
  INSERT_INTO_JSON_OBJECT(val, doc, is_background_mining_enabled, is_background_mining_enabled);

  return val;
}

void MiningStatus::Response::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, active, active);
  GET_FROM_JSON_OBJECT(val, speed, speed);
  GET_FROM_JSON_OBJECT(val, threads_count, threads_count);
  GET_FROM_JSON_OBJECT(val, address, address);
  GET_FROM_JSON_OBJECT(val, is_background_mining_enabled, is_background_mining_enabled);
}


rapidjson::Value GetInfo::Request::toJson(rapidjson::Document& doc) const
{
  return Message::toJson(doc);
}

void GetInfo::Request::fromJson(rapidjson::Value& val)
{
}

rapidjson::Value GetInfo::Response::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  INSERT_INTO_JSON_OBJECT(val, doc, info, info);

  return val;
}

void GetInfo::Response::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, info, info);
}


rapidjson::Value SaveBC::Request::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  return val;
}

void SaveBC::Request::fromJson(rapidjson::Value& val)
{
}

rapidjson::Value SaveBC::Response::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  return val;
}

void SaveBC::Response::fromJson(rapidjson::Value& val)
{
}


rapidjson::Value GetBlockHash::Request::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  INSERT_INTO_JSON_OBJECT(val, doc, height, height);

  return val;
}

void GetBlockHash::Request::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, height, height);
}

rapidjson::Value GetBlockHash::Response::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  INSERT_INTO_JSON_OBJECT(val, doc, hash, hash);

  return val;
}

void GetBlockHash::Response::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, hash, hash);
}


rapidjson::Value GetLastBlockHeader::Request::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  return val;
}

void GetLastBlockHeader::Request::fromJson(rapidjson::Value& val)
{
}

rapidjson::Value GetLastBlockHeader::Response::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  INSERT_INTO_JSON_OBJECT(val, doc, header, header);

  return val;
}

void GetLastBlockHeader::Response::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, header, header);
}


rapidjson::Value GetBlockHeaderByHash::Request::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  INSERT_INTO_JSON_OBJECT(val, doc, hash, hash);

  return val;
}

void GetBlockHeaderByHash::Request::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, hash, hash);
}

rapidjson::Value GetBlockHeaderByHash::Response::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  INSERT_INTO_JSON_OBJECT(val, doc, header, header);

  return val;
}

void GetBlockHeaderByHash::Response::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, header, header);
}


rapidjson::Value GetBlockHeaderByHeight::Request::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  INSERT_INTO_JSON_OBJECT(val, doc, height, height);

  return val;
}

void GetBlockHeaderByHeight::Request::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, height, height);
}

rapidjson::Value GetBlockHeaderByHeight::Response::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  INSERT_INTO_JSON_OBJECT(val, doc, header, header);

  return val;
}

void GetBlockHeaderByHeight::Response::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, header, header);
}


rapidjson::Value GetBlockHeadersByHeight::Request::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  INSERT_INTO_JSON_OBJECT(val, doc, heights, heights);

  return val;
}

void GetBlockHeadersByHeight::Request::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, heights, heights);
}

rapidjson::Value GetBlockHeadersByHeight::Response::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  INSERT_INTO_JSON_OBJECT(val, doc, headers, headers);

  return val;
}

void GetBlockHeadersByHeight::Response::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, headers, headers);
}


rapidjson::Value GetPeerList::Request::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  return val;
}

void GetPeerList::Request::fromJson(rapidjson::Value& val)
{
}

rapidjson::Value GetPeerList::Response::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  INSERT_INTO_JSON_OBJECT(val, doc, white_list, white_list);
  INSERT_INTO_JSON_OBJECT(val, doc, gray_list, gray_list);

  return val;
}

void GetPeerList::Response::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, white_list, white_list);
  GET_FROM_JSON_OBJECT(val, gray_list, gray_list);
}


rapidjson::Value SetLogLevel::Request::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  auto& al = doc.GetAllocator();

  val.AddMember("level", level, al);

  return val;
}

void SetLogLevel::Request::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, level, level);
}

rapidjson::Value SetLogLevel::Response::toJson(rapidjson::Document& doc) const
{
  return Message::toJson(doc);
}

void SetLogLevel::Response::fromJson(rapidjson::Value& val)
{
}


rapidjson::Value GetTransactionPool::Request::toJson(rapidjson::Document& doc) const
{
  return Message::toJson(doc);
}

void GetTransactionPool::Request::fromJson(rapidjson::Value& val)
{
}

rapidjson::Value GetTransactionPool::Response::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  INSERT_INTO_JSON_OBJECT(val, doc, transactions, transactions);
  INSERT_INTO_JSON_OBJECT(val, doc, key_images, key_images);

  return val;
}

void GetTransactionPool::Response::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, transactions, transactions);
  GET_FROM_JSON_OBJECT(val, key_images, key_images);
}


rapidjson::Value HardForkInfo::Request::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  INSERT_INTO_JSON_OBJECT(val, doc, version, version);

  return val;
}

void HardForkInfo::Request::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, version, version);
}

rapidjson::Value HardForkInfo::Response::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  INSERT_INTO_JSON_OBJECT(val, doc, info, info);

  return val;
}

void HardForkInfo::Response::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, info, info);
}


rapidjson::Value GetOutputHistogram::Request::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  INSERT_INTO_JSON_OBJECT(val, doc, amounts, amounts);
  INSERT_INTO_JSON_OBJECT(val, doc, min_count, min_count);
  INSERT_INTO_JSON_OBJECT(val, doc, max_count, max_count);
  INSERT_INTO_JSON_OBJECT(val, doc, unlocked, unlocked);
  INSERT_INTO_JSON_OBJECT(val, doc, recent_cutoff, recent_cutoff);

  return val;
}

void GetOutputHistogram::Request::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, amounts, amounts);
  GET_FROM_JSON_OBJECT(val, min_count, min_count);
  GET_FROM_JSON_OBJECT(val, max_count, max_count);
  GET_FROM_JSON_OBJECT(val, unlocked, unlocked);
  GET_FROM_JSON_OBJECT(val, recent_cutoff, recent_cutoff);
}

rapidjson::Value GetOutputHistogram::Response::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  INSERT_INTO_JSON_OBJECT(val, doc, histogram, histogram);

  return val;
}

void GetOutputHistogram::Response::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, histogram, histogram);
}


rapidjson::Value GetOutputKeys::Request::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  INSERT_INTO_JSON_OBJECT(val, doc, outputs, outputs);

  return val;
}

void GetOutputKeys::Request::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, outputs, outputs);
}

rapidjson::Value GetOutputKeys::Response::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  INSERT_INTO_JSON_OBJECT(val, doc, keys, keys);

  return val;
}

void GetOutputKeys::Response::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, keys, keys);
}


rapidjson::Value GetRPCVersion::Request::toJson(rapidjson::Document& doc) const
{
  return Message::toJson(doc);
}

void GetRPCVersion::Request::fromJson(rapidjson::Value& val)
{
}

rapidjson::Value GetRPCVersion::Response::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  INSERT_INTO_JSON_OBJECT(val, doc, version, version);

  return val;
}

void GetRPCVersion::Response::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, version, version);
}

rapidjson::Value GetFeeEstimate::Request::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  INSERT_INTO_JSON_OBJECT(val, doc, num_grace_blocks, num_grace_blocks);

  return val;
}

void GetFeeEstimate::Request::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, num_grace_blocks, num_grace_blocks);
}

rapidjson::Value GetFeeEstimate::Response::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  INSERT_INTO_JSON_OBJECT(val, doc, estimated_base_fee, estimated_base_fee);
  INSERT_INTO_JSON_OBJECT(val, doc, fee_mask, fee_mask);
  INSERT_INTO_JSON_OBJECT(val, doc, size_scale, size_scale);
  INSERT_INTO_JSON_OBJECT(val, doc, hard_fork_version, hard_fork_version);

  return val;
}

void GetFeeEstimate::Response::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, estimated_base_fee, estimated_base_fee);
  GET_FROM_JSON_OBJECT(val, fee_mask, fee_mask);
  GET_FROM_JSON_OBJECT(val, size_scale, size_scale);
  GET_FROM_JSON_OBJECT(val, hard_fork_version, hard_fork_version);
}

rapidjson::Value GetOutputDistribution::Request::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  INSERT_INTO_JSON_OBJECT(val, doc, amounts, amounts);
  INSERT_INTO_JSON_OBJECT(val, doc, from_height, from_height);
  INSERT_INTO_JSON_OBJECT(val, doc, to_height, to_height);
  INSERT_INTO_JSON_OBJECT(val, doc, cumulative, cumulative);

  return val;
}

void GetOutputDistribution::Request::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, amounts, amounts);
  GET_FROM_JSON_OBJECT(val, from_height, from_height);
  GET_FROM_JSON_OBJECT(val, to_height, to_height);
  GET_FROM_JSON_OBJECT(val, cumulative, cumulative);
}

rapidjson::Value GetOutputDistribution::Response::toJson(rapidjson::Document& doc) const
{
  auto val = Message::toJson(doc);

  INSERT_INTO_JSON_OBJECT(val, doc, status, status);
  INSERT_INTO_JSON_OBJECT(val, doc, distributions, distributions);

  return val;
}

void GetOutputDistribution::Response::fromJson(rapidjson::Value& val)
{
  GET_FROM_JSON_OBJECT(val, status, status);
  GET_FROM_JSON_OBJECT(val, distributions, distributions);
}

}  // namespace rpc

}  // namespace cryptonote