From 17a9ee3f8f2d8af23f9f4f3f27b38fd7f9d90c2b Mon Sep 17 00:00:00 2001 From: Neozaru Date: Sun, 25 May 2014 00:20:46 +0200 Subject: 'getaddress' wallet-rpc command --- src/wallet/wallet_rpc_server.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/wallet/wallet_rpc_server.cpp') diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp index f1766c3b4..55f81aacc 100644 --- a/src/wallet/wallet_rpc_server.cpp +++ b/src/wallet/wallet_rpc_server.cpp @@ -71,6 +71,21 @@ namespace tools return true; } //------------------------------------------------------------------------------------------------------------------------------ + bool wallet_rpc_server::on_getaddress(const wallet_rpc::COMMAND_RPC_GET_ADDRESS::request& req, wallet_rpc::COMMAND_RPC_GET_ADDRESS::response& res, epee::json_rpc::error& er, connection_context& cntx) + { + try + { + res.address = m_wallet.get_account().get_public_address_str(); + } + catch (std::exception& e) + { + er.code = WALLET_RPC_ERROR_CODE_UNKNOWN_ERROR; + er.message = e.what(); + return false; + } + return true; + } + //------------------------------------------------------------------------------------------------------------------------------ bool wallet_rpc_server::on_transfer(const wallet_rpc::COMMAND_RPC_TRANSFER::request& req, wallet_rpc::COMMAND_RPC_TRANSFER::response& res, epee::json_rpc::error& er, connection_context& cntx) { -- cgit v1.2.3