aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIlya Kitaev <mbg033@gmail.com>2016-02-20 19:04:56 +0300
committerIlya Kitaev <mbg033@gmail.com>2016-03-16 14:27:57 +0300
commit930bed7074c6a54601105bda8f26638ca45e60fd (patch)
tree8c7fff973121add66effcb7554f8095e83225c51 /src
parentwallet2 public api. initial commit (diff)
downloadmonero-930bed7074c6a54601105bda8f26638ca45e60fd.tar.xz
tests for wallet2_api
Diffstat (limited to 'src')
-rw-r--r--src/wallet/CMakeLists.txt2
-rw-r--r--src/wallet/wallet2_api.cpp36
-rw-r--r--src/wallet/wallet2_api.h8
3 files changed, 40 insertions, 6 deletions
diff --git a/src/wallet/CMakeLists.txt b/src/wallet/CMakeLists.txt
index 261d453e2..a6fc37dec 100644
--- a/src/wallet/CMakeLists.txt
+++ b/src/wallet/CMakeLists.txt
@@ -58,6 +58,6 @@ target_link_libraries(wallet
${Boost_SERIALIZATION_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
+ ${Boost_REGEX_LIBRARY}
${EXTRA_LIBRARIES})
-
diff --git a/src/wallet/wallet2_api.cpp b/src/wallet/wallet2_api.cpp
index 4855d34f3..ffb18c317 100644
--- a/src/wallet/wallet2_api.cpp
+++ b/src/wallet/wallet2_api.cpp
@@ -32,12 +32,17 @@
#include "wallet2.h"
#include <memory>
+unsigned int epee::g_test_dbg_lock_sleep = 0;
+
namespace Bitmonero {
struct WalletManagerImpl;
namespace {
static WalletManagerImpl * g_walletManager = nullptr;
+
+
+
}
@@ -65,6 +70,8 @@ WalletImpl::WalletImpl()
}
+Wallet::~Wallet() {}
+
WalletImpl::~WalletImpl()
{
//delete m_wallet;
@@ -103,6 +110,11 @@ bool WalletImpl::create(const std::string &path, const std::string &password, co
return true;
}
+std::string WalletImpl::seed() const
+{
+ return "";
+}
+
///////////////////////// WalletManager implementation /////////////////////////
@@ -111,13 +123,16 @@ class WalletManagerImpl : public WalletManager
public:
Wallet * createWallet(const std::string &path, const std::string &password,
const std::string &language);
+ Wallet * openWallet(const std::string &path, const std::string &password);
+ bool walletExists(const std::string &path);
+ int lastError() const;
private:
WalletManagerImpl() {}
friend struct WalletManagerFactory;
};
-Wallet *WalletManager::createWallet(const std::string &path, const std::string &password,
+Wallet *WalletManagerImpl::createWallet(const std::string &path, const std::string &password,
const std::string &language)
{
WalletImpl * wallet = new WalletImpl();
@@ -131,6 +146,22 @@ Wallet *WalletManager::createWallet(const std::string &path, const std::string &
}
+Wallet *WalletManagerImpl::openWallet(const std::string &path, const std::string &password)
+{
+ return nullptr;
+}
+
+bool WalletManagerImpl::walletExists(const std::string &path)
+{
+ return false;
+}
+
+int WalletManagerImpl::lastError() const
+{
+ return 0;
+}
+
+
///////////////////// WalletManagerFactory implementation //////////////////////
WalletManager *WalletManagerFactory::getWalletManager()
{
@@ -142,4 +173,7 @@ WalletManager *WalletManagerFactory::getWalletManager()
}
+
+
+
}
diff --git a/src/wallet/wallet2_api.h b/src/wallet/wallet2_api.h
index b7e1f31a1..e1cd29de1 100644
--- a/src/wallet/wallet2_api.h
+++ b/src/wallet/wallet2_api.h
@@ -54,13 +54,13 @@ struct Wallet
struct WalletManager
{
//! creates new wallet
- Wallet * createWallet(const std::string &path, const std::string &password, const std::string &language);
+ virtual Wallet * createWallet(const std::string &path, const std::string &password, const std::string &language) = 0;
//! opens existing wallet
- Wallet * openWallet(const std::string &path, const std::string &password);
+ virtual Wallet * openWallet(const std::string &path, const std::string &password) = 0;
- bool walletExists(const std::string &path);
+ virtual bool walletExists(const std::string &path) = 0;
- int lastError() const;
+ virtual int lastError() const = 0;
};