From 756019284e909002f4847667012574bf13a0b228 Mon Sep 17 00:00:00 2001 From: woodser Date: Sun, 26 May 2019 19:09:13 -0400 Subject: [PATCH] add Scratchpad.cpp --- test/Scratchpad.cpp | 55 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 test/Scratchpad.cpp diff --git a/test/Scratchpad.cpp b/test/Scratchpad.cpp new file mode 100644 index 0000000..94f28f7 --- /dev/null +++ b/test/Scratchpad.cpp @@ -0,0 +1,55 @@ +#include +#include +#include "wallet2.h" +//#include +using namespace std; + +bool walletExists(string path) { + //std::cout << boost::stacktrace::stacktrace(); + bool keys_file_exists; + bool wallet_file_exists; + tools::wallet2::wallet_exists(path, keys_file_exists, wallet_file_exists); + return wallet_file_exists; +} + +void openWallet(string path, string password, int networkType) { + cout << "openWallet(" << path << ", " << password << ", " << networkType << ")" << endl; + std::unique_ptr wallet; + wallet.reset(new tools::wallet2(cryptonote::network_type::STAGENET, 1, true)); + throw runtime_error("Not implemented"); +} + +void createWalletRandom(string language, int networkType) { + tools::wallet2* wallet = new tools::wallet2(static_cast(networkType), 1, true); + wallet->set_seed_language(language); + crypto::secret_key recovery_val, secret_key; + wallet->generate(string(""), string(""), secret_key, false, false); + + // print the mnemonic + epee::wipeable_string mnemonic; + wallet->get_seed(mnemonic); + cout << "Mnemonic: " << string(mnemonic.data(), mnemonic.size()) << endl; +} + +/** + * Scratchpad main entry point. + */ +int main(int argc, const char* argv[]) { + + // print header + cout << "===== Scratchpad =====" << endl; + for (int i = 0; i < argc; i++) { + printf("Argument %d: %s\n", i, argv[i]); + } + cout << endl; + + string path = "test_wallet_1"; + string password = "supersecretpassword123"; + string language = "English"; + int networkType = 2; + + cout << "Wallet exists: " << walletExists(path) << endl; + +// openWallet(path, password, networkType); + createWalletRandom(language, networkType); +}