diff --git a/src/wallet/plain_wallet_api.cpp b/src/wallet/plain_wallet_api.cpp index b7a91e8f..4b8a8fd6 100644 --- a/src/wallet/plain_wallet_api.cpp +++ b/src/wallet/plain_wallet_api.cpp @@ -95,21 +95,21 @@ namespace plain_wallet std::string get_wallets_folder() { #ifdef WIN32 - return ""; + std::string path = get_bundle_working_dir() + "/" + WALLETS_FOLDER_NAME + "/"; #else std::string path = get_bundle_working_dir() + "/" + WALLETS_FOLDER_NAME + "/"; - return path; #endif // WIN32 + return path; } std::string get_app_config_folder() { #ifdef WIN32 - return ""; + std::string path = get_bundle_working_dir() + "/" + APP_CONFIG_FOLDER + "/"; #else std::string path = get_bundle_working_dir() + "/" + APP_CONFIG_FOLDER + "/"; - return path; #endif // WIN32 + return path; } #ifdef ANDROID_BUILD class android_logger : public log_space::ibase_log_stream diff --git a/src/wallet/wallet_helpers.h b/src/wallet/wallet_helpers.h index 12355011..03533bf7 100644 --- a/src/wallet/wallet_helpers.h +++ b/src/wallet/wallet_helpers.h @@ -48,6 +48,16 @@ namespace tools result.hash_sum_matched = false; } } + if (!result.syntax_correct) + { + //possibly tracking wallet + currency::account_base acc; + result.syntax_correct = acc.restore_from_tracking_seed(seed_phrase); + if (result.syntax_correct) + { + result.tracking = true; + } + } return API_RETURN_CODE_OK; } } \ No newline at end of file diff --git a/src/wallet/wallet_public_structs_defs.h b/src/wallet/wallet_public_structs_defs.h index 7b0c344e..5324b8d7 100644 --- a/src/wallet/wallet_public_structs_defs.h +++ b/src/wallet/wallet_public_structs_defs.h @@ -184,11 +184,13 @@ namespace wallet_public bool syntax_correct; bool require_password; bool hash_sum_matched; + bool tracking; BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE(syntax_correct) KV_SERIALIZE(require_password) KV_SERIALIZE(hash_sum_matched) + KV_SERIALIZE(tracking) END_KV_SERIALIZE_MAP() }; diff --git a/tests/functional_tests/plain_wallet_tests.cpp b/tests/functional_tests/plain_wallet_tests.cpp index 457dcefc..f6efe29f 100644 --- a/tests/functional_tests/plain_wallet_tests.cpp +++ b/tests/functional_tests/plain_wallet_tests.cpp @@ -31,17 +31,29 @@ struct try_pull_result_open_response void run_plain_wallet_api_test() { LOG_PRINT_L0("Creating instance..."); - std::string s = plain_wallet::init("195.201.107.230", "11211", boost::dll::program_location().parent_path().string(), 1); - s = plain_wallet::get_export_private_info("E:\\tmp\\check_export"); - std::string key = plain_wallet::generate_random_key(10); - std::string test_data = "1234567890 test test "; - std::string res = plain_wallet::set_appconfig(test_data, key); - std::string test_data2 = plain_wallet::get_appconfig(key); - if (test_data2 != test_data) - { - LOG_ERROR("Error"); - } + //plain_wallet::set_bundle_working_dir("E:\\tmp\\check_export"); + std::string s = plain_wallet::init("195.201.107.230", "33333", boost::dll::program_location().parent_path().string(), 1); + //s = plain_wallet::get_export_private_info("E:\\tmp\\check_export"); + + + std::string res = plain_wallet::sync_call("get_seed_phrase_info", 0, "{\"seed_phrase\":\"aZxat4HAWriVQ3enkGcVsrZRdMseAJswG3CSEwTqZS246VsFQ53w26eZstYsu1jWE74Atz9ajLxFnBsVTafncWNH5SMv4zHFaTS:1780c4d5dd7e97cc4a75ea8baa7977d12ef948b9a6dddc2a9a37e5e22ac7180e:1599495055\"}"); + + + res = plain_wallet::restore("footstep knowledge fur capture honey minute carefully peaceful lovely crawl lunch government nightmare friendship myself sign possibly plan flower depression bread rainbow wrong hardly dark chest", + "test_wall2.zan", "111", ""); + + + epee::misc_utils::sleep_no_w(10000000); + + //std::string key = plain_wallet::generate_random_key(10); + //std::string test_data = "1234567890 test test "; + //std::string res = plain_wallet::set_appconfig(test_data, key); + //std::string test_data2 = plain_wallet::get_appconfig(key); + //if (test_data2 != test_data) + //{ + // LOG_ERROR("Error"); + //} return; //std::string fres = plain_wallet::get_logs_buffer(); //std::string fres2 = plain_wallet::truncate_log();