From 6b2832fbcf48df988a39b836c5fbe65663c7ccfb Mon Sep 17 00:00:00 2001 From: cryptozoidberg Date: Sun, 10 May 2020 21:51:23 +0200 Subject: [PATCH] added welete_wallet method --- src/wallet/plain_wallet_api.cpp | 11 +++++++++++ src/wallet/plain_wallet_api.h | 1 + 2 files changed, 12 insertions(+) diff --git a/src/wallet/plain_wallet_api.cpp b/src/wallet/plain_wallet_api.cpp index 18f3dfd1..0cc8d5e1 100644 --- a/src/wallet/plain_wallet_api.cpp +++ b/src/wallet/plain_wallet_api.cpp @@ -241,6 +241,17 @@ namespace plain_wallet return epee::serialization::store_t_to_json(sl); } + std::string delete_wallet(const std::string& file_name) + { + std::string wallet_files_path = get_wallets_folder(); + strings_list sl = AUTO_VAL_INIT(sl); + boost::system::error_code er; + boost::filesystem::remove(wallet_files_path + file_name, er); + epee::json_rpc::response ok_response = AUTO_VAL_INIT(ok_response); + ok_response.result.return_code = API_RETURN_CODE_OK; + return epee::serialization::store_t_to_json(ok_response); + } + std::string open(const std::string& path, const std::string& password) { std::string full_path = get_wallets_folder() + path; diff --git a/src/wallet/plain_wallet_api.h b/src/wallet/plain_wallet_api.h index e60180a2..a6ef8243 100644 --- a/src/wallet/plain_wallet_api.h +++ b/src/wallet/plain_wallet_api.h @@ -14,6 +14,7 @@ namespace plain_wallet std::string set_log_level(int log_level); std::string get_version(); std::string get_wallet_files(); + std::string delete_wallet(const std::string& file_name); std::string get_appconfig(const std::string& encryption_key); std::string set_appconfig(const std::string& conf_str, const std::string& encryption_key);