aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.h
diff options
context:
space:
mode:
authorstoffu <stoffu@protonmail.ch>2018-02-16 10:19:39 +0900
committerstoffu <stoffu@protonmail.ch>2018-03-15 22:01:51 +0900
commita7266d6d7bdf9f33ab5b17aef08b19eca1829de5 (patch)
tree6020a868a300a431d021ecb0ed18e9ac76430249 /src/wallet/wallet2.h
parentreplace invoke_http_json("/json_rpc",...) with invoke_http_json_rpc("/json_rp... (diff)
downloadmonero-a7266d6d7bdf9f33ab5b17aef08b19eca1829de5.tar.xz
wallet2+cli+rpc: eliminate redundant m_http_client from cli/rpc and delegate calls to wallet2
Diffstat (limited to 'src/wallet/wallet2.h')
-rw-r--r--src/wallet/wallet2.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h
index 9accc65ca..d2e484e05 100644
--- a/src/wallet/wallet2.h
+++ b/src/wallet/wallet2.h
@@ -1027,6 +1027,25 @@ namespace tools
crypto::public_key get_multisig_signing_public_key(size_t idx) const;
crypto::public_key get_multisig_signing_public_key(const crypto::secret_key &skey) const;
+ template<class t_request, class t_response>
+ inline bool invoke_http_json(const boost::string_ref uri, const t_request& req, t_response& res, std::chrono::milliseconds timeout = std::chrono::seconds(15), const boost::string_ref http_method = "GET")
+ {
+ boost::lock_guard<boost::mutex> lock(m_daemon_rpc_mutex);
+ return epee::net_utils::invoke_http_json(uri, req, res, m_http_client, timeout, http_method);
+ }
+ template<class t_request, class t_response>
+ inline bool invoke_http_bin(const boost::string_ref uri, const t_request& req, t_response& res, std::chrono::milliseconds timeout = std::chrono::seconds(15), const boost::string_ref http_method = "GET")
+ {
+ boost::lock_guard<boost::mutex> lock(m_daemon_rpc_mutex);
+ return epee::net_utils::invoke_http_bin(uri, req, res, m_http_client, timeout, http_method);
+ }
+ template<class t_request, class t_response>
+ inline bool invoke_http_json_rpc(const boost::string_ref uri, const std::string& method_name, const t_request& req, t_response& res, std::chrono::milliseconds timeout = std::chrono::seconds(15), const boost::string_ref http_method = "GET", const std::string& req_id = "0")
+ {
+ boost::lock_guard<boost::mutex> lock(m_daemon_rpc_mutex);
+ return epee::net_utils::invoke_http_json_rpc(uri, method_name, req, res, m_http_client, timeout, http_method, req_id);
+ }
+
private:
/*!
* \brief Stores wallet information to wallet file.