forked from Beldex-Coin/beldex
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwallet_rpc_server_commands_defs.h
More file actions
executable file
·2754 lines (2212 loc) · 96 KB
/
Copy pathwallet_rpc_server_commands_defs.h
File metadata and controls
executable file
·2754 lines (2212 loc) · 96 KB
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
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright (c) 2014-2018, The Monero Project
// Copyright (c) 2018, The Beldex 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.
//
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
#pragma once
#include "cryptonote_basic/cryptonote_basic.h"
#include "cryptonote_basic/subaddress_index.h"
#include "wallet_rpc_server_error_codes.h"
#include "wallet/transfer_destination.h"
#include "wallet/transfer_view.h"
#include "common/meta.h"
#include "common/beldex.h"
#undef BELDEX_DEFAULT_LOG_CATEGORY
#define BELDEX_DEFAULT_LOG_CATEGORY "wallet.rpc"
// When making *any* change here, bump minor
// If the change is incompatible, then bump major and set minor to 0
// This ensures WALLET_RPC_VERSION always increases, that every change
// has its own version, and that clients can just test major to see
// whether they can talk to a given wallet without having to know in
// advance which version they will stop working with
// Don't go over 32767 for any of these
#define WALLET_RPC_VERSION_MAJOR 1
#define WALLET_RPC_VERSION_MINOR 17
#define MAKE_WALLET_RPC_VERSION(major,minor) (((major)<<16)|(minor))
#define WALLET_RPC_VERSION MAKE_WALLET_RPC_VERSION(WALLET_RPC_VERSION_MAJOR, WALLET_RPC_VERSION_MINOR)
#define WALLET_RPC_STATUS_OK "OK"
#define WALLET_RPC_STATUS_BUSY "BUSY"
/// Namespace for wallet RPC commands. Every RPC commands gets defined here and added to
/// `wallet_rpc_types` list at the bottom of the file.
namespace tools::wallet_rpc {
/// Base class that all wallet rpc commands inherit from
struct RPC_COMMAND {};
/// Base class for restricted RPC commands (that is, commands not available when running in
/// restricted mode).
struct RESTRICTED : RPC_COMMAND {};
/// Generic, serializable, no-argument request or response type, use as
/// `struct request : EMPTY {};` or `using response = EMPTY;`
struct EMPTY { KV_MAP_SERIALIZABLE };
namespace {
/// Returns a constexpr std::array of string_views from an arbitrary list of string literals
/// Used to specify RPC names as:
/// static constexpr auto names() { return NAMES("primary_name", "some_alias"); }
template <size_t... N>
constexpr std::array<std::string_view, sizeof...(N)> NAMES(const char (&...names)[N]) {
static_assert(sizeof...(N) > 0, "RPC command must have at least one name");
return {std::string_view{names, N-1}...};
}
}
BELDEX_RPC_DOC_INTROSPECT
// Return the wallet's balance.
struct GET_BALANCE : RPC_COMMAND
{
static constexpr auto names() { return NAMES("get_balance", "getbalance"); }
struct request
{
uint32_t account_index; // Return balance for this account.
std::set<uint32_t> address_indices; // (Optional) Return balance detail for those subaddresses.
bool all_accounts; // If true, return balance for all accounts, subaddr_indices and account_index are ignored
bool strict; // If true, only return the balance for transactions that have been spent and are not pending (i.e. excluding any transactions sitting in the TX pool)
KV_MAP_SERIALIZABLE
};
struct per_subaddress_info
{
uint32_t account_index; // Index of the account in the wallet.
uint32_t address_index; // Index of the subaddress in the account.
std::string address; // Address at this index. Base58 representation of the public keys.
uint64_t balance; // Balance for the subaddress (locked or unlocked).
uint64_t unlocked_balance; // Unlocked funds are those funds that are sufficiently deep enough in the beldex blockchain to be considered safe to spend.
std::string label; // Label for the subaddress.
uint64_t num_unspent_outputs; // Number of unspent outputs available for the subaddress.
uint64_t blocks_to_unlock; // The number of blocks remaining for the balance to unlock
uint64_t time_to_unlock; // Timestamp of expected unlock
KV_MAP_SERIALIZABLE
};
struct response
{
uint64_t balance; // The total balance (atomic units) of the currently opened wallet.
uint64_t unlocked_balance; // Unlocked funds are those funds that are sufficiently deep enough in the beldex blockchain to be considered safe to spend.
bool multisig_import_needed; // True if importing multisig data is needed for returning a correct balance.
std::vector<per_subaddress_info> per_subaddress; // Balance information for each subaddress in an account.
uint64_t blocks_to_unlock; // The number of blocks remaining for the balance to unlock
uint64_t time_to_unlock; // Timestamp of expected unlock
KV_MAP_SERIALIZABLE
};
};
BELDEX_RPC_DOC_INTROSPECT
// Return the wallet's addresses for an account. Optionally filter for specific set of subaddresses.
struct GET_ADDRESS : RPC_COMMAND
{
static constexpr auto names() { return NAMES("get_address", "getaddress"); }
struct request
{
uint32_t account_index; // Get the wallet addresses for the specified account.
std::vector<uint32_t> address_index; // (Optional) List of subaddresses to return from the aforementioned account.
KV_MAP_SERIALIZABLE
};
struct address_info
{
std::string address; // The (sub)address string.
std::string label; // Label of the (sub)address.
uint32_t address_index; // Index of the subaddress
bool used; // True if the (sub)address has received funds before.
KV_MAP_SERIALIZABLE
};
struct response
{
std::string address; // (Deprecated) Remains to be compatible with older RPC format
std::vector<address_info> addresses; // Addresses informations.
KV_MAP_SERIALIZABLE
};
};
BELDEX_RPC_DOC_INTROSPECT
// Get account and address indexes from a specific (sub)address.
struct GET_ADDRESS_INDEX : RPC_COMMAND
{
static constexpr auto names() { return NAMES("get_address_index"); }
struct request
{
std::string address; // (Sub)address to look for.
KV_MAP_SERIALIZABLE
};
struct response
{
cryptonote::subaddress_index index; // Account index followed by the subaddress index.
KV_MAP_SERIALIZABLE
};
};
BELDEX_RPC_DOC_INTROSPECT
// Create a new address for an account. Optionally, label the new address.
struct CREATE_ADDRESS : RPC_COMMAND
{
static constexpr auto names() { return NAMES("create_address"); }
struct request
{
uint32_t account_index; // Create a new subaddress for this account.
std::string label; // (Optional) Label for the new subaddress.
uint32_t count; // Number of addresses to create, defaults to 1.
KV_MAP_SERIALIZABLE
};
struct response
{
std::string address; // The newly requested address.
uint32_t address_index; // Index of the new address in the requested account index.
std::vector<std::string> addresses; // The new addresses, if more than 1 is requested
std::vector<uint32_t> address_indices; // The new addresses indicies if more than 1 is requested
KV_MAP_SERIALIZABLE
};
};
BELDEX_RPC_DOC_INTROSPECT
// Label an address.
struct LABEL_ADDRESS : RPC_COMMAND
{
static constexpr auto names() { return NAMES("label_address"); }
struct request
{
cryptonote::subaddress_index index; // Major & minor address index
std::string label; // Label for the address.
KV_MAP_SERIALIZABLE
};
using response = EMPTY;
};
BELDEX_RPC_DOC_INTROSPECT
// Get all accounts for a wallet. Optionally filter accounts by tag.
struct GET_ACCOUNTS : RPC_COMMAND
{
static constexpr auto names() { return NAMES("get_accounts"); }
struct request
{
std::string tag; // (Optional) Tag for filtering accounts. All accounts if empty, otherwise those accounts with this tag
bool strict_balances; // If true, only return the balance for transactions that have been spent and are not pending (i.e. excluding any transactions sitting in the TX pool)
KV_MAP_SERIALIZABLE
};
struct subaddress_account_info
{
uint32_t account_index; // Index of the account.
std::string base_address; // The first address of the account (i.e. the primary address).
uint64_t balance; // Balance of the account (locked or unlocked).
uint64_t unlocked_balance; // Unlocked balance for the account.
std::string label; // (Optional) Label of the account.
std::string tag; // (Optional) Tag for filtering accounts.
KV_MAP_SERIALIZABLE
};
struct response
{
uint64_t total_balance; // Total balance of the selected accounts (locked or unlocked).
uint64_t total_unlocked_balance; // Total unlocked balance of the selected accounts.
std::vector<subaddress_account_info> subaddress_accounts; // Account information.
KV_MAP_SERIALIZABLE
};
};
BELDEX_RPC_DOC_INTROSPECT
// Create a new account with an optional label.
struct CREATE_ACCOUNT : RPC_COMMAND
{
static constexpr auto names() { return NAMES("create_account"); }
struct request
{
std::string label; // (Optional) Label for the account.
KV_MAP_SERIALIZABLE
};
struct response
{
uint32_t account_index; // Index of the new account.
std::string address; // The primary address of the new account.
KV_MAP_SERIALIZABLE
};
};
BELDEX_RPC_DOC_INTROSPECT
// Label an account.
struct LABEL_ACCOUNT : RPC_COMMAND
{
static constexpr auto names() { return NAMES("label_account"); }
struct request
{
uint32_t account_index; // Account index to set the label for.
std::string label; // Label for the account.
KV_MAP_SERIALIZABLE
};
using response = EMPTY;
};
BELDEX_RPC_DOC_INTROSPECT
// Get a list of user-defined account tags.
struct GET_ACCOUNT_TAGS : RPC_COMMAND
{
static constexpr auto names() { return NAMES("get_account_tags"); }
struct request : EMPTY {};
struct account_tag_info
{
std::string tag; // Filter tag.
std::string label; // Label for the tag.
std::vector<uint32_t> accounts; // List of tagged account indices.
KV_MAP_SERIALIZABLE
};
struct response
{
std::vector<account_tag_info> account_tags; // Account tag information:
KV_MAP_SERIALIZABLE
};
};
BELDEX_RPC_DOC_INTROSPECT
// Apply a filtering tag to a list of accounts.
struct TAG_ACCOUNTS : RPC_COMMAND
{
static constexpr auto names() { return NAMES("tag_accounts"); }
struct request
{
std::string tag; // Tag for the accounts.
std::set<uint32_t> accounts; // Tag this list of accounts.
KV_MAP_SERIALIZABLE
};
using response = EMPTY;
};
BELDEX_RPC_DOC_INTROSPECT
// Remove filtering tag from a list of accounts.
struct UNTAG_ACCOUNTS : RPC_COMMAND
{
static constexpr auto names() { return NAMES("untag_accounts"); }
struct request
{
std::set<uint32_t> accounts; // Remove tag from this list of accounts.
KV_MAP_SERIALIZABLE
};
using response = EMPTY;
};
BELDEX_RPC_DOC_INTROSPECT
// Set description for an account tag.
struct SET_ACCOUNT_TAG_DESCRIPTION : RPC_COMMAND
{
static constexpr auto names() { return NAMES("set_account_tag_description"); }
struct request
{
std::string tag; // Set a description for this tag.
std::string description; // Description for the tag.
KV_MAP_SERIALIZABLE
};
using response = EMPTY;
};
BELDEX_RPC_DOC_INTROSPECT
// Returns the wallet's current block height and blockchain immutable height
struct GET_HEIGHT : RPC_COMMAND
{
static constexpr auto names() { return NAMES("get_height", "getheight"); }
struct request : EMPTY {};
struct response
{
uint64_t height; // The current wallet's blockchain height. If the wallet has been offline for a long time, it may need to catch up with the daemon.
uint64_t immutable_height; // The latest height in the blockchain that can not be reorganized from (backed by atleast 2 Master Node, or 1 hardcoded checkpoint, 0 if N/A).
KV_MAP_SERIALIZABLE
};
};
struct key_image_list
{
std::list<std::string> key_images;
KV_MAP_SERIALIZABLE
};
struct amounts_list
{
std::list<uint64_t> amounts;
bool operator==(const amounts_list& other) const { return amounts == other.amounts; }
KV_MAP_SERIALIZABLE
};
BELDEX_RPC_DOC_INTROSPECT
// Send beldex to a number of recipients. To preview the transaction fee, set do_not_relay to true and get_tx_metadata to true.
// Submit the response using the data in get_tx_metadata in the RPC call, relay_tx.
struct TRANSFER : RESTRICTED
{
static constexpr auto names() { return NAMES("transfer"); }
struct request
{
std::list<wallet::transfer_destination> destinations; // Array of destinations to receive BELDEX.
uint32_t account_index; // (Optional) Transfer from this account index. (Defaults to 0)
std::set<uint32_t> subaddr_indices; // (Optional) Transfer from this set of subaddresses. (Defaults to 0)
std::set<uint32_t> subtract_fee_from_outputs;
uint32_t priority; // Set a priority for the transaction. Accepted values are: 1 for unimportant or 5 for flash. (0 and 2-4 are accepted for backwards compatibility and are equivalent to 5)
uint64_t unlock_time; // Number of blocks before the beldex can be spent (0 to use the default lock time).
std::string payment_id; // (Optional) Random 64-character hex string to identify a transaction.
bool get_tx_key; // (Optional) Return the transaction key after sending.
bool do_not_relay; // (Optional) If true, the newly created transaction will not be relayed to the beldex network. (Defaults to false)
bool get_tx_hex; // Return the transaction as hex string after sending. (Defaults to false)
bool get_tx_metadata; // Return the metadata needed to relay the transaction. (Defaults to false)
KV_MAP_SERIALIZABLE
};
struct response
{
std::string tx_hash; // Publicly searchable transaction hash.
std::string tx_key; // Transaction key if get_tx_key is true, otherwise, blank string.
uint64_t amount; // Amount transferred for the transaction.
amounts_list amounts_by_dest;
uint64_t fee; // Fee charged for the txn.
std::string tx_blob; // Raw transaction represented as hex string, if get_tx_hex is true.
std::string tx_metadata; // Set of transaction metadata needed to relay this transfer later, if get_tx_metadata is true.
std::string multisig_txset; // Set of multisig transactions in the process of being signed (empty for non-multisig).
std::string unsigned_txset; // Set of unsigned tx for cold-signing purposes.
key_image_list spent_key_images;
KV_MAP_SERIALIZABLE
};
};
BELDEX_RPC_DOC_INTROSPECT
// Same as transfer, but can split into more than one tx if necessary.
struct TRANSFER_SPLIT : RESTRICTED
{
static constexpr auto names() { return NAMES("transfer_split"); }
struct request
{
std::list<wallet::transfer_destination> destinations; // Array of destinations to receive BELDEX:
uint32_t account_index; // (Optional) Transfer from this account index. (Defaults to 0)
std::set<uint32_t> subaddr_indices; // (Optional) Transfer from this set of subaddresses. (Defaults to 0)
uint32_t priority; // Set a priority for the transaction. Accepted values are: 1 for unimportant or 5 for flash. (0 and 2-4 are accepted for backwards compatibility and are equivalent to 5)
uint64_t unlock_time; // Number of blocks before the beldex can be spent (0 to not add a lock).
std::string payment_id; // (Optional) Random 32-byte/64-character hex string to identify a transaction.
bool get_tx_keys; // (Optional) Return the transaction keys after sending.
bool do_not_relay; // (Optional) If true, the newly created transaction will not be relayed to the beldex network. (Defaults to false)
bool get_tx_hex; // Return the transactions as hex string after sending.
bool get_tx_metadata; // Return list of transaction metadata needed to relay the transfer later.
KV_MAP_SERIALIZABLE
};
struct key_list
{
std::list<std::string> keys; //
KV_MAP_SERIALIZABLE
};
struct response
{
std::list<std::string> tx_hash_list; // The tx hashes of every transaction.
std::list<std::string> tx_key_list; // The transaction keys for every transaction.
std::list<uint64_t> amount_list; // The amount transferred for every transaction.
std::list<amounts_list> amounts_by_dest_list;
std::list<uint64_t> fee_list; // The amount of fees paid for every transaction.
std::list<std::string> tx_blob_list; // The tx as hex string for every transaction.
std::list<std::string> tx_metadata_list; // List of transaction metadata needed to relay the transactions later.
std::string multisig_txset; // The set of signing keys used in a multisig transaction (empty for non-multisig).
std::string unsigned_txset; // Set of unsigned tx for cold-signing purposes.
std::list<key_image_list> spent_key_images_list;
KV_MAP_SERIALIZABLE
};
};
BELDEX_RPC_DOC_INTROSPECT
struct DESCRIBE_TRANSFER : RESTRICTED
{
static constexpr auto names() { return NAMES("describe_transfer"); }
struct recipient
{
std::string address; // Destination public address.
uint64_t amount; // Amount in atomic units.
KV_MAP_SERIALIZABLE
};
struct transfer_description
{
uint64_t amount_in; // Amount in, in atomic units.
uint64_t amount_out; // amount out, in atomic units.
uint32_t ring_size; // Ring size of transfer.
uint64_t unlock_time; // Number of blocks before the beldex can be spent (0 represents the default network lock time).
std::list<recipient> recipients; // List of addresses and amounts.
std::string payment_id; // Payment ID matching the input parameter.
uint64_t change_amount; // Change received from transaction in atomic units.
std::string change_address; // Address the change was sent to.
uint64_t fee; // Fee of the transaction in atomic units.
uint32_t dummy_outputs; //
std::string extra; // Data stored in the tx extra represented in hex.
KV_MAP_SERIALIZABLE
};
struct request
{
std::string unsigned_txset; // Set of unsigned tx returned by "transfer" or "transfer_split" methods.
std::string multisig_txset; // Set of unsigned multisig txes returned by "transfer" or "transfer_split" methods
KV_MAP_SERIALIZABLE
};
struct response
{
std::list<transfer_description> desc; // List of information of transfers.
KV_MAP_SERIALIZABLE
};
};
BELDEX_RPC_DOC_INTROSPECT
// Sign a transaction created on a read-only wallet (in cold-signing process).
struct SIGN_TRANSFER : RESTRICTED
{
static constexpr auto names() { return NAMES("sign_transfer"); }
struct request
{
std::string unsigned_txset; // Set of unsigned tx returned by "transfer" or "transfer_split" methods.
bool export_raw; // (Optional) If true, return the raw transaction data. (Defaults to false)
bool get_tx_keys; // (Optional) Return the transaction keys after sending.
KV_MAP_SERIALIZABLE
};
struct response
{
std::string signed_txset; // Set of signed tx to be used for submitting transfer.
std::list<std::string> tx_hash_list; // The tx hashes of every transaction.
std::list<std::string> tx_raw_list; // The tx raw data of every transaction.
std::list<std::string> tx_key_list; // The tx key data of every transaction.
KV_MAP_SERIALIZABLE
};
};
BELDEX_RPC_DOC_INTROSPECT
// Submit a previously signed transaction on a read-only wallet (in cold-signing process).
struct SUBMIT_TRANSFER : RESTRICTED
{
static constexpr auto names() { return NAMES("submit_transfer"); }
struct request
{
std::string tx_data_hex; // Set of signed tx returned by "sign_transfer".
KV_MAP_SERIALIZABLE
};
struct response
{
std::list<std::string> tx_hash_list; // The tx hashes of every transaction.
KV_MAP_SERIALIZABLE
};
};
BELDEX_RPC_DOC_INTROSPECT
// Send all dust outputs back to the wallet's, to make them easier to spend (and mix).
struct SWEEP_DUST : RESTRICTED
{
static constexpr auto names() { return NAMES("sweep_dust", "sweep_unmixable"); }
struct request
{
bool get_tx_keys; // (Optional) Return the transaction keys after sending.
bool do_not_relay; // (Optional) If true, the newly created transaction will not be relayed to the beldex network. (Defaults to false)
bool get_tx_hex; // (Optional) Return the transactions as hex string after sending. (Defaults to false)
bool get_tx_metadata; // (Optional) Return list of transaction metadata needed to relay the transfer later. (Defaults to false)
KV_MAP_SERIALIZABLE
};
struct key_list
{
std::list<std::string> keys;
KV_MAP_SERIALIZABLE
};
struct response
{
std::list<std::string> tx_hash_list; // The tx hashes of every transaction.
std::list<std::string> tx_key_list; // The transaction keys for every transaction.
std::list<uint64_t> amount_list; // The amount transferred for every transaction.
std::list<amounts_list> amounts_by_dest_list;
std::list<uint64_t> fee_list; // The amount of fees paid for every transaction.
std::list<std::string> tx_blob_list; // The tx as hex string for every transaction.
std::list<std::string> tx_metadata_list; // List of transaction metadata needed to relay the transactions later.
std::string multisig_txset; // The set of signing keys used in a multisig transaction (empty for non-multisig).
std::string unsigned_txset; // Set of unsigned tx for cold-signing purposes.
std::list<key_image_list> spent_key_images_list;
KV_MAP_SERIALIZABLE
};
};
BELDEX_RPC_DOC_INTROSPECT
// Send all unlocked balance to an address.
struct SWEEP_ALL : RESTRICTED
{
static constexpr auto names() { return NAMES("sweep_all"); }
struct request
{
std::string address; // Destination public address.
uint32_t account_index; // Sweep transactions from this account.
std::set<uint32_t> subaddr_indices; // (Optional) Sweep from this set of subaddresses in the account.
bool subaddr_indices_all; //
uint32_t priority; // Set a priority for the transaction. Accepted values are: 1 for unimportant or 5 for flash. (0 and 2-4 are accepted for backwards compatibility and are equivalent to 5)
uint64_t outputs; //
uint64_t unlock_time; // Number of blocks before the beldex can be spent (0 to not add a lock).
std::string payment_id; // (Optional) 64-character hex string to identify a transaction.
bool get_tx_keys; // (Optional) Return the transaction keys after sending.
uint64_t below_amount; // (Optional) Include outputs below this amount.
bool do_not_relay; // (Optional) If true, do not relay this sweep transfer. (Defaults to false)
bool get_tx_hex; // (Optional) return the transactions as hex encoded string. (Defaults to false)
bool get_tx_metadata; // (Optional) return the transaction metadata as a string. (Defaults to false)
KV_MAP_SERIALIZABLE
};
struct key_list
{
std::list<std::string> keys;
KV_MAP_SERIALIZABLE
};
struct response
{
std::list<std::string> tx_hash_list; // The tx hashes of every transaction.
std::list<std::string> tx_key_list; // The transaction keys for every transaction.
std::list<uint64_t> amount_list; // The amount transferred for every transaction.
std::list<amounts_list> amounts_by_dest_list;
std::list<uint64_t> fee_list; // The amount of fees paid for every transaction.
std::list<std::string> tx_blob_list; // The tx as hex string for every transaction.
std::list<std::string> tx_metadata_list; // List of transaction metadata needed to relay the transactions later.
std::string multisig_txset; // The set of signing keys used in a multisig transaction (empty for non-multisig).
std::string unsigned_txset; // Set of unsigned tx for cold-signing purposes.
std::list<key_image_list> spent_key_images_list;
KV_MAP_SERIALIZABLE
};
};
BELDEX_RPC_DOC_INTROSPECT
// Send all of a specific unlocked output to an address.
struct SWEEP_SINGLE : RESTRICTED
{
static constexpr auto names() { return NAMES("sweep_single"); }
struct request
{
std::string address; // Destination public address.
uint32_t priority; // Set a priority for the transaction. Accepted values are: 1 for unimportant or 5 for flash. (0 and 2-4 are accepted for backwards compatibility and are equivalent to 5)
uint64_t outputs; //
uint64_t unlock_time; // Number of blocks before the beldex can be spent (0 to not add a lock).
std::string payment_id; // (Optional) 64-character hex string to identify a transaction.
bool get_tx_key; // (Optional) Return the transaction keys after sending.
std::string key_image; // Key image of specific output to sweep.
bool do_not_relay; // (Optional) If true, do not relay this sweep transfer. (Defaults to false)
bool get_tx_hex; // (Optional) return the transactions as hex encoded string. (Defaults to false)
bool get_tx_metadata; // (Optional) return the transaction metadata as a string. (Defaults to false)
KV_MAP_SERIALIZABLE
};
struct response
{
std::string tx_hash; // The tx hashes of the transaction.
std::string tx_key; // The tx key of the transaction.
uint64_t amount; // The amount transfered in atomic units.
amounts_list amounts_by_dest;
uint64_t fee; // The fee paid in atomic units.
std::string tx_blob; // The tx as hex string.
std::string tx_metadata; // Transaction metadata needed to relay the transaction later.
std::string multisig_txset; // The set of signing keys used in a multisig transaction (empty for non-multisig).
std::string unsigned_txset; // Set of unsigned tx for cold-signing purposes.
key_image_list spent_key_images;
KV_MAP_SERIALIZABLE
};
};
BELDEX_RPC_DOC_INTROSPECT
// Relay transaction metadata to the daemon
struct RELAY_TX : RPC_COMMAND
{
static constexpr auto names() { return NAMES("relay_tx"); }
struct request
{
std::string hex; // Transaction metadata returned from a transfer method with get_tx_metadata set to true.
bool flash; // (Optional): Set to true if this tx was constructed with a flash priority and should be submitted to the flash quorum.
KV_MAP_SERIALIZABLE
};
struct response
{
std::string tx_hash; // String for the publically searchable transaction hash.
KV_MAP_SERIALIZABLE
};
};
BELDEX_RPC_DOC_INTROSPECT
// Save the wallet file.
struct STORE : RESTRICTED
{
static constexpr auto names() { return NAMES("store"); }
struct request : EMPTY {};
using response = EMPTY;
};
BELDEX_RPC_DOC_INTROSPECT
//
struct payment_details
{
std::string payment_id; // Payment ID matching the input parameter.
std::string tx_hash; // Transaction hash used as the transaction ID.
uint64_t amount; // Amount for this payment.
uint64_t block_height; // Height of the block that first confirmed this payment.
uint64_t unlock_time; // Time (in block height) until this payment is safe to spend.
bool locked; // If the payment is spendable or not
cryptonote::subaddress_index subaddr_index; // Major & minor index, account and subaddress index respectively.
std::string address; // Address receiving the payment.
KV_MAP_SERIALIZABLE
};
BELDEX_RPC_DOC_INTROSPECT
// Get a list of incoming payments using a given payment id.
struct GET_PAYMENTS : RPC_COMMAND
{
static constexpr auto names() { return NAMES("get_payments"); }
struct request
{
std::string payment_id; // Payment ID used to find the payments (16 characters hex).
KV_MAP_SERIALIZABLE
};
struct response
{
std::list<payment_details> payments; // List of payment details:
KV_MAP_SERIALIZABLE
};
};
BELDEX_RPC_DOC_INTROSPECT
// Get a list of incoming payments using a given payment id,
// or a list of payments ids, from a given height.
//
// This method is the preferred method over get_paymentsbecause it
// has the same functionality but is more extendable.
// Either is fine for looking up transactions by a single payment ID.
struct GET_BULK_PAYMENTS : RPC_COMMAND
{
static constexpr auto names() { return NAMES("get_bulk_payments"); }
struct request
{
std::vector<std::string> payment_ids; // Payment IDs used to find the payments (16 characters hex).
uint64_t min_block_height; // The block height at which to start looking for payments.
KV_MAP_SERIALIZABLE
};
struct response
{
std::list<payment_details> payments; // List of payment details:
KV_MAP_SERIALIZABLE
};
};
BELDEX_RPC_DOC_INTROSPECT
//
struct transfer_details
{
uint64_t amount; // Amount of this transfer.
bool spent; // Indicates if this transfer has been spent.
uint64_t global_index; // The index into the global list of transactions grouped by amount in the Beldex network.
std::string tx_hash; // Several incoming transfers may share the same hash if they were in the same transaction.
cryptonote::subaddress_index subaddr_index; // Major & minor index, account and subaddress index respectively.
std::string key_image; // Key image for the incoming transfer's unspent output (empty unless verbose is true).
uint64_t block_height; // Block height the transfer occurred on
bool frozen; // If the output has been intentionally frozen by the user, i.e. unspendable.
bool unlocked; // If the TX is spendable yet
KV_MAP_SERIALIZABLE
};
BELDEX_RPC_DOC_INTROSPECT
// Return a list of incoming transfers to the wallet.
struct INCOMING_TRANSFERS : RPC_COMMAND
{
static constexpr auto names() { return NAMES("incoming_transfers"); }
struct request
{
std::string transfer_type; // "all": all the transfers, "available": only transfers which are not yet spent, OR "unavailable": only transfers which are already spent.
uint32_t account_index; // (Optional) Return transfers for this account. (defaults to 0)
std::set<uint32_t> subaddr_indices; // (Optional) Return transfers sent to these subaddresses.
KV_MAP_SERIALIZABLE
};
struct response
{
std::list<transfer_details> transfers; // List of information of the transfers details.
KV_MAP_SERIALIZABLE
};
};
BELDEX_RPC_DOC_INTROSPECT
// Return the spend or view private key.
struct QUERY_KEY : RESTRICTED
{
static constexpr auto names() { return NAMES("query_key"); }
struct request
{
std::string key_type; // Which key to retrieve: "mnemonic" - the mnemonic seed (older wallets do not have one) OR "view_key" - the view key
KV_MAP_SERIALIZABLE
};
struct response
{
std::string key; // The view key will be hex encoded, while the mnemonic will be a string of words.
KV_MAP_SERIALIZABLE
};
};
BELDEX_RPC_DOC_INTROSPECT
// Make an integrated address from the wallet address and a payment id.
struct MAKE_INTEGRATED_ADDRESS : RPC_COMMAND
{
static constexpr auto names() { return NAMES("make_integrated_address"); }
struct request
{
std::string standard_address; // (Optional, defaults to primary address) Destination public address.
std::string payment_id; // (Optional, defaults to a random ID) 16 characters hex encoded.
KV_MAP_SERIALIZABLE
};
struct response
{
std::string integrated_address; //
std::string payment_id; // Hex encoded.
KV_MAP_SERIALIZABLE
};
};
BELDEX_RPC_DOC_INTROSPECT
// Retrieve the standard address and payment id corresponding to an integrated address.
struct SPLIT_INTEGRATED_ADDRESS : RPC_COMMAND
{
static constexpr auto names() { return NAMES("split_integrated_address"); }
struct request
{
std::string integrated_address; //
KV_MAP_SERIALIZABLE
};
struct response
{
std::string standard_address; //
std::string payment_id; //
bool is_subaddress; //
KV_MAP_SERIALIZABLE
};
};
BELDEX_RPC_DOC_INTROSPECT
// Stops the wallet, storing the current state.
struct STOP_WALLET : RESTRICTED
{
static constexpr auto names() { return NAMES("stop_wallet"); }
struct request : EMPTY {};
using response = EMPTY;
};
BELDEX_RPC_DOC_INTROSPECT
// Rescan the blockchain from scratch, losing any information
// which can not be recovered from the blockchain itself.
// This includes destination addresses, tx secret keys, tx notes, etc.
// Warning: This blocks the Wallet RPC executable until rescanning is complete.
struct RESCAN_BLOCKCHAIN : RESTRICTED
{
static constexpr auto names() { return NAMES("rescan_blockchain"); }
struct request
{
bool hard; //
KV_MAP_SERIALIZABLE
};
using response = EMPTY;
};
BELDEX_RPC_DOC_INTROSPECT
// Set arbitrary string notes for transactions.
struct SET_TX_NOTES : RESTRICTED
{
static constexpr auto names() { return NAMES("set_tx_notes"); }
struct request
{
std::list<std::string> txids; // Transaction ids.
std::list<std::string> notes; // Notes for the transactions.
KV_MAP_SERIALIZABLE
};
using response = EMPTY;
};
BELDEX_RPC_DOC_INTROSPECT
// Get string notes for transactions.
struct GET_TX_NOTES : RPC_COMMAND
{
static constexpr auto names() { return NAMES("get_tx_notes"); }
struct request
{
std::list<std::string> txids; // Transaction ids.
KV_MAP_SERIALIZABLE
};
struct response
{
std::list<std::string> notes; // Notes for the transactions.
KV_MAP_SERIALIZABLE
};
};
BELDEX_RPC_DOC_INTROSPECT
// Set arbitrary attribute.
struct SET_ATTRIBUTE : RESTRICTED
{
static constexpr auto names() { return NAMES("set_attribute"); }
struct request
{