diff options
author | stoffu <stoffu@protonmail.ch> | 2018-03-06 18:20:41 +0900 |
---|---|---|
committer | stoffu <stoffu@protonmail.ch> | 2018-03-06 21:14:52 +0900 |
commit | 1ff35fda7cbde7b96ed31fd319c1d5646f8820e9 (patch) | |
tree | 4865387b3bd1ce39a78475c928bca266509886e2 | |
parent | Merge pull request #3253 (diff) | |
download | monero-1ff35fda7cbde7b96ed31fd319c1d5646f8820e9.tar.xz |
Wallet API: make nettype non-defaulted to disambiguate from deprecated versions (and make libwallet_api_tests compilable)
-rw-r--r-- | src/wallet/api/wallet2_api.h | 6 | ||||
-rw-r--r-- | tests/libwallet_api_tests/main.cpp | 102 |
2 files changed, 54 insertions, 54 deletions
diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h index a6320545e..0c899f7c1 100644 --- a/src/wallet/api/wallet2_api.h +++ b/src/wallet/api/wallet2_api.h @@ -774,7 +774,7 @@ struct WalletManager * \param nettype Network type * \return Wallet instance (Wallet::status() needs to be called to check if created successfully) */ - virtual Wallet * createWallet(const std::string &path, const std::string &password, const std::string &language, NetworkType nettype = MAINNET) = 0; + virtual Wallet * createWallet(const std::string &path, const std::string &password, const std::string &language, NetworkType nettype) = 0; Wallet * createWallet(const std::string &path, const std::string &password, const std::string &language, bool testnet = false) // deprecated { return createWallet(path, password, language, testnet ? TESTNET : MAINNET); @@ -787,7 +787,7 @@ struct WalletManager * \param nettype Network type * \return Wallet instance (Wallet::status() needs to be called to check if opened successfully) */ - virtual Wallet * openWallet(const std::string &path, const std::string &password, NetworkType nettype = MAINNET) = 0; + virtual Wallet * openWallet(const std::string &path, const std::string &password, NetworkType nettype) = 0; Wallet * openWallet(const std::string &path, const std::string &password, bool testnet = false) // deprecated { return openWallet(path, password, testnet ? TESTNET : MAINNET); @@ -819,7 +819,7 @@ struct WalletManager * \param restoreHeight restore from start height * \return Wallet instance (Wallet::status() needs to be called to check if recovered successfully) */ - virtual Wallet * recoveryWallet(const std::string &path, const std::string &mnemonic, NetworkType nettype = MAINNET, uint64_t restoreHeight = 0) = 0; + virtual Wallet * recoveryWallet(const std::string &path, const std::string &mnemonic, NetworkType nettype, uint64_t restoreHeight = 0) = 0; Wallet * recoveryWallet(const std::string &path, const std::string &mnemonic, bool testnet = false, uint64_t restoreHeight = 0) // deprecated { return recoveryWallet(path, mnemonic, testnet ? TESTNET : MAINNET, restoreHeight); diff --git a/tests/libwallet_api_tests/main.cpp b/tests/libwallet_api_tests/main.cpp index 1e63a12f3..fe31541df 100644 --- a/tests/libwallet_api_tests/main.cpp +++ b/tests/libwallet_api_tests/main.cpp @@ -130,7 +130,7 @@ struct Utils static std::string get_wallet_address(const std::string &filename, const std::string &password) { Monero::WalletManager *wmgr = Monero::WalletManagerFactory::getWalletManager(); - Monero::Wallet * w = wmgr->openWallet(filename, password, true); + Monero::Wallet * w = wmgr->openWallet(filename, password, Monero::NetworkType::TESTNET); std::string result = w->mainAddress(); wmgr->closeWallet(w); return result; @@ -208,7 +208,7 @@ struct WalletTest2 : public testing::Test TEST_F(WalletManagerTest, WalletManagerCreatesWallet) { - Monero::Wallet * wallet = wmgr->createWallet(WALLET_NAME, WALLET_PASS, WALLET_LANG); + Monero::Wallet * wallet = wmgr->createWallet(WALLET_NAME, WALLET_PASS, WALLET_LANG, Monero::NetworkType::MAINNET); ASSERT_TRUE(wallet->status() == Monero::Wallet::Status_Ok); ASSERT_TRUE(!wallet->seed().empty()); std::vector<std::string> words; @@ -225,10 +225,10 @@ TEST_F(WalletManagerTest, WalletManagerCreatesWallet) TEST_F(WalletManagerTest, WalletManagerOpensWallet) { - Monero::Wallet * wallet1 = wmgr->createWallet(WALLET_NAME, WALLET_PASS, WALLET_LANG); + Monero::Wallet * wallet1 = wmgr->createWallet(WALLET_NAME, WALLET_PASS, WALLET_LANG, Monero::NetworkType::MAINNET); std::string seed1 = wallet1->seed(); ASSERT_TRUE(wmgr->closeWallet(wallet1)); - Monero::Wallet * wallet2 = wmgr->openWallet(WALLET_NAME, WALLET_PASS); + Monero::Wallet * wallet2 = wmgr->openWallet(WALLET_NAME, WALLET_PASS, Monero::NetworkType::MAINNET); ASSERT_TRUE(wallet2->status() == Monero::Wallet::Status_Ok); ASSERT_TRUE(wallet2->seed() == seed1); std::cout << "** seed: " << wallet2->seed() << std::endl; @@ -261,7 +261,7 @@ void open_wallet_helper(Monero::WalletManager *wmgr, Monero::Wallet **wallet, co if (mutex) mutex->lock(); LOG_PRINT_L3("opening wallet in thread: " << boost::this_thread::get_id()); - *wallet = wmgr->openWallet(WALLET_NAME, pass, true); + *wallet = wmgr->openWallet(WALLET_NAME, pass, Monero::NetworkType::TESTNET); LOG_PRINT_L3("wallet address: " << (*wallet)->mainAddress()); LOG_PRINT_L3("wallet status: " << (*wallet)->status()); LOG_PRINT_L3("closing wallet in thread: " << boost::this_thread::get_id()); @@ -277,7 +277,7 @@ void open_wallet_helper(Monero::WalletManager *wmgr, Monero::Wallet **wallet, co // // create password protected wallet // std::string wallet_pass = "password"; // std::string wrong_wallet_pass = "1111"; -// Monero::Wallet * wallet1 = wmgr->createWallet(WALLET_NAME, wallet_pass, WALLET_LANG, true); +// Monero::Wallet * wallet1 = wmgr->createWallet(WALLET_NAME, wallet_pass, WALLET_LANG, Monero::NetworkType::TESTNET); // std::string seed1 = wallet1->seed(); // ASSERT_TRUE(wmgr->closeWallet(wallet1)); @@ -303,7 +303,7 @@ TEST_F(WalletManagerTest, WalletManagerOpensWalletWithPasswordAndReopen) // create password protected wallet std::string wallet_pass = "password"; std::string wrong_wallet_pass = "1111"; - Monero::Wallet * wallet1 = wmgr->createWallet(WALLET_NAME, wallet_pass, WALLET_LANG, true); + Monero::Wallet * wallet1 = wmgr->createWallet(WALLET_NAME, wallet_pass, WALLET_LANG, Monero::NetworkType::TESTNET); std::string seed1 = wallet1->seed(); ASSERT_TRUE(wmgr->closeWallet(wallet1)); @@ -326,11 +326,11 @@ TEST_F(WalletManagerTest, WalletManagerOpensWalletWithPasswordAndReopen) TEST_F(WalletManagerTest, WalletManagerStoresWallet) { - Monero::Wallet * wallet1 = wmgr->createWallet(WALLET_NAME, WALLET_PASS, WALLET_LANG); + Monero::Wallet * wallet1 = wmgr->createWallet(WALLET_NAME, WALLET_PASS, WALLET_LANG, Monero::NetworkType::MAINNET); std::string seed1 = wallet1->seed(); wallet1->store(""); ASSERT_TRUE(wmgr->closeWallet(wallet1)); - Monero::Wallet * wallet2 = wmgr->openWallet(WALLET_NAME, WALLET_PASS); + Monero::Wallet * wallet2 = wmgr->openWallet(WALLET_NAME, WALLET_PASS, Monero::NetworkType::MAINNET); ASSERT_TRUE(wallet2->status() == Monero::Wallet::Status_Ok); ASSERT_TRUE(wallet2->seed() == seed1); } @@ -339,12 +339,12 @@ TEST_F(WalletManagerTest, WalletManagerStoresWallet) TEST_F(WalletManagerTest, WalletManagerMovesWallet) { - Monero::Wallet * wallet1 = wmgr->createWallet(WALLET_NAME, WALLET_PASS, WALLET_LANG); + Monero::Wallet * wallet1 = wmgr->createWallet(WALLET_NAME, WALLET_PASS, WALLET_LANG, Monero::NetworkType::MAINNET); std::string WALLET_NAME_MOVED = std::string("/tmp/") + WALLET_NAME + ".moved"; std::string seed1 = wallet1->seed(); ASSERT_TRUE(wallet1->store(WALLET_NAME_MOVED)); - Monero::Wallet * wallet2 = wmgr->openWallet(WALLET_NAME_MOVED, WALLET_PASS); + Monero::Wallet * wallet2 = wmgr->openWallet(WALLET_NAME_MOVED, WALLET_PASS, Monero::NetworkType::MAINNET); ASSERT_TRUE(wallet2->filename() == WALLET_NAME_MOVED); ASSERT_TRUE(wallet2->keysFilename() == WALLET_NAME_MOVED + ".keys"); ASSERT_TRUE(wallet2->status() == Monero::Wallet::Status_Ok); @@ -354,15 +354,15 @@ TEST_F(WalletManagerTest, WalletManagerMovesWallet) TEST_F(WalletManagerTest, WalletManagerChangesPassword) { - Monero::Wallet * wallet1 = wmgr->createWallet(WALLET_NAME, WALLET_PASS, WALLET_LANG); + Monero::Wallet * wallet1 = wmgr->createWallet(WALLET_NAME, WALLET_PASS, WALLET_LANG, Monero::NetworkType::MAINNET); std::string seed1 = wallet1->seed(); ASSERT_TRUE(wallet1->setPassword(WALLET_PASS2)); ASSERT_TRUE(wmgr->closeWallet(wallet1)); - Monero::Wallet * wallet2 = wmgr->openWallet(WALLET_NAME, WALLET_PASS2); + Monero::Wallet * wallet2 = wmgr->openWallet(WALLET_NAME, WALLET_PASS2, Monero::NetworkType::MAINNET); ASSERT_TRUE(wallet2->status() == Monero::Wallet::Status_Ok); ASSERT_TRUE(wallet2->seed() == seed1); ASSERT_TRUE(wmgr->closeWallet(wallet2)); - Monero::Wallet * wallet3 = wmgr->openWallet(WALLET_NAME, WALLET_PASS); + Monero::Wallet * wallet3 = wmgr->openWallet(WALLET_NAME, WALLET_PASS, Monero::NetworkType::MAINNET); ASSERT_FALSE(wallet3->status() == Monero::Wallet::Status_Ok); } @@ -370,13 +370,13 @@ TEST_F(WalletManagerTest, WalletManagerChangesPassword) TEST_F(WalletManagerTest, WalletManagerRecoversWallet) { - Monero::Wallet * wallet1 = wmgr->createWallet(WALLET_NAME, WALLET_PASS, WALLET_LANG); + Monero::Wallet * wallet1 = wmgr->createWallet(WALLET_NAME, WALLET_PASS, WALLET_LANG, Monero::NetworkType::MAINNET); std::string seed1 = wallet1->seed(); std::string address1 = wallet1->mainAddress(); ASSERT_FALSE(address1.empty()); ASSERT_TRUE(wmgr->closeWallet(wallet1)); Utils::deleteWallet(WALLET_NAME); - Monero::Wallet * wallet2 = wmgr->recoveryWallet(WALLET_NAME, seed1); + Monero::Wallet * wallet2 = wmgr->recoveryWallet(WALLET_NAME, seed1, Monero::NetworkType::MAINNET); ASSERT_TRUE(wallet2->status() == Monero::Wallet::Status_Ok); ASSERT_TRUE(wallet2->seed() == seed1); ASSERT_TRUE(wallet2->mainAddress() == address1); @@ -386,14 +386,14 @@ TEST_F(WalletManagerTest, WalletManagerRecoversWallet) TEST_F(WalletManagerTest, WalletManagerStoresWallet1) { - Monero::Wallet * wallet1 = wmgr->createWallet(WALLET_NAME, WALLET_PASS, WALLET_LANG); + Monero::Wallet * wallet1 = wmgr->createWallet(WALLET_NAME, WALLET_PASS, WALLET_LANG, Monero::NetworkType::MAINNET); std::string seed1 = wallet1->seed(); std::string address1 = wallet1->mainAddress(); ASSERT_TRUE(wallet1->store("")); ASSERT_TRUE(wallet1->store(WALLET_NAME_COPY)); ASSERT_TRUE(wmgr->closeWallet(wallet1)); - Monero::Wallet * wallet2 = wmgr->openWallet(WALLET_NAME_COPY, WALLET_PASS); + Monero::Wallet * wallet2 = wmgr->openWallet(WALLET_NAME_COPY, WALLET_PASS, Monero::NetworkType::MAINNET); ASSERT_TRUE(wallet2->status() == Monero::Wallet::Status_Ok); ASSERT_TRUE(wallet2->seed() == seed1); ASSERT_TRUE(wallet2->mainAddress() == address1); @@ -403,14 +403,14 @@ TEST_F(WalletManagerTest, WalletManagerStoresWallet1) TEST_F(WalletManagerTest, WalletManagerStoresWallet2) { - Monero::Wallet * wallet1 = wmgr->createWallet(WALLET_NAME, WALLET_PASS, WALLET_LANG); + Monero::Wallet * wallet1 = wmgr->createWallet(WALLET_NAME, WALLET_PASS, WALLET_LANG, Monero::NetworkType::MAINNET); std::string seed1 = wallet1->seed(); std::string address1 = wallet1->mainAddress(); ASSERT_TRUE(wallet1->store(WALLET_NAME_WITH_DIR)); ASSERT_TRUE(wmgr->closeWallet(wallet1)); - wallet1 = wmgr->openWallet(WALLET_NAME_WITH_DIR, WALLET_PASS); + wallet1 = wmgr->openWallet(WALLET_NAME_WITH_DIR, WALLET_PASS, Monero::NetworkType::MAINNET); ASSERT_TRUE(wallet1->status() == Monero::Wallet::Status_Ok); ASSERT_TRUE(wallet1->seed() == seed1); ASSERT_TRUE(wallet1->mainAddress() == address1); @@ -420,20 +420,20 @@ TEST_F(WalletManagerTest, WalletManagerStoresWallet2) TEST_F(WalletManagerTest, WalletManagerStoresWallet3) { - Monero::Wallet * wallet1 = wmgr->createWallet(WALLET_NAME, WALLET_PASS, WALLET_LANG); + Monero::Wallet * wallet1 = wmgr->createWallet(WALLET_NAME, WALLET_PASS, WALLET_LANG, Monero::NetworkType::MAINNET); std::string seed1 = wallet1->seed(); std::string address1 = wallet1->mainAddress(); ASSERT_FALSE(wallet1->store(WALLET_NAME_WITH_DIR_NON_WRITABLE)); ASSERT_TRUE(wmgr->closeWallet(wallet1)); - wallet1 = wmgr->openWallet(WALLET_NAME_WITH_DIR_NON_WRITABLE, WALLET_PASS); + wallet1 = wmgr->openWallet(WALLET_NAME_WITH_DIR_NON_WRITABLE, WALLET_PASS, Monero::NetworkType::MAINNET); ASSERT_FALSE(wallet1->status() == Monero::Wallet::Status_Ok); // "close" always returns true; ASSERT_TRUE(wmgr->closeWallet(wallet1)); - wallet1 = wmgr->openWallet(WALLET_NAME, WALLET_PASS); + wallet1 = wmgr->openWallet(WALLET_NAME, WALLET_PASS, Monero::NetworkType::MAINNET); ASSERT_TRUE(wallet1->status() == Monero::Wallet::Status_Ok); ASSERT_TRUE(wallet1->seed() == seed1); ASSERT_TRUE(wallet1->mainAddress() == address1); @@ -444,7 +444,7 @@ TEST_F(WalletManagerTest, WalletManagerStoresWallet3) TEST_F(WalletManagerTest, WalletManagerStoresWallet4) { - Monero::Wallet * wallet1 = wmgr->createWallet(WALLET_NAME, WALLET_PASS, WALLET_LANG); + Monero::Wallet * wallet1 = wmgr->createWallet(WALLET_NAME, WALLET_PASS, WALLET_LANG, Monero::NetworkType::MAINNET); std::string seed1 = wallet1->seed(); std::string address1 = wallet1->mainAddress(); @@ -456,7 +456,7 @@ TEST_F(WalletManagerTest, WalletManagerStoresWallet4) ASSERT_TRUE(wmgr->closeWallet(wallet1)); - wallet1 = wmgr->openWallet(WALLET_NAME, WALLET_PASS); + wallet1 = wmgr->openWallet(WALLET_NAME, WALLET_PASS, Monero::NetworkType::MAINNET); ASSERT_TRUE(wallet1->status() == Monero::Wallet::Status_Ok); ASSERT_TRUE(wallet1->seed() == seed1); ASSERT_TRUE(wallet1->mainAddress() == address1); @@ -488,7 +488,7 @@ TEST_F(WalletTest1, WalletGeneratesIntegratedAddress) { std::string payment_id = Monero::Wallet::genPaymentId(); - Monero::Wallet * wallet1 = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, true); + Monero::Wallet * wallet1 = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, Monero::NetworkType::TESTNET); std::string integrated_address = wallet1->integratedAddress(payment_id); ASSERT_TRUE(integrated_address.length() == 106); } @@ -496,14 +496,14 @@ TEST_F(WalletTest1, WalletGeneratesIntegratedAddress) TEST_F(WalletTest1, WalletShowsBalance) { - Monero::Wallet * wallet1 = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, true); + Monero::Wallet * wallet1 = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, Monero::NetworkType::TESTNET); ASSERT_TRUE(wallet1->balance(0) > 0); ASSERT_TRUE(wallet1->unlockedBalance(0) > 0); uint64_t balance1 = wallet1->balance(0); uint64_t unlockedBalance1 = wallet1->unlockedBalance(0); ASSERT_TRUE(wmgr->closeWallet(wallet1)); - Monero::Wallet * wallet2 = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, true); + Monero::Wallet * wallet2 = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, Monero::NetworkType::TESTNET); ASSERT_TRUE(balance1 == wallet2->balance(0)); std::cout << "wallet balance: " << wallet2->balance(0) << std::endl; @@ -514,7 +514,7 @@ TEST_F(WalletTest1, WalletShowsBalance) TEST_F(WalletTest1, WalletReturnsCurrentBlockHeight) { - Monero::Wallet * wallet1 = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, true); + Monero::Wallet * wallet1 = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, Monero::NetworkType::TESTNET); ASSERT_TRUE(wallet1->blockChainHeight() > 0); wmgr->closeWallet(wallet1); } @@ -522,14 +522,14 @@ TEST_F(WalletTest1, WalletReturnsCurrentBlockHeight) TEST_F(WalletTest1, WalletReturnsDaemonBlockHeight) { - Monero::Wallet * wallet1 = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, true); + Monero::Wallet * wallet1 = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, Monero::NetworkType::TESTNET); // wallet not connected to daemon ASSERT_TRUE(wallet1->daemonBlockChainHeight() == 0); ASSERT_TRUE(wallet1->status() != Monero::Wallet::Status_Ok); ASSERT_FALSE(wallet1->errorString().empty()); wmgr->closeWallet(wallet1); - wallet1 = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, true); + wallet1 = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, Monero::NetworkType::TESTNET); // wallet connected to daemon wallet1->init(TESTNET_DAEMON_ADDRESS, 0); ASSERT_TRUE(wallet1->daemonBlockChainHeight() > 0); @@ -542,7 +542,7 @@ TEST_F(WalletTest1, WalletRefresh) { std::cout << "Opening wallet: " << CURRENT_SRC_WALLET << std::endl; - Monero::Wallet * wallet1 = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, true); + Monero::Wallet * wallet1 = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, Monero::NetworkType::TESTNET); // make sure testnet daemon is running std::cout << "connecting to daemon: " << TESTNET_DAEMON_ADDRESS << std::endl; ASSERT_TRUE(wallet1->init(TESTNET_DAEMON_ADDRESS, 0)); @@ -566,7 +566,7 @@ TEST_F(WalletTest1, WalletConvertsToString) TEST_F(WalletTest1, WalletTransaction) { - Monero::Wallet * wallet1 = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, true); + Monero::Wallet * wallet1 = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, Monero::NetworkType::TESTNET); // make sure testnet daemon is running ASSERT_TRUE(wallet1->init(TESTNET_DAEMON_ADDRESS, 0)); ASSERT_TRUE(wallet1->refresh()); @@ -608,7 +608,7 @@ TEST_F(WalletTest1, WalletTransactionWithMixin) std::string payment_id = ""; - Monero::Wallet * wallet1 = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, true); + Monero::Wallet * wallet1 = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, Monero::NetworkType::TESTNET); // make sure testnet daemon is running @@ -642,7 +642,7 @@ TEST_F(WalletTest1, WalletTransactionWithPriority) std::string payment_id = ""; - Monero::Wallet * wallet1 = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, true); + Monero::Wallet * wallet1 = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, Monero::NetworkType::TESTNET); // make sure testnet daemon is running ASSERT_TRUE(wallet1->init(TESTNET_DAEMON_ADDRESS, 0)); @@ -682,7 +682,7 @@ TEST_F(WalletTest1, WalletTransactionWithPriority) TEST_F(WalletTest1, WalletHistory) { - Monero::Wallet * wallet1 = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, true); + Monero::Wallet * wallet1 = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, Monero::NetworkType::TESTNET); // make sure testnet daemon is running ASSERT_TRUE(wallet1->init(TESTNET_DAEMON_ADDRESS, 0)); ASSERT_TRUE(wallet1->refresh()); @@ -700,7 +700,7 @@ TEST_F(WalletTest1, WalletHistory) TEST_F(WalletTest1, WalletTransactionAndHistory) { return; - Monero::Wallet * wallet_src = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, true); + Monero::Wallet * wallet_src = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, Monero::NetworkType::TESTNET); // make sure testnet daemon is running ASSERT_TRUE(wallet_src->init(TESTNET_DAEMON_ADDRESS, 0)); ASSERT_TRUE(wallet_src->refresh()); @@ -739,7 +739,7 @@ TEST_F(WalletTest1, WalletTransactionAndHistory) TEST_F(WalletTest1, WalletTransactionWithPaymentId) { - Monero::Wallet * wallet_src = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, true); + Monero::Wallet * wallet_src = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, Monero::NetworkType::TESTNET); // make sure testnet daemon is running ASSERT_TRUE(wallet_src->init(TESTNET_DAEMON_ADDRESS, 0)); ASSERT_TRUE(wallet_src->refresh()); @@ -881,7 +881,7 @@ struct MyWalletListener : public Monero::WalletListener TEST_F(WalletTest2, WalletCallBackRefreshedSync) { - Monero::Wallet * wallet_src = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, true); + Monero::Wallet * wallet_src = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, Monero::NetworkType::TESTNET); MyWalletListener * wallet_src_listener = new MyWalletListener(wallet_src); ASSERT_TRUE(wallet_src->init(TESTNET_DAEMON_ADDRESS, 0)); ASSERT_TRUE(wallet_src_listener->refresh_triggered); @@ -898,7 +898,7 @@ TEST_F(WalletTest2, WalletCallBackRefreshedSync) TEST_F(WalletTest2, WalletCallBackRefreshedAsync) { - Monero::Wallet * wallet_src = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, true); + Monero::Wallet * wallet_src = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, Monero::NetworkType::TESTNET); MyWalletListener * wallet_src_listener = new MyWalletListener(wallet_src); boost::chrono::seconds wait_for = boost::chrono::seconds(20); @@ -920,14 +920,14 @@ TEST_F(WalletTest2, WalletCallBackRefreshedAsync) TEST_F(WalletTest2, WalletCallbackSent) { - Monero::Wallet * wallet_src = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, true); + Monero::Wallet * wallet_src = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, Monero::NetworkType::TESTNET); // make sure testnet daemon is running ASSERT_TRUE(wallet_src->init(TESTNET_DAEMON_ADDRESS, 0)); ASSERT_TRUE(wallet_src->refresh()); MyWalletListener * wallet_src_listener = new MyWalletListener(wallet_src); uint64_t balance = wallet_src->balance(0); std::cout << "** Balance: " << wallet_src->displayAmount(wallet_src->balance(0)) << std::endl; - Monero::Wallet * wallet_dst = wmgr->openWallet(CURRENT_DST_WALLET, TESTNET_WALLET_PASS, true); + Monero::Wallet * wallet_dst = wmgr->openWallet(CURRENT_DST_WALLET, TESTNET_WALLET_PASS, Monero::NetworkType::TESTNET); uint64_t amount = AMOUNT_1XMR * 5; std::cout << "** Sending " << Monero::Wallet::displayAmount(amount) << " to " << wallet_dst->mainAddress(); @@ -959,13 +959,13 @@ TEST_F(WalletTest2, WalletCallbackSent) TEST_F(WalletTest2, WalletCallbackReceived) { - Monero::Wallet * wallet_src = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, true); + Monero::Wallet * wallet_src = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, Monero::NetworkType::TESTNET); // make sure testnet daemon is running ASSERT_TRUE(wallet_src->init(TESTNET_DAEMON_ADDRESS, 0)); ASSERT_TRUE(wallet_src->refresh()); std::cout << "** Balance src1: " << wallet_src->displayAmount(wallet_src->balance(0)) << std::endl; - Monero::Wallet * wallet_dst = wmgr->openWallet(CURRENT_DST_WALLET, TESTNET_WALLET_PASS, true); + Monero::Wallet * wallet_dst = wmgr->openWallet(CURRENT_DST_WALLET, TESTNET_WALLET_PASS, Monero::NetworkType::TESTNET); ASSERT_TRUE(wallet_dst->init(TESTNET_DAEMON_ADDRESS, 0)); ASSERT_TRUE(wallet_dst->refresh()); uint64_t balance = wallet_dst->balance(0); @@ -1006,7 +1006,7 @@ TEST_F(WalletTest2, WalletCallbackReceived) TEST_F(WalletTest2, WalletCallbackNewBlock) { - Monero::Wallet * wallet_src = wmgr->openWallet(TESTNET_WALLET5_NAME, TESTNET_WALLET_PASS, true); + Monero::Wallet * wallet_src = wmgr->openWallet(TESTNET_WALLET5_NAME, TESTNET_WALLET_PASS, Monero::NetworkType::TESTNET); // make sure testnet daemon is running ASSERT_TRUE(wallet_src->init(TESTNET_DAEMON_ADDRESS, 0)); ASSERT_TRUE(wallet_src->refresh()); @@ -1033,7 +1033,7 @@ TEST_F(WalletTest2, WalletCallbackNewBlock) TEST_F(WalletManagerMainnetTest, CreateOpenAndRefreshWalletMainNetSync) { - Monero::Wallet * wallet = wmgr->createWallet(WALLET_NAME_MAINNET, "", WALLET_LANG); + Monero::Wallet * wallet = wmgr->createWallet(WALLET_NAME_MAINNET, "", WALLET_LANG, Monero::NetworkType::MAINNET); std::unique_ptr<MyWalletListener> wallet_listener (new MyWalletListener(wallet)); wallet->init(MAINNET_DAEMON_ADDRESS, 0); std::cerr << "TEST: waiting on refresh lock...\n"; @@ -1052,7 +1052,7 @@ TEST_F(WalletManagerMainnetTest, CreateAndRefreshWalletMainNetAsync) // supposing 120 seconds should be enough for fast refresh int SECONDS_TO_REFRESH = 120; - Monero::Wallet * wallet = wmgr->createWallet(WALLET_NAME_MAINNET, "", WALLET_LANG); + Monero::Wallet * wallet = wmgr->createWallet(WALLET_NAME_MAINNET, "", WALLET_LANG, Monero::NetworkType::MAINNET); std::unique_ptr<MyWalletListener> wallet_listener (new MyWalletListener(wallet)); boost::chrono::seconds wait_for = boost::chrono::seconds(SECONDS_TO_REFRESH); @@ -1075,9 +1075,9 @@ TEST_F(WalletManagerMainnetTest, OpenAndRefreshWalletMainNetAsync) // supposing 120 seconds should be enough for fast refresh int SECONDS_TO_REFRESH = 120; - Monero::Wallet * wallet = wmgr->createWallet(WALLET_NAME_MAINNET, "", WALLET_LANG); + Monero::Wallet * wallet = wmgr->createWallet(WALLET_NAME_MAINNET, "", WALLET_LANG, Monero::NetworkType::MAINNET); wmgr->closeWallet(wallet); - wallet = wmgr->openWallet(WALLET_NAME_MAINNET, ""); + wallet = wmgr->openWallet(WALLET_NAME_MAINNET, "", Monero::NetworkType::MAINNET); std::unique_ptr<MyWalletListener> wallet_listener (new MyWalletListener(wallet)); @@ -1102,7 +1102,7 @@ TEST_F(WalletManagerMainnetTest, RecoverAndRefreshWalletMainNetAsync) // supposing 120 seconds should be enough for fast refresh int SECONDS_TO_REFRESH = 120; - Monero::Wallet * wallet = wmgr->createWallet(WALLET_NAME_MAINNET, "", WALLET_LANG); + Monero::Wallet * wallet = wmgr->createWallet(WALLET_NAME_MAINNET, "", WALLET_LANG, Monero::NetworkType::MAINNET); std::string seed = wallet->seed(); std::string address = wallet->mainAddress(); wmgr->closeWallet(wallet); @@ -1111,7 +1111,7 @@ TEST_F(WalletManagerMainnetTest, RecoverAndRefreshWalletMainNetAsync) Utils::deleteWallet(WALLET_NAME_MAINNET); // ..and recovering wallet from seed - wallet = wmgr->recoveryWallet(WALLET_NAME_MAINNET, seed); + wallet = wmgr->recoveryWallet(WALLET_NAME_MAINNET, seed, Monero::NetworkType::MAINNET); ASSERT_TRUE(wallet->status() == Monero::Wallet::Status_Ok); ASSERT_TRUE(wallet->mainAddress() == address); std::unique_ptr<MyWalletListener> wallet_listener (new MyWalletListener(wallet)); |