mirror of
https://github.com/feather-wallet/feather.git
synced 2025-03-12 09:37:47 +00:00
libwalletqt: more WalletManager cleanup
This commit is contained in:
parent
e84d75b0f0
commit
1e6f821a2f
2 changed files with 34 additions and 50 deletions
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include "utils/ScopeGuard.h"
|
||||
|
||||
class WalletPassphraseListenerImpl : public Monero::WalletListener, public PassphraseReceiver
|
||||
class WalletPassphraseListenerImpl : public Monero::WalletListener, public PassphraseReceiver
|
||||
{
|
||||
public:
|
||||
explicit WalletPassphraseListenerImpl(WalletManager * mgr): m_mgr(mgr), m_phelper(mgr) {}
|
||||
|
|
|
@ -4,13 +4,12 @@
|
|||
#ifndef WALLETMANAGER_H
|
||||
#define WALLETMANAGER_H
|
||||
|
||||
#include <QVariant>
|
||||
#include <QObject>
|
||||
#include <QUrl>
|
||||
#include <wallet/api/wallet2_api.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QMutex>
|
||||
#include <QPointer>
|
||||
#include <QWaitCondition>
|
||||
|
||||
#include "utils/scheduler.h"
|
||||
#include "utils/networktype.h"
|
||||
#include "PassphraseHelper.h"
|
||||
|
@ -25,21 +24,9 @@ class WalletManager : public QObject, public PassprasePrompter
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum LogLevel {
|
||||
LogLevel_Silent = Monero::WalletManagerFactory::LogLevel_Silent,
|
||||
LogLevel_0 = Monero::WalletManagerFactory::LogLevel_0,
|
||||
LogLevel_1 = Monero::WalletManagerFactory::LogLevel_1,
|
||||
LogLevel_2 = Monero::WalletManagerFactory::LogLevel_2,
|
||||
LogLevel_3 = Monero::WalletManagerFactory::LogLevel_3,
|
||||
LogLevel_4 = Monero::WalletManagerFactory::LogLevel_4,
|
||||
LogLevel_Min = Monero::WalletManagerFactory::LogLevel_Min,
|
||||
LogLevel_Max = Monero::WalletManagerFactory::LogLevel_Max,
|
||||
};
|
||||
static WalletManager *instance();
|
||||
|
||||
static WalletManager * instance();
|
||||
// wizard: createWallet path;
|
||||
Wallet * createWallet(const QString &path, const QString &password,
|
||||
const QString &language, NetworkType::Type nettype = NetworkType::MAINNET, quint64 kdfRounds = 1);
|
||||
Wallet * createWallet(const QString &path, const QString &password, const QString &language, NetworkType::Type nettype = NetworkType::MAINNET, quint64 kdfRounds = 1);
|
||||
|
||||
/*!
|
||||
* \brief openWallet - opens wallet by given path
|
||||
|
@ -56,43 +43,41 @@ public:
|
|||
*/
|
||||
void openWalletAsync(const QString &path, const QString &password, NetworkType::Type nettype = NetworkType::MAINNET, quint64 kdfRounds = 1);
|
||||
|
||||
// wizard: recoveryWallet path; hint: internally it recorvers wallet and set password = ""
|
||||
Wallet * recoveryWallet(const QString &path, const QString &password, const QString &seed, const QString &seed_offset,
|
||||
NetworkType::Type nettype = NetworkType::MAINNET, quint64 restoreHeight = 0, quint64 kdfRounds = 1);
|
||||
NetworkType::Type nettype = NetworkType::MAINNET, quint64 restoreHeight = 0, quint64 kdfRounds = 1);
|
||||
|
||||
Wallet * createWalletFromKeys(const QString &path,
|
||||
const QString &password,
|
||||
const QString &language,
|
||||
NetworkType::Type nettype,
|
||||
const QString &address,
|
||||
const QString &viewkey,
|
||||
const QString &spendkey = "",
|
||||
quint64 restoreHeight = 0,
|
||||
quint64 kdfRounds = 1);
|
||||
const QString &password,
|
||||
const QString &language,
|
||||
NetworkType::Type nettype,
|
||||
const QString &address,
|
||||
const QString &viewkey,
|
||||
const QString &spendkey = "",
|
||||
quint64 restoreHeight = 0,
|
||||
quint64 kdfRounds = 1);
|
||||
|
||||
Wallet * createDeterministicWalletFromSpendKey(const QString &path,
|
||||
const QString &password,
|
||||
const QString &language,
|
||||
NetworkType::Type nettype,
|
||||
const QString &spendkey,
|
||||
quint64 restoreHeight,
|
||||
quint64 kdfRounds,
|
||||
const QString &offset_passphrase = "");
|
||||
const QString &password,
|
||||
const QString &language,
|
||||
NetworkType::Type nettype,
|
||||
const QString &spendkey,
|
||||
quint64 restoreHeight,
|
||||
quint64 kdfRounds,
|
||||
const QString &offset_passphrase = "");
|
||||
|
||||
Wallet * createWalletFromDevice(const QString &path,
|
||||
const QString &password,
|
||||
NetworkType::Type nettype,
|
||||
const QString &deviceName,
|
||||
quint64 restoreHeight = 0,
|
||||
const QString &subaddressLookahead = "");
|
||||
const QString &password,
|
||||
NetworkType::Type nettype,
|
||||
const QString &deviceName,
|
||||
quint64 restoreHeight = 0,
|
||||
const QString &subaddressLookahead = "");
|
||||
|
||||
void createWalletFromDeviceAsync(const QString &path,
|
||||
const QString &password,
|
||||
NetworkType::Type nettype,
|
||||
const QString &deviceName,
|
||||
quint64 restoreHeight = 0,
|
||||
const QString &subaddressLookahead = "");
|
||||
|
||||
const QString &password,
|
||||
NetworkType::Type nettype,
|
||||
const QString &deviceName,
|
||||
quint64 restoreHeight = 0,
|
||||
const QString &subaddressLookahead = "");
|
||||
|
||||
//! checks is given filename is a wallet;
|
||||
bool walletExists(const QString &path) const;
|
||||
|
@ -103,7 +88,6 @@ public:
|
|||
//! returns list with wallet's filenames, if found by given path
|
||||
QStringList findWallets(const QString &path);
|
||||
|
||||
//! since we can't call static method from QML, move it to this class
|
||||
static QString displayAmount(quint64 amount, bool trailing_zeroes = true, int decimals = 12);
|
||||
static quint64 amountFromString(const QString &amount);
|
||||
static quint64 amountFromDouble(double amount);
|
||||
|
@ -130,8 +114,8 @@ public:
|
|||
virtual void onWalletPassphraseNeeded(bool on_device) override;
|
||||
|
||||
signals:
|
||||
void walletOpened(Wallet * wallet);
|
||||
void walletCreated(Wallet * wallet);
|
||||
void walletOpened(Wallet *wallet);
|
||||
void walletCreated(Wallet *wallet);
|
||||
void walletPassphraseNeeded(bool onDevice);
|
||||
void deviceButtonRequest(quint64 buttonCode);
|
||||
void deviceButtonPressed();
|
||||
|
|
Loading…
Reference in a new issue