aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.h
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2018-03-15 17:07:03 +0200
committerRiccardo Spagni <ric@spagni.net>2018-03-15 17:07:03 +0200
commita3f0292c060fe5661dff20b2ef381a7063f8cf62 (patch)
tree6020a868a300a431d021ecb0ed18e9ac76430249 /src/wallet/wallet2.h
parentMerge pull request #3398 (diff)
parentwallet2+cli+rpc: eliminate redundant m_http_client from cli/rpc and delegate ... (diff)
downloadmonero-a3f0292c060fe5661dff20b2ef381a7063f8cf62.tar.xz
Merge pull request #3271
a7266d6d wallet2+cli+rpc: eliminate redundant m_http_client from cli/rpc and delegate calls to wallet2 (stoffu) 71d18656 replace invoke_http_json("/json_rpc",...) with invoke_http_json_rpc("/json_rpc",methodname,...) to reduce boilerplate (stoffu)
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.