mirror of
https://github.com/monero-project/monero-gui
synced 2025-01-07 18:56:24 +01:00
WalletManager: restore from keys
This commit is contained in:
parent
bded77a22b
commit
b3232dc26f
@ -86,6 +86,22 @@ Wallet *WalletManager::recoveryWallet(const QString &path, const QString &memo,
|
|||||||
return m_currentWallet;
|
return m_currentWallet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Wallet *WalletManager::createWalletFromKeys(const QString &path, const QString &language, bool testnet,
|
||||||
|
const QString &address, const QString &viewkey, const QString &spendkey,
|
||||||
|
quint64 restoreHeight)
|
||||||
|
{
|
||||||
|
QMutexLocker locker(&m_mutex);
|
||||||
|
if (m_currentWallet) {
|
||||||
|
qDebug() << "Closing open m_currentWallet" << m_currentWallet;
|
||||||
|
delete m_currentWallet;
|
||||||
|
m_currentWallet = NULL;
|
||||||
|
}
|
||||||
|
Monero::Wallet * w = m_pimpl->createWalletFromKeys(path.toStdString(), language.toStdString(), testnet, restoreHeight,
|
||||||
|
address.toStdString(), viewkey.toStdString(), spendkey.toStdString());
|
||||||
|
m_currentWallet = new Wallet(w);
|
||||||
|
return m_currentWallet;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QString WalletManager::closeWallet()
|
QString WalletManager::closeWallet()
|
||||||
{
|
{
|
||||||
@ -183,6 +199,16 @@ bool WalletManager::addressValid(const QString &address, bool testnet) const
|
|||||||
return Monero::Wallet::addressValid(address.toStdString(), testnet);
|
return Monero::Wallet::addressValid(address.toStdString(), testnet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool WalletManager::keyValid(const QString &key, const QString &address, bool isViewKey, bool testnet) const
|
||||||
|
{
|
||||||
|
std::string error;
|
||||||
|
if(!Monero::Wallet::keyValid(key.toStdString(), address.toStdString(), isViewKey, testnet, error)){
|
||||||
|
qDebug() << QString::fromStdString(error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
QString WalletManager::paymentIdFromAddress(const QString &address, bool testnet) const
|
QString WalletManager::paymentIdFromAddress(const QString &address, bool testnet) const
|
||||||
{
|
{
|
||||||
return QString::fromStdString(Monero::Wallet::paymentIdFromAddress(address.toStdString(), testnet));
|
return QString::fromStdString(Monero::Wallet::paymentIdFromAddress(address.toStdString(), testnet));
|
||||||
|
@ -53,6 +53,14 @@ public:
|
|||||||
Q_INVOKABLE Wallet * recoveryWallet(const QString &path, const QString &memo,
|
Q_INVOKABLE Wallet * recoveryWallet(const QString &path, const QString &memo,
|
||||||
bool testnet = false, quint64 restoreHeight = 0);
|
bool testnet = false, quint64 restoreHeight = 0);
|
||||||
|
|
||||||
|
Q_INVOKABLE Wallet * createWalletFromKeys(const QString &path,
|
||||||
|
const QString &language,
|
||||||
|
bool testnet,
|
||||||
|
const QString &address,
|
||||||
|
const QString &viewkey,
|
||||||
|
const QString &spendkey = "",
|
||||||
|
quint64 restoreHeight = 0);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief closeWallet - closes current open wallet and frees memory
|
* \brief closeWallet - closes current open wallet and frees memory
|
||||||
* \return wallet address
|
* \return wallet address
|
||||||
@ -92,6 +100,8 @@ public:
|
|||||||
|
|
||||||
Q_INVOKABLE bool paymentIdValid(const QString &payment_id) const;
|
Q_INVOKABLE bool paymentIdValid(const QString &payment_id) const;
|
||||||
Q_INVOKABLE bool addressValid(const QString &address, bool testnet) const;
|
Q_INVOKABLE bool addressValid(const QString &address, bool testnet) const;
|
||||||
|
Q_INVOKABLE bool keyValid(const QString &key, const QString &address, bool isViewKey, bool testnet) const;
|
||||||
|
|
||||||
Q_INVOKABLE QString paymentIdFromAddress(const QString &address, bool testnet) const;
|
Q_INVOKABLE QString paymentIdFromAddress(const QString &address, bool testnet) const;
|
||||||
|
|
||||||
Q_INVOKABLE QString checkPayment(const QString &address, const QString &txid, const QString &txkey, const QString &daemon_address) const;
|
Q_INVOKABLE QString checkPayment(const QString &address, const QString &txid, const QString &txkey, const QString &daemon_address) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user