aboutsummaryrefslogtreecommitdiff
path: root/utils/python-rpc/framework/wallet.py
blob: e42b99239edddd8676e9355167423220629372fb (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
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
# Copyright (c) 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.

"""Daemon class to make rpc calls and store state."""

from .rpc import JSONRPC 

class Wallet(object):

    def __init__(self, protocol='http', host='127.0.0.1', port=0, idx=0):
        self.host = host
        self.port = port
        self.rpc = JSONRPC('{protocol}://{host}:{port}'.format(protocol=protocol, host=host, port=port if port else 18090+idx))

    def transfer(self, destinations, account_index = 0, subaddr_indices = [], priority = 0, ring_size = 0, unlock_time = 0, payment_id = '', get_tx_key = True, do_not_relay = False, get_tx_hex = False, get_tx_metadata = False):
        transfer = {
            'method': 'transfer',
            'params': {
                'destinations': destinations,
                'account_index': account_index,
                'subaddr_indices': subaddr_indices,
                'priority': priority,
                'ring_size' : ring_size,
                'unlock_time' : unlock_time,
                'payment_id' : payment_id,
                'get_tx_key' : get_tx_key,
                'do_not_relay' : do_not_relay,
                'get_tx_hex' : get_tx_hex,
                'get_tx_metadata' : get_tx_metadata,
            },
            'jsonrpc': '2.0', 
            'id': '0'    
        }
        return self.rpc.send_json_rpc_request(transfer)   

    def transfer_split(self, destinations, account_index = 0, subaddr_indices = [], priority = 0, ring_size = 0, unlock_time = 0, payment_id = '', get_tx_key = True, do_not_relay = False, get_tx_hex = False, get_tx_metadata = False):
        transfer = {
            "method": "transfer_split",
            "params": {
                'destinations': destinations,
                'account_index': account_index,
                'subaddr_indices': subaddr_indices,
                'priority': priority,
                'ring_size' : ring_size,
                'unlock_time' : unlock_time,
                'payment_id' : payment_id,
                'get_tx_key' : get_tx_key,
                'do_not_relay' : do_not_relay,
                'get_tx_hex' : get_tx_hex,
                'get_tx_metadata' : get_tx_metadata,
            },
            "jsonrpc": "2.0", 
            "id": "0"    
        }
        return self.rpc.send_json_rpc_request(transfer)   

    def get_transfer_by_txid(self, txid, account_index = 0):
        get_transfer_by_txid = {
            'method': 'get_transfer_by_txid',
            'params': {
                'txid': txid,
                'account_index': account_index,
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(get_transfer_by_txid)

    def get_payments(self, payment_id):
        get_payments = {
            'method': 'get_payments',
            'params': {
                'payment_id': payment_id,
            },
            'jsonrpc': '2.0',
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(get_payments)

    def get_bulk_payments(self, payment_ids = [], min_block_height = 0):
        get_bulk_payments = {
            'method': 'get_bulk_payments',
            'params': {
                'payment_ids': payment_ids,
                'min_block_height': min_block_height,
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(get_bulk_payments)

    def describe_transfer(self, unsigned_txset = '', multisig_txset = ''):
        describe_transfer = {
            'method': 'describe_transfer',
            'params': {
                'unsigned_txset': unsigned_txset,
                'multisig_txset': multisig_txset,
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(describe_transfer)

    def create_wallet(self, filename='', password = '', language = 'English'):
        create_wallet = {
            'method': 'create_wallet',
            'params': {
                'filename': filename,
                'password': password,
                'language': language
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(create_wallet)

    def get_balance(self, account_index = 0, address_indices = [], all_accounts = False, strict = False):
        get_balance = {
            'method': 'get_balance',
            'params': {
                'account_index': account_index,
                'address_indices': address_indices,
                'all_accounts': all_accounts,
                'strict': strict,
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(get_balance)

    def sweep_dust(self, get_tx_keys = True, do_not_relay = False, get_tx_hex = False, get_tx_metadata = False):
        sweep_dust = {
            'method': 'sweep_dust',
            'params': {
                'get_tx_keys': get_tx_keys,
                'do_not_relay': do_not_relay,
                'get_tx_hex': get_tx_hex,
                'get_tx_metadata': get_tx_metadata,
            },
            'jsonrpc': '2.0', 
            'id': '0'   
        }
        return self.rpc.send_json_rpc_request(sweep_dust)

    def sweep_all(self, address = '', account_index = 0, subaddr_indices = [], priority = 0, ring_size = 0, outputs = 1, unlock_time = 0, payment_id = '', get_tx_keys = False, below_amount = 0, do_not_relay = False, get_tx_hex = False, get_tx_metadata = False):
        sweep_all = {
            'method': 'sweep_all',
            'params' : {
                'address' : address,
                'account_index' : account_index,
                'subaddr_indices' : subaddr_indices,
                'priority' : priority,
                'ring_size' : ring_size,
                'outputs' : outputs,
                'unlock_time' : unlock_time,
                'payment_id' : payment_id,
                'get_tx_keys' : get_tx_keys,
                'below_amount' : below_amount,
                'do_not_relay' : do_not_relay,
                'get_tx_hex' : get_tx_hex,
                'get_tx_metadata' : get_tx_metadata,
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(sweep_all)

    def sweep_single(self, address = '', priority = 0, ring_size = 0, outputs = 1, unlock_time = 0, payment_id = '', get_tx_keys = False, key_image = "", do_not_relay = False, get_tx_hex = False, get_tx_metadata = False):
        sweep_single = {
            'method': 'sweep_single',
            'params' : {
                'address' : address,
                'priority' : priority,
                'ring_size' : ring_size,
                'outputs' : outputs,
                'unlock_time' : unlock_time,
                'payment_id' : payment_id,
                'get_tx_keys' : get_tx_keys,
                'key_image' : key_image,
                'do_not_relay' : do_not_relay,
                'get_tx_hex' : get_tx_hex,
                'get_tx_metadata' : get_tx_metadata,
            },
            'jsonrpc': '2.0',
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(sweep_single)

    def get_address(self, account_index = 0, subaddresses = []):
        get_address = {
            'method': 'get_address',
            'params' : {
                'account_index' : account_index,
                'address_index': subaddresses
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(get_address)

    def create_account(self, label = ""):
        create_account = {
            'method': 'create_account',
            'params' : {
                'label': label
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(create_account)

    def create_address(self, account_index = 0, label = ""):
        create_address = {
            'method': 'create_address',
            'params' : {
                'account_index': account_index,
                'label': label
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(create_address)

    def label_address(self, subaddress_index, label):
        label_address = {
            'method': 'label_address',
            'params' : {
                'index': { 'major': subaddress_index[0], 'minor': subaddress_index[1]},
                'label': label
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(label_address)

    def label_account(self, account_index, label):
        label_account = {
            'method': 'label_account',
            'params' : {
                'account_index': account_index,
                'label': label
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(label_account)

    def get_address_index(self, address):
        get_address_index = {
            'method': 'get_address_index',
            'params' : {
                'address': address
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(get_address_index)

    def query_key(self, key_type):
        query_key = {
            'method': 'query_key',
            'params' : {
                'key_type': key_type
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(query_key)

    def restore_deterministic_wallet(self, seed = '', seed_offset = '', filename = '', restore_height = 0, password = '', language = '', autosave_current = True):
        restore_deterministic_wallet = {
            'method': 'restore_deterministic_wallet',
            'params' : {
                'restore_height': restore_height,
                'filename': filename,
                'seed': seed,
                'seed_offset': seed_offset,
                'password': password,
                'language': language,
                'autosave_current': autosave_current,
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(restore_deterministic_wallet)

    def generate_from_keys(self, restore_height = 0, filename = "", password = "", address = "", spendkey = "", viewkey = "", autosave_current = True):
        generate_from_keys = {
            'method': 'generate_from_keys',
            'params' : {
                'restore_height': restore_height,
                'filename': filename,
                'address': address,
                'spendkey': spendkey,
                'viewkey': viewkey,
                'password': password,
                'autosave_current': autosave_current,
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(generate_from_keys)

    def open_wallet(self, filename, password='', autosave_current = True):
        open_wallet = {
            'method': 'open_wallet',
            'params' : {
                'filename': filename,
                'password': password,
                'autosave_current': autosave_current,
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(open_wallet)

    def close_wallet(self, autosave_current = True):
        close_wallet = {
            'method': 'close_wallet',
            'params' : {
                'autosave_current': autosave_current
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(close_wallet)

    def change_wallet_password(self, old_password, new_password):
        change_wallet_password = {
            'method': 'change_wallet_password',
            'params' : {
                'old_password': old_password,
                'new_password': new_password,
            },
            'jsonrpc': '2.0',
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(change_wallet_password)

    def store(self):
        store = {
            'method': 'store',
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(store)

    def stop_wallet(self):
        stop_wallet = {
            'method': 'stop_wallet',
            'jsonrpc': '2.0',
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(stop_wallet)

    def refresh(self):
        refresh = {
            'method': 'refresh',
            'params' : {
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(refresh)

    def incoming_transfers(self, transfer_type='all', account_index = 0, subaddr_indices = []):
        incoming_transfers = {
            'method': 'incoming_transfers',
            'params' : {
                'transfer_type': transfer_type,
                'account_index': account_index,
                'subaddr_indices': subaddr_indices,
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(incoming_transfers)

    def get_transfers(self, in_ = True, out = True, pending = True, failed = True, pool = True, min_height = None, max_height = None, account_index = 0, subaddr_indices = [], all_accounts = False):
        get_transfers = {
            'method': 'get_transfers',
            'params' : {
                'in': in_,
                'out': out,
                'pending': pending,
                'failed': failed,
                'pool': pool,
                'min_height': min_height,
                'max_height': max_height,
                'filter_by_height': min_height or max_height,
                'account_index': account_index,
                'subaddr_indices': subaddr_indices,
                'all_accounts': all_accounts,
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(get_transfers)

    def make_integrated_address(self, standard_address = '', payment_id = ''):
        make_integrated_address = {
            'method': 'make_integrated_address',
            'params' : {
                'standard_address': standard_address,
                'payment_id': payment_id,
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(make_integrated_address)

    def split_integrated_address(self, integrated_address):
        split_integrated_address = {
            'method': 'split_integrated_address',
            'params' : {
                'integrated_address': integrated_address,
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(split_integrated_address)

    def auto_refresh(self, enable, period = 0):
        auto_refresh = {
            'method': 'auto_refresh',
            'params' : {
                'enable': enable,
                'period': period
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(auto_refresh)

    def set_daemon(self, address, trusted = False, ssl_support = "autodetect", ssl_private_key_path = "", ssl_certificate_path = "", ssl_allowed_certificates = [], ssl_allowed_fingerprints = [], ssl_allow_any_cert = False):
        set_daemon = {
            'method': 'set_daemon',
            'params' : {
                'address': address,
                'trusted': trusted,
                'ssl_support': ssl_support,
                'ssl_private_key_path': ssl_private_key_path,
                'ssl_certificate_path': ssl_certificate_path,
                'ssl_allowed_certificates': ssl_allowed_certificates,
                'ssl_allowed_fingerprints': ssl_allowed_fingerprints,
                'ssl_allow_any_cert': ssl_allow_any_cert,
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(set_daemon)

    def is_multisig(self):
        is_multisig = {
            'method': 'is_multisig',
            'params' : {
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(is_multisig)

    def prepare_multisig(self):
        prepare_multisig = {
            'method': 'prepare_multisig',
            'params' : {
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(prepare_multisig)

    def make_multisig(self, multisig_info, threshold, password = ''):
        make_multisig = {
            'method': 'make_multisig',
            'params' : {
                'multisig_info': multisig_info,
                'threshold': threshold,
                'password': password,
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(make_multisig)

    def finalize_multisig(self, multisig_info, password = ''):
        finalize_multisig = {
            'method': 'finalize_multisig',
            'params' : {
                'multisig_info': multisig_info,
                'password': password,
            },
            'jsonrpc': '2.0',
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(finalize_multisig)

    def exchange_multisig_keys(self, multisig_info, password = ''):
        exchange_multisig_keys = {
            'method': 'exchange_multisig_keys',
            'params' : {
                'multisig_info': multisig_info,
                'password': password,
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(exchange_multisig_keys)

    def export_multisig_info(self):
        export_multisig_info = {
            'method': 'export_multisig_info',
            'params' : {
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(export_multisig_info)

    def import_multisig_info(self, info = []):
        import_multisig_info = {
            'method': 'import_multisig_info',
            'params' : {
                'info': info
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(import_multisig_info)

    def sign_multisig(self, tx_data_hex):
        sign_multisig = {
            'method': 'sign_multisig',
            'params' : {
                'tx_data_hex': tx_data_hex
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(sign_multisig)

    def submit_multisig(self, tx_data_hex):
        submit_multisig = {
            'method': 'submit_multisig',
            'params' : {
                'tx_data_hex': tx_data_hex
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(submit_multisig)

    def sign_transfer(self, unsigned_txset, export_raw = False, get_tx_keys = False):
        sign_transfer = {
            'method': 'sign_transfer',
            'params' : {
                'unsigned_txset': unsigned_txset,
                'export_raw': export_raw,
                'get_tx_keys': get_tx_keys,
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(sign_transfer)

    def submit_transfer(self, tx_data_hex):
        submit_transfer = {
            'method': 'submit_transfer',
            'params' : {
                'tx_data_hex': tx_data_hex,
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(submit_transfer)

    def get_tx_key(self, txid):
        get_tx_key = {
            'method': 'get_tx_key',
            'params' : {
                'txid': txid,
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(get_tx_key)

    def check_tx_key(self, txid = '', tx_key = '', address = ''):
        check_tx_key = {
            'method': 'check_tx_key',
            'params' : {
                'txid': txid,
                'tx_key': tx_key,
                'address': address,
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(check_tx_key)

    def get_tx_proof(self, txid = '', address = '', message = ''):
        get_tx_proof = {
            'method': 'get_tx_proof',
            'params' : {
                'txid': txid,
                'address': address,
                'message': message,
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(get_tx_proof)

    def check_tx_proof(self, txid = '', address = '', message = '', signature = ''):
        check_tx_proof = {
            'method': 'check_tx_proof',
            'params' : {
                'txid': txid,
                'address': address,
                'message': message,
                'signature': signature,
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(check_tx_proof)

    def get_spend_proof(self, txid = '', message = ''):
        get_spend_proof = {
            'method': 'get_spend_proof',
            'params' : {
                'txid': txid,
                'message': message,
            },
            'jsonrpc': '2.0',
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(get_spend_proof)

    def check_spend_proof(self, txid = '', message = '', signature = ''):
        check_spend_proof = {
            'method': 'check_spend_proof',
            'params' : {
                'txid': txid,
                'message': message,
                'signature': signature,
            },
            'jsonrpc': '2.0',
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(check_spend_proof)

    def get_reserve_proof(self, all_ = True, account_index = 0, amount = 0, message = ''):
        get_reserve_proof = {
            'method': 'get_reserve_proof',
            'params' : {
                'all': all_,
                'account_index': account_index,
                'amount': amount,
                'message': message,
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(get_reserve_proof)

    def check_reserve_proof(self, address = '', message = '', signature = ''):
        check_reserve_proof = {
            'method': 'check_reserve_proof',
            'params' : {
                'address': address,
                'message': message,
                'signature': signature,
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(check_reserve_proof)

    def sign(self, data):
        sign = {
            'method': 'sign',
            'params' : {
                'data': data,
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(sign)

    def verify(self, data, address, signature):
        verify = {
            'method': 'verify',
            'params' : {
                'data': data,
                'address': address,
                'signature': signature,
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(verify)

    def get_height(self):
        get_height = {
            'method': 'get_height',
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(get_height)

    def relay_tx(self, hex_):
        relay_tx = {
            'method': 'relay_tx',
            'params': {
                'hex': hex_,
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(relay_tx)

    def get_languages(self):
        get_languages = {
            'method': 'get_languages',
            'params': {
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(get_languages)

    def export_outputs(self):
        export_outputs = {
            'method': 'export_outputs',
            'params': {
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(export_outputs)

    def import_outputs(self, outputs_data_hex):
        import_outputs = {
            'method': 'import_outputs',
            'params': {
                'outputs_data_hex': outputs_data_hex
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(import_outputs)

    def export_key_images(self, all_ = False):
        export_key_images = {
            'method': 'export_key_images',
            'params': {
                'all': all_
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(export_key_images)

    def import_key_images(self, signed_key_images, offset = 0):
        import_key_images = {
            'method': 'import_key_images',
            'params': {
                'offset': offset,
                'signed_key_images': signed_key_images,
            },
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(import_key_images)

    def set_log_level(self, level):
        set_log_level = {
            'method': 'set_log_level',
            'params': {
                'level': level,
            },
            'jsonrpc': '2.0',
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(set_log_level)

    def set_log_categories(self, categories):
        set_log_categories = {
            'method': 'set_log_categories',
            'params': {
                'categories': categories,
            },
            'jsonrpc': '2.0',
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(set_log_categories)

    def validate_address(self, address, any_net_type = False, allow_openalias = False):
        validate_address = {
            'method': 'validate_address',
            'params': {
                'address': address,
                'any_net_type': any_net_type,
                'allow_openalias': allow_openalias,
            },
            'jsonrpc': '2.0',
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(validate_address)

    def get_accounts(self, tag):
        get_accounts = {
            'method': 'get_accounts',
            'params': {
                'tag': tag,
            },
            'jsonrpc': '2.0',
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(get_accounts)

    def get_account_tags(self):
        get_account_tags = {
            'method': 'get_account_tags',
            'params': {
            },
            'jsonrpc': '2.0',
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(get_account_tags)

    def tag_accounts(self, tag, accounts = []):
        tag_accounts = {
            'method': 'tag_accounts',
            'params': {
                'tag': tag,
                'accounts': accounts,
            },
            'jsonrpc': '2.0',
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(tag_accounts)

    def untag_accounts(self, accounts = []):
        untag_accounts = {
            'method': 'untag_accounts',
            'params': {
                'accounts': accounts,
            },
            'jsonrpc': '2.0',
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(untag_accounts)

    def set_account_tag_description(self, tag, description):
        set_account_tag_description = {
            'method': 'set_account_tag_description',
            'params': {
                'tag': tag,
                'description': description,
            },
            'jsonrpc': '2.0',
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(set_account_tag_description)

    def add_address_book(self, address = '', payment_id = '', description = ''):
        add_address_book = {
            'method': 'add_address_book',
            'jsonrpc': '2.0',
            'params': {
                'address': address,
                'payment_id': payment_id,
                'description': description,
            },
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(add_address_book)

    def edit_address_book(self, index, address = None, payment_id = None, description = None):
        edit_address_book = {
            'method': 'edit_address_book',
            'jsonrpc': '2.0',
            'params': {
                'index': index,
                'set_address': address != None,
                'address': address or '',
                'set_payment_id': payment_id != None,
                'payment_id': payment_id or '',
                'set_description': description != None,
                'description': description or '',
            },
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(edit_address_book)

    def get_address_book(self, entries = []):
        get_address_book = {
            'method': 'get_address_book',
            'jsonrpc': '2.0',
            'params': {
                'entries': entries,
            },
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(get_address_book)

    def delete_address_book(self, index):
        delete_address_book = {
            'method': 'delete_address_book',
            'jsonrpc': '2.0',
            'params': {
                'index': index,
            },
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(delete_address_book)

    def start_mining(self, threads_count, do_background_mining = False, ignore_battery = False):
        start_mining = {
            'method': 'start_mining',
            'jsonrpc': '2.0',
            'params': {
                'threads_count': threads_count,
                'do_background_mining': do_background_mining,
                'ignore_battery': ignore_battery,
            },
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(start_mining)

    def stop_mining(self):
        stop_mining = {
            'method': 'stop_mining',
            'jsonrpc': '2.0',
            'params': {
            },
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(stop_mining)

    def get_version(self):
        get_version = {
            'method': 'get_version',
            'jsonrpc': '2.0', 
            'id': '0'
        }
        return self.rpc.send_json_rpc_request(get_version)