| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
#include "wallet/api/wallet2_api.h" |
| 33 |
#include "net/http.h" |
| 34 |
#include <string> |
| 35 |
|
| 36 |
namespace Monero { |
| 37 |
|
| 38 |
class WalletManagerImpl : public WalletManager |
| 39 |
{ |
| 40 |
public: |
| 41 |
Wallet * createWallet(const std::string &path, const std::string &password, |
| 42 |
const std::string &language, NetworkType nettype, uint64_t kdf_rounds = 1) override; |
| 43 |
Wallet * openWallet(const std::string &path, const std::string &password, NetworkType nettype, uint64_t kdf_rounds = 1, WalletListener * listener = nullptr) override; |
| 44 |
virtual Wallet * recoveryWallet(const std::string &path, |
| 45 |
const std::string &password, |
| 46 |
const std::string &mnemonic, |
| 47 |
NetworkType nettype, |
| 48 |
uint64_t restoreHeight, |
| 49 |
uint64_t kdf_rounds = 1, |
| 50 |
const std::string &seed_offset = {}) override; |
| 51 |
virtual Wallet * createWalletFromKeys(const std::string &path, |
| 52 |
const std::string &password, |
| 53 |
const std::string &language, |
| 54 |
NetworkType nettype, |
| 55 |
uint64_t restoreHeight, |
| 56 |
const std::string &addressString, |
| 57 |
const std::string &viewKeyString, |
| 58 |
const std::string &spendKeyString = "", |
| 59 |
uint64_t kdf_rounds = 1) override; |
| 60 |
|
| 61 |
virtual Wallet * recoveryWallet(const std::string &path, const std::string &mnemonic, NetworkType nettype, uint64_t restoreHeight) override; |
| 62 |
|
| 63 |
virtual Wallet * createWalletFromKeys(const std::string &path, |
| 64 |
const std::string &language, |
| 65 |
NetworkType nettype, |
| 66 |
uint64_t restoreHeight, |
| 67 |
const std::string &addressString, |
| 68 |
const std::string &viewKeyString, |
| 69 |
const std::string &spendKeyString = "") override; |
| 70 |
virtual Wallet * createWalletFromDevice(const std::string &path, |
| 71 |
const std::string &password, |
| 72 |
NetworkType nettype, |
| 73 |
const std::string &deviceName, |
| 74 |
uint64_t restoreHeight = 0, |
| 75 |
const std::string &subaddressLookahead = "", |
| 76 |
uint64_t kdf_rounds = 1, |
| 77 |
WalletListener * listener = nullptr) override; |
| 78 |
virtual bool closeWallet(Wallet *wallet, bool store = true) override; |
| 79 |
bool walletExists(const std::string &path) override; |
| 80 |
bool verifyWalletPassword(const std::string &keys_file_name, const std::string &password, bool no_spend_key, uint64_t kdf_rounds = 1) const override; |
| 81 |
bool queryWalletDevice(Wallet::Device& device_type, const std::string &keys_file_name, const std::string &password, uint64_t kdf_rounds = 1) const override; |
| 82 |
std::vector<std::string> findWallets(const std::string &path) override; |
| 83 |
std::string errorString() const override; |
| 84 |
void setDaemonAddress(const std::string &address) override; |
| 85 |
bool connected(uint32_t *version = NULL) override; |
| 86 |
uint64_t blockchainHeight() override; |
| 87 |
uint64_t blockchainTargetHeight() override; |
| 88 |
uint64_t networkDifficulty() override; |
| 89 |
double miningHashRate() override; |
| 90 |
uint64_t blockTarget() override; |
| 91 |
bool isMining() override; |
| 92 |
bool startMining(const std::string &address, uint32_t threads = 1, bool background_mining = false, bool ignore_battery = true) override; |
| 93 |
bool stopMining() override; |
| 94 |
std::string resolveOpenAlias(const std::string &address, bool &dnssec_valid) const override; |
| 95 |
bool setProxy(const std::string &address) override; |
| 96 |
|
| 97 |
private: |
| 98 |
WalletManagerImpl(); |
| 99 |
friend struct WalletManagerFactory; |
| 100 |
net::http::client m_http_client; |
| 101 |
std::string m_errorString; |
| 102 |
}; |
| 103 |
|
| 104 |
} |