Electroneum
wallet_rpc_server.h
Go to the documentation of this file.
1 // Copyrights(c) 2017-2019, The Electroneum Project
2 // Copyrights(c) 2014-2017, The Monero Project
3 //
4 // All rights reserved.
5 //
6 // Redistribution and use in source and binary forms, with or without modification, are
7 // permitted provided that the following conditions are met:
8 //
9 // 1. Redistributions of source code must retain the above copyright notice, this list of
10 // conditions and the following disclaimer.
11 //
12 // 2. Redistributions in binary form must reproduce the above copyright notice, this list
13 // of conditions and the following disclaimer in the documentation and/or other
14 // materials provided with the distribution.
15 //
16 // 3. Neither the name of the copyright holder nor the names of its contributors may be
17 // used to endorse or promote products derived from this software without specific
18 // prior written permission.
19 //
20 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
21 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
23 // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
28 // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
31 
32 #pragma once
33 
34 #include <boost/program_options/options_description.hpp>
35 #include <boost/program_options/variables_map.hpp>
36 #include <string>
37 #include "net/http_server_impl_base.h"
39 #include "wallet2.h"
40 
42 
43 #undef ELECTRONEUM_DEFAULT_LOG_CATEGORY
44 #define ELECTRONEUM_DEFAULT_LOG_CATEGORY "wallet.rpc"
45 
46 namespace tools
47 {
48  /************************************************************************/
49  /* */
50  /************************************************************************/
51  class wallet_rpc_server: public epee::http_server_impl_base<wallet_rpc_server>
52  {
53  public:
54  typedef epee::net_utils::connection_context_base connection_context;
55 
56  static const char* tr(const char* str);
57 
60  bool init(const boost::program_options::variables_map *vm);
61  bool run();
62  void stop();
63  void set_wallet(wallet2 *cr);
64  void handle_rpc_exception(const std::exception_ptr& e, epee::json_rpc::error& er, int default_error_code);
65 
66  void set_blockchain_storage(etneg::MicroCore* core = nullptr, cryptonote::Blockchain* blockchain_storage = nullptr);
67 
68  private:
69 
70  CHAIN_HTTP_TO_MAP2(connection_context); //forward http requests to uri map
71 
72  BEGIN_URI_MAP2()
73  BEGIN_JSON_RPC_MAP("/json_rpc")
74  MAP_JON_RPC_WE("getbalance", on_getbalance, wallet_rpc::COMMAND_RPC_GET_BALANCE)
75  MAP_JON_RPC_WE("getaddress", on_getaddress, wallet_rpc::COMMAND_RPC_GET_ADDRESS)
76  MAP_JON_RPC_WE("getheight", on_getheight, wallet_rpc::COMMAND_RPC_GET_HEIGHT)
77  MAP_JON_RPC_WE("transfer", on_transfer, wallet_rpc::COMMAND_RPC_TRANSFER)
78  MAP_JON_RPC_WE("transfer_split", on_transfer_split, wallet_rpc::COMMAND_RPC_TRANSFER_SPLIT)
79  MAP_JON_RPC_WE("sweep_dust", on_sweep_dust, wallet_rpc::COMMAND_RPC_SWEEP_DUST)
80  MAP_JON_RPC_WE("sweep_all", on_sweep_all, wallet_rpc::COMMAND_RPC_SWEEP_ALL)
81  MAP_JON_RPC_WE("relay_tx", on_relay_tx, wallet_rpc::COMMAND_RPC_RELAY_TX)
82  MAP_JON_RPC_WE("store", on_store, wallet_rpc::COMMAND_RPC_STORE)
83  MAP_JON_RPC_WE("get_payments", on_get_payments, wallet_rpc::COMMAND_RPC_GET_PAYMENTS)
84  MAP_JON_RPC_WE("get_bulk_payments", on_get_bulk_payments, wallet_rpc::COMMAND_RPC_GET_BULK_PAYMENTS)
85  MAP_JON_RPC_WE("incoming_transfers", on_incoming_transfers, wallet_rpc::COMMAND_RPC_INCOMING_TRANSFERS)
86  MAP_JON_RPC_WE("query_key", on_query_key, wallet_rpc::COMMAND_RPC_QUERY_KEY)
87  MAP_JON_RPC_WE("make_integrated_address", on_make_integrated_address, wallet_rpc::COMMAND_RPC_MAKE_INTEGRATED_ADDRESS)
88  MAP_JON_RPC_WE("split_integrated_address", on_split_integrated_address, wallet_rpc::COMMAND_RPC_SPLIT_INTEGRATED_ADDRESS)
89  MAP_JON_RPC_WE("stop_wallet", on_stop_wallet, wallet_rpc::COMMAND_RPC_STOP_WALLET)
90  MAP_JON_RPC_WE("rescan_blockchain", on_rescan_blockchain, wallet_rpc::COMMAND_RPC_RESCAN_BLOCKCHAIN)
91  MAP_JON_RPC_WE("set_tx_notes", on_set_tx_notes, wallet_rpc::COMMAND_RPC_SET_TX_NOTES)
92  MAP_JON_RPC_WE("get_tx_notes", on_get_tx_notes, wallet_rpc::COMMAND_RPC_GET_TX_NOTES)
93  MAP_JON_RPC_WE("get_tx_key", on_get_tx_key, wallet_rpc::COMMAND_RPC_GET_TX_KEY)
94  MAP_JON_RPC_WE("get_transfers", on_get_transfers, wallet_rpc::COMMAND_RPC_GET_TRANSFERS)
95  MAP_JON_RPC_WE("get_transfer_by_txid", on_get_transfer_by_txid, wallet_rpc::COMMAND_RPC_GET_TRANSFER_BY_TXID)
96  MAP_JON_RPC_WE("save_transfers_to_csv", on_save_transfers_to_csv, wallet_rpc::COMMAND_RPC_SAVE_TRANSFERS_TO_CSV)
97  MAP_JON_RPC_WE("sign", on_sign, wallet_rpc::COMMAND_RPC_SIGN)
98  MAP_JON_RPC_WE("verify", on_verify, wallet_rpc::COMMAND_RPC_VERIFY)
99  MAP_JON_RPC_WE("export_key_images", on_export_key_images, wallet_rpc::COMMAND_RPC_EXPORT_KEY_IMAGES)
100  MAP_JON_RPC_WE("import_key_images", on_import_key_images, wallet_rpc::COMMAND_RPC_IMPORT_KEY_IMAGES)
101  MAP_JON_RPC_WE("make_uri", on_make_uri, wallet_rpc::COMMAND_RPC_MAKE_URI)
102  MAP_JON_RPC_WE("parse_uri", on_parse_uri, wallet_rpc::COMMAND_RPC_PARSE_URI)
103  MAP_JON_RPC_WE("get_address_book", on_get_address_book, wallet_rpc::COMMAND_RPC_GET_ADDRESS_BOOK_ENTRY)
104  MAP_JON_RPC_WE("add_address_book", on_add_address_book, wallet_rpc::COMMAND_RPC_ADD_ADDRESS_BOOK_ENTRY)
105  MAP_JON_RPC_WE("delete_address_book",on_delete_address_book,wallet_rpc::COMMAND_RPC_DELETE_ADDRESS_BOOK_ENTRY)
106  MAP_JON_RPC_WE("rescan_spent", on_rescan_spent, wallet_rpc::COMMAND_RPC_RESCAN_SPENT)
107  MAP_JON_RPC_WE("start_mining", on_start_mining, wallet_rpc::COMMAND_RPC_START_MINING)
108  MAP_JON_RPC_WE("stop_mining", on_stop_mining, wallet_rpc::COMMAND_RPC_STOP_MINING)
109  MAP_JON_RPC_WE("get_languages", on_get_languages, wallet_rpc::COMMAND_RPC_GET_LANGUAGES)
110  MAP_JON_RPC_WE("create_wallet", on_create_wallet, wallet_rpc::COMMAND_RPC_CREATE_WALLET)
111  MAP_JON_RPC_WE("open_wallet", on_open_wallet, wallet_rpc::COMMAND_RPC_OPEN_WALLET)
112  MAP_JON_RPC_WE("close_wallet", on_close_wallet, wallet_rpc::COMMAND_RPC_CLOSE_WALLET)
113  MAP_JON_RPC_WE("change_wallet_password", on_change_wallet_password, wallet_rpc::COMMAND_RPC_CHANGE_WALLET_PASSWORD)
114  END_JSON_RPC_MAP()
115  END_URI_MAP2()
116 
117  //json_rpc
118  bool on_getbalance(const wallet_rpc::COMMAND_RPC_GET_BALANCE::request& req, wallet_rpc::COMMAND_RPC_GET_BALANCE::response& res, epee::json_rpc::error& er);
119  bool on_getaddress(const wallet_rpc::COMMAND_RPC_GET_ADDRESS::request& req, wallet_rpc::COMMAND_RPC_GET_ADDRESS::response& res, epee::json_rpc::error& er);
120  bool on_getheight(const wallet_rpc::COMMAND_RPC_GET_HEIGHT::request& req, wallet_rpc::COMMAND_RPC_GET_HEIGHT::response& res, epee::json_rpc::error& er);
121  bool validate_transfer(const std::list<wallet_rpc::transfer_destination> destinations, const std::string payment_id, std::vector<cryptonote::tx_destination_entry>& dsts, std::vector<uint8_t>& extra, epee::json_rpc::error& er);
122  bool on_transfer(const wallet_rpc::COMMAND_RPC_TRANSFER::request& req, wallet_rpc::COMMAND_RPC_TRANSFER::response& res, epee::json_rpc::error& er);
123  bool on_transfer_split(const wallet_rpc::COMMAND_RPC_TRANSFER_SPLIT::request& req, wallet_rpc::COMMAND_RPC_TRANSFER_SPLIT::response& res, epee::json_rpc::error& er);
124  bool on_sweep_dust(const wallet_rpc::COMMAND_RPC_SWEEP_DUST::request& req, wallet_rpc::COMMAND_RPC_SWEEP_DUST::response& res, epee::json_rpc::error& er);
125  bool on_sweep_all(const wallet_rpc::COMMAND_RPC_SWEEP_ALL::request& req, wallet_rpc::COMMAND_RPC_SWEEP_ALL::response& res, epee::json_rpc::error& er);
126  bool on_relay_tx(const wallet_rpc::COMMAND_RPC_RELAY_TX::request& req, wallet_rpc::COMMAND_RPC_RELAY_TX::response& res, epee::json_rpc::error& er);
127  bool on_make_integrated_address(const wallet_rpc::COMMAND_RPC_MAKE_INTEGRATED_ADDRESS::request& req, wallet_rpc::COMMAND_RPC_MAKE_INTEGRATED_ADDRESS::response& res, epee::json_rpc::error& er);
128  bool on_split_integrated_address(const wallet_rpc::COMMAND_RPC_SPLIT_INTEGRATED_ADDRESS::request& req, wallet_rpc::COMMAND_RPC_SPLIT_INTEGRATED_ADDRESS::response& res, epee::json_rpc::error& er);
129  bool on_store(const wallet_rpc::COMMAND_RPC_STORE::request& req, wallet_rpc::COMMAND_RPC_STORE::response& res, epee::json_rpc::error& er);
130  bool on_get_payments(const wallet_rpc::COMMAND_RPC_GET_PAYMENTS::request& req, wallet_rpc::COMMAND_RPC_GET_PAYMENTS::response& res, epee::json_rpc::error& er);
131  bool on_get_bulk_payments(const wallet_rpc::COMMAND_RPC_GET_BULK_PAYMENTS::request& req, wallet_rpc::COMMAND_RPC_GET_BULK_PAYMENTS::response& res, epee::json_rpc::error& er);
132  bool on_incoming_transfers(const wallet_rpc::COMMAND_RPC_INCOMING_TRANSFERS::request& req, wallet_rpc::COMMAND_RPC_INCOMING_TRANSFERS::response& res, epee::json_rpc::error& er);
133  bool on_stop_wallet(const wallet_rpc::COMMAND_RPC_STOP_WALLET::request& req, wallet_rpc::COMMAND_RPC_STOP_WALLET::response& res, epee::json_rpc::error& er);
134  bool on_rescan_blockchain(const wallet_rpc::COMMAND_RPC_RESCAN_BLOCKCHAIN::request& req, wallet_rpc::COMMAND_RPC_RESCAN_BLOCKCHAIN::response& res, epee::json_rpc::error& er);
135  bool on_set_tx_notes(const wallet_rpc::COMMAND_RPC_SET_TX_NOTES::request& req, wallet_rpc::COMMAND_RPC_SET_TX_NOTES::response& res, epee::json_rpc::error& er);
136  bool on_get_tx_notes(const wallet_rpc::COMMAND_RPC_GET_TX_NOTES::request& req, wallet_rpc::COMMAND_RPC_GET_TX_NOTES::response& res, epee::json_rpc::error& er);
137  bool on_get_tx_key(const wallet_rpc::COMMAND_RPC_GET_TX_KEY::request& req, wallet_rpc::COMMAND_RPC_GET_TX_KEY::response& res, epee::json_rpc::error& er);
138  bool on_get_transfers(const wallet_rpc::COMMAND_RPC_GET_TRANSFERS::request& req, wallet_rpc::COMMAND_RPC_GET_TRANSFERS::response& res, epee::json_rpc::error& er);
139  bool on_get_transfer_by_txid(const wallet_rpc::COMMAND_RPC_GET_TRANSFER_BY_TXID::request& req, wallet_rpc::COMMAND_RPC_GET_TRANSFER_BY_TXID::response& res, epee::json_rpc::error& er);
140  bool on_save_transfers_to_csv(const wallet_rpc::COMMAND_RPC_SAVE_TRANSFERS_TO_CSV::request& req, wallet_rpc::COMMAND_RPC_SAVE_TRANSFERS_TO_CSV::response& res, epee::json_rpc::error& er);
141  bool on_sign(const wallet_rpc::COMMAND_RPC_SIGN::request& req, wallet_rpc::COMMAND_RPC_SIGN::response& res, epee::json_rpc::error& er);
142  bool on_verify(const wallet_rpc::COMMAND_RPC_VERIFY::request& req, wallet_rpc::COMMAND_RPC_VERIFY::response& res, epee::json_rpc::error& er);
143  bool on_export_key_images(const wallet_rpc::COMMAND_RPC_EXPORT_KEY_IMAGES::request& req, wallet_rpc::COMMAND_RPC_EXPORT_KEY_IMAGES::response& res, epee::json_rpc::error& er);
144  bool on_import_key_images(const wallet_rpc::COMMAND_RPC_IMPORT_KEY_IMAGES::request& req, wallet_rpc::COMMAND_RPC_IMPORT_KEY_IMAGES::response& res, epee::json_rpc::error& er);
145  bool on_make_uri(const wallet_rpc::COMMAND_RPC_MAKE_URI::request& req, wallet_rpc::COMMAND_RPC_MAKE_URI::response& res, epee::json_rpc::error& er);
146  bool on_parse_uri(const wallet_rpc::COMMAND_RPC_PARSE_URI::request& req, wallet_rpc::COMMAND_RPC_PARSE_URI::response& res, epee::json_rpc::error& er);
147  bool on_get_address_book(const wallet_rpc::COMMAND_RPC_GET_ADDRESS_BOOK_ENTRY::request& req, wallet_rpc::COMMAND_RPC_GET_ADDRESS_BOOK_ENTRY::response& res, epee::json_rpc::error& er);
148  bool on_add_address_book(const wallet_rpc::COMMAND_RPC_ADD_ADDRESS_BOOK_ENTRY::request& req, wallet_rpc::COMMAND_RPC_ADD_ADDRESS_BOOK_ENTRY::response& res, epee::json_rpc::error& er);
149  bool on_delete_address_book(const wallet_rpc::COMMAND_RPC_DELETE_ADDRESS_BOOK_ENTRY::request& req, wallet_rpc::COMMAND_RPC_DELETE_ADDRESS_BOOK_ENTRY::response& res, epee::json_rpc::error& er);
150  bool on_rescan_spent(const wallet_rpc::COMMAND_RPC_RESCAN_SPENT::request& req, wallet_rpc::COMMAND_RPC_RESCAN_SPENT::response& res, epee::json_rpc::error& er);
151  bool on_start_mining(const wallet_rpc::COMMAND_RPC_START_MINING::request& req, wallet_rpc::COMMAND_RPC_START_MINING::response& res, epee::json_rpc::error& er);
152  bool on_stop_mining(const wallet_rpc::COMMAND_RPC_STOP_MINING::request& req, wallet_rpc::COMMAND_RPC_STOP_MINING::response& res, epee::json_rpc::error& er);
153  bool on_get_languages(const wallet_rpc::COMMAND_RPC_GET_LANGUAGES::request& req, wallet_rpc::COMMAND_RPC_GET_LANGUAGES::response& res, epee::json_rpc::error& er);
154  bool on_create_wallet(const wallet_rpc::COMMAND_RPC_CREATE_WALLET::request& req, wallet_rpc::COMMAND_RPC_CREATE_WALLET::response& res, epee::json_rpc::error& er);
155  bool on_open_wallet(const wallet_rpc::COMMAND_RPC_OPEN_WALLET::request& req, wallet_rpc::COMMAND_RPC_OPEN_WALLET::response& res, epee::json_rpc::error& er);
156  bool on_close_wallet(const wallet_rpc::COMMAND_RPC_CLOSE_WALLET::request& req, wallet_rpc::COMMAND_RPC_CLOSE_WALLET::response& res, epee::json_rpc::error& er);
157  bool on_change_wallet_password(const wallet_rpc::COMMAND_RPC_CHANGE_WALLET_PASSWORD::request& req, wallet_rpc::COMMAND_RPC_CHANGE_WALLET_PASSWORD::response& res, epee::json_rpc::error& er);
158 
159  //json rpc v2
160  bool on_query_key(const wallet_rpc::COMMAND_RPC_QUERY_KEY::request& req, wallet_rpc::COMMAND_RPC_QUERY_KEY::response& res, epee::json_rpc::error& er);
161 
162  // helpers
163  void fill_transfer_entry(tools::wallet_rpc::transfer_entry &entry, const crypto::hash &txid, const crypto::hash &payment_id, const tools::wallet2::payment_details &pd);
164  void fill_transfer_entry(tools::wallet_rpc::transfer_entry &entry, const crypto::hash &txid, const tools::wallet2::confirmed_transfer_details &pd);
165  void fill_transfer_entry(tools::wallet_rpc::transfer_entry &entry, const crypto::hash &txid, const tools::wallet2::unconfirmed_transfer_details &pd);
166  void fill_transfer_entry(tools::wallet_rpc::transfer_entry &entry, const crypto::hash &payment_id, const tools::wallet2::payment_details &pd);
167  bool not_open(epee::json_rpc::error& er);
168 
169  void load_database(std::string blockchain_db_path);
170 
172  std::string m_wallet_dir;
174  std::atomic<bool> m_stop;
176  epee::net_utils::http::http_simple_client m_http_client;
177  const boost::program_options::variables_map *m_vm;
178 
179  bool m_testnet;
181  etneg::MicroCore* m_core;
184  };
185 }
bool on_sweep_all(const wallet_rpc::COMMAND_RPC_SWEEP_ALL::request &req, wallet_rpc::COMMAND_RPC_SWEEP_ALL::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:696
bool on_get_tx_key(const wallet_rpc::COMMAND_RPC_GET_TX_KEY::request &req, wallet_rpc::COMMAND_RPC_GET_TX_KEY::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:1265
Definition: wallet_rpc_server.h:51
bool on_start_mining(const wallet_rpc::COMMAND_RPC_START_MINING::request &req, wallet_rpc::COMMAND_RPC_START_MINING::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:1716
std::string m_wallet_dir
Definition: wallet_rpc_server.h:172
bool m_testnet
Definition: wallet_rpc_server.h:179
bool init(const boost::program_options::variables_map *vm)
Definition: wallet_rpc_server.cpp:139
void stop()
Definition: wallet_rpc_server.cpp:122
bool not_open(epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:267
Definition: unordered_containers_boost_serialization.h:38
bool on_delete_address_book(const wallet_rpc::COMMAND_RPC_DELETE_ADDRESS_BOOK_ENTRY::request &req, wallet_rpc::COMMAND_RPC_DELETE_ADDRESS_BOOK_ENTRY::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:1668
Definition: wallet2.h:97
bool on_sweep_dust(const wallet_rpc::COMMAND_RPC_SWEEP_DUST::request &req, wallet_rpc::COMMAND_RPC_SWEEP_DUST::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:638
std::string rpc_login_filename
Definition: wallet_rpc_server.h:173
bool on_open_wallet(const wallet_rpc::COMMAND_RPC_OPEN_WALLET::request &req, wallet_rpc::COMMAND_RPC_OPEN_WALLET::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:1861
bool validate_transfer(const std::list< wallet_rpc::transfer_destination > destinations, const std::string payment_id, std::vector< cryptonote::tx_destination_entry > &dsts, std::vector< uint8_t > &extra, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:391
bool on_getheight(const wallet_rpc::COMMAND_RPC_GET_HEIGHT::request &req, wallet_rpc::COMMAND_RPC_GET_HEIGHT::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:376
void set_blockchain_storage(etneg::MicroCore *core=nullptr, cryptonote::Blockchain *blockchain_storage=nullptr)
Definition: wallet_rpc_server.cpp:262
bool on_get_languages(const wallet_rpc::COMMAND_RPC_GET_LANGUAGES::request &req, wallet_rpc::COMMAND_RPC_GET_LANGUAGES::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:1765
bool m_physical_refresh
Definition: wallet_rpc_server.h:180
bool on_rescan_blockchain(const wallet_rpc::COMMAND_RPC_RESCAN_BLOCKCHAIN::request &req, wallet_rpc::COMMAND_RPC_RESCAN_BLOCKCHAIN::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:1097
bool on_parse_uri(const wallet_rpc::COMMAND_RPC_PARSE_URI::request &req, wallet_rpc::COMMAND_RPC_PARSE_URI::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:1551
bool on_split_integrated_address(const wallet_rpc::COMMAND_RPC_SPLIT_INTEGRATED_ADDRESS::request &req, wallet_rpc::COMMAND_RPC_SPLIT_INTEGRATED_ADDRESS::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:833
crypto namespace.
Definition: crypto.cpp:47
Definition: block_queue.cpp:41
bool on_import_key_images(const wallet_rpc::COMMAND_RPC_IMPORT_KEY_IMAGES::request &req, wallet_rpc::COMMAND_RPC_IMPORT_KEY_IMAGES::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:1480
bool on_get_transfers(const wallet_rpc::COMMAND_RPC_GET_TRANSFERS::request &req, wallet_rpc::COMMAND_RPC_GET_TRANSFERS::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:1291
bool is_connected_to_db
Definition: wallet_rpc_server.h:183
etneg::MicroCore * m_core
Definition: wallet_rpc_server.h:181
void load_database(std::string blockchain_db_path)
Definition: wallet_rpc_server.cpp:241
Definition: MicroCore.h:23
void fill_transfer_entry(tools::wallet_rpc::transfer_entry &entry, const crypto::hash &txid, const crypto::hash &payment_id, const tools::wallet2::payment_details &pd)
Definition: wallet_rpc_server.cpp:274
bool on_make_uri(const wallet_rpc::COMMAND_RPC_MAKE_URI::request &req, wallet_rpc::COMMAND_RPC_MAKE_URI::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:1536
bool m_trusted_daemon
Definition: wallet_rpc_server.h:175
bool on_sign(const wallet_rpc::COMMAND_RPC_SIGN::request &req, wallet_rpc::COMMAND_RPC_SIGN::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:1119
Holds cryptonote related classes and helpers.
Definition: db_bdb.cpp:225
bool on_change_wallet_password(const wallet_rpc::COMMAND_RPC_CHANGE_WALLET_PASSWORD::request &req, wallet_rpc::COMMAND_RPC_CHANGE_WALLET_PASSWORD::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:1985
bool on_query_key(const wallet_rpc::COMMAND_RPC_QUERY_KEY::request &req, wallet_rpc::COMMAND_RPC_QUERY_KEY::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:1062
bool on_incoming_transfers(const wallet_rpc::COMMAND_RPC_INCOMING_TRANSFERS::request &req, wallet_rpc::COMMAND_RPC_INCOMING_TRANSFERS::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:1013
bool on_get_bulk_payments(const wallet_rpc::COMMAND_RPC_GET_BULK_PAYMENTS::request &req, wallet_rpc::COMMAND_RPC_GET_BULK_PAYMENTS::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:936
bool on_getbalance(const wallet_rpc::COMMAND_RPC_GET_BALANCE::request &req, wallet_rpc::COMMAND_RPC_GET_BALANCE::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:345
bool on_export_key_images(const wallet_rpc::COMMAND_RPC_EXPORT_KEY_IMAGES::request &req, wallet_rpc::COMMAND_RPC_EXPORT_KEY_IMAGES::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:1456
Various Tools.
Definition: base58.cpp:43
CHAIN_HTTP_TO_MAP2(connection_context)
bool on_close_wallet(const wallet_rpc::COMMAND_RPC_CLOSE_WALLET::request &req, wallet_rpc::COMMAND_RPC_CLOSE_WALLET::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:1927
#define false
Definition: stdbool.h:38
bool on_stop_wallet(const wallet_rpc::COMMAND_RPC_STOP_WALLET::request &req, wallet_rpc::COMMAND_RPC_STOP_WALLET::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:1170
cryptonote::Blockchain * m_blockchain_storage
Definition: wallet_rpc_server.h:182
bool on_save_transfers_to_csv(const wallet_rpc::COMMAND_RPC_SAVE_TRANSFERS_TO_CSV::request &req, wallet_rpc::COMMAND_RPC_SAVE_TRANSFERS_TO_CSV::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:1434
bool on_stop_mining(const wallet_rpc::COMMAND_RPC_STOP_MINING::request &req, wallet_rpc::COMMAND_RPC_STOP_MINING::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:1751
wallet2 * m_wallet
Definition: wallet_rpc_server.h:171
Definition: connection_basic.cpp:91
wallet_rpc_server()
Definition: wallet_rpc_server.cpp:79
const boost::program_options::variables_map * m_vm
Definition: wallet_rpc_server.h:177
epee::net_utils::http::http_simple_client m_http_client
Definition: wallet_rpc_server.h:176
std::atomic< bool > m_stop
Definition: wallet_rpc_server.h:174
bool on_get_tx_notes(const wallet_rpc::COMMAND_RPC_GET_TX_NOTES::request &req, wallet_rpc::COMMAND_RPC_GET_TX_NOTES::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:1236
void handle_rpc_exception(const std::exception_ptr &e, epee::json_rpc::error &er, int default_error_code)
Definition: wallet_rpc_server.cpp:1944
static const char * tr(const char *str)
Definition: wallet_rpc_server.cpp:73
bool on_transfer(const wallet_rpc::COMMAND_RPC_TRANSFER::request &req, wallet_rpc::COMMAND_RPC_TRANSFER::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:479
bool on_relay_tx(const wallet_rpc::COMMAND_RPC_RELAY_TX::request &req, wallet_rpc::COMMAND_RPC_RELAY_TX::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:766
bool on_get_payments(const wallet_rpc::COMMAND_RPC_GET_PAYMENTS::request &req, wallet_rpc::COMMAND_RPC_GET_PAYMENTS::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:888
bool run()
Definition: wallet_rpc_server.cpp:98
bool on_verify(const wallet_rpc::COMMAND_RPC_VERIFY::request &req, wallet_rpc::COMMAND_RPC_VERIFY::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:1133
bool on_make_integrated_address(const wallet_rpc::COMMAND_RPC_MAKE_INTEGRATED_ADDRESS::request &req, wallet_rpc::COMMAND_RPC_MAKE_INTEGRATED_ADDRESS::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:801
bool on_transfer_split(const wallet_rpc::COMMAND_RPC_TRANSFER_SPLIT::request &req, wallet_rpc::COMMAND_RPC_TRANSFER_SPLIT::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:554
bool on_rescan_spent(const wallet_rpc::COMMAND_RPC_RESCAN_SPENT::request &req, wallet_rpc::COMMAND_RPC_RESCAN_SPENT::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:1694
bool on_get_address_book(const wallet_rpc::COMMAND_RPC_GET_ADDRESS_BOOK_ENTRY::request &req, wallet_rpc::COMMAND_RPC_GET_ADDRESS_BOOK_ENTRY::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:1564
POD_CLASS hash
Definition: hash.h:46
bool on_getaddress(const wallet_rpc::COMMAND_RPC_GET_ADDRESS::request &req, wallet_rpc::COMMAND_RPC_GET_ADDRESS::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:361
bool on_store(const wallet_rpc::COMMAND_RPC_STORE::request &req, wallet_rpc::COMMAND_RPC_STORE::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:866
bool on_create_wallet(const wallet_rpc::COMMAND_RPC_CREATE_WALLET::request &req, wallet_rpc::COMMAND_RPC_CREATE_WALLET::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:1771
void set_wallet(wallet2 *cr)
Definition: wallet_rpc_server.cpp:93
epee::net_utils::connection_context_base connection_context
Definition: wallet_rpc_server.h:54
~wallet_rpc_server()
Definition: wallet_rpc_server.cpp:83
bool on_get_transfer_by_txid(const wallet_rpc::COMMAND_RPC_GET_TRANSFER_BY_TXID::request &req, wallet_rpc::COMMAND_RPC_GET_TRANSFER_BY_TXID::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:1357
bool on_set_tx_notes(const wallet_rpc::COMMAND_RPC_SET_TX_NOTES::request &req, wallet_rpc::COMMAND_RPC_SET_TX_NOTES::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:1193
Definition: MicroCore.cpp:13
Definition: blockchain.h:80
bool on_add_address_book(const wallet_rpc::COMMAND_RPC_ADD_ADDRESS_BOOK_ENTRY::request &req, wallet_rpc::COMMAND_RPC_ADD_ADDRESS_BOOK_ENTRY::response &res, epee::json_rpc::error &er)
Definition: wallet_rpc_server.cpp:1591