mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-11-19 18:41:29 +00:00
Add parse_uri to libwalletqt
This commit is contained in:
parent
593839a374
commit
6034eaffc8
4 changed files with 26 additions and 0 deletions
|
@ -450,6 +450,23 @@ bool Wallet::verifySignedMessage(const QString &message, const QString &address,
|
||||||
return m_walletImpl->verifySignedMessage(message.toStdString(), address.toStdString(), signature.toStdString());
|
return m_walletImpl->verifySignedMessage(message.toStdString(), address.toStdString(), signature.toStdString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
bool Wallet::parse_uri(const QString &uri, QString &address, QString &payment_id, uint64_t &amount, QString &tx_description, QString &recipient_name, QVector<QString> &unknown_parameters, QString &error)
|
||||||
|
{
|
||||||
|
std::string s_address, s_payment_id, s_tx_description, s_recipient_name, s_error;
|
||||||
|
std::vector<std::string> s_unknown_parameters;
|
||||||
|
bool res= m_walletImpl->parse_uri(uri.toStdString(), s_address, s_payment_id, amount, s_tx_description, s_recipient_name, s_unknown_parameters, s_error);
|
||||||
|
if(res)
|
||||||
|
{
|
||||||
|
address = QString::fromStdString(s_address);
|
||||||
|
payment_id = QString::fromStdString(s_payment_id);
|
||||||
|
tx_description = QString::fromStdString(s_tx_description);
|
||||||
|
recipient_name = QString::fromStdString(s_recipient_name);
|
||||||
|
for( const auto &p : s_unknown_parameters )
|
||||||
|
unknown_parameters.append(QString::fromStdString(p));
|
||||||
|
}
|
||||||
|
error = QString::fromStdString(s_error);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
Wallet::Wallet(Monero::Wallet *w, QObject *parent)
|
Wallet::Wallet(Monero::Wallet *w, QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
|
|
|
@ -183,6 +183,8 @@ public:
|
||||||
//! verify a signed message
|
//! verify a signed message
|
||||||
Q_INVOKABLE bool verifySignedMessage(const QString &message, const QString &address, const QString &signature, bool filename = false) const;
|
Q_INVOKABLE bool verifySignedMessage(const QString &message, const QString &address, const QString &signature, bool filename = false) const;
|
||||||
|
|
||||||
|
//! Parse URI
|
||||||
|
Q_INVOKABLE bool parse_uri(const QString &uri, QString &address, QString &payment_id, uint64_t &amount, QString &tx_description, QString &recipient_name, QVector<QString> &unknown_parameters, QString &error);
|
||||||
|
|
||||||
//! saved payment id
|
//! saved payment id
|
||||||
QString paymentId() const;
|
QString paymentId() const;
|
||||||
|
|
|
@ -234,6 +234,12 @@ QString WalletManager::resolveOpenAlias(const QString &address) const
|
||||||
res = std::string(dnssec_valid ? "true" : "false") + "|" + res;
|
res = std::string(dnssec_valid ? "true" : "false") + "|" + res;
|
||||||
return QString::fromStdString(res);
|
return QString::fromStdString(res);
|
||||||
}
|
}
|
||||||
|
bool WalletManager::parse_uri(const QString &uri, QString &address, QString &payment_id, uint64_t &amount, QString &tx_description, QString &recipient_name, QVector<QString> &unknown_parameters, QString &error)
|
||||||
|
{
|
||||||
|
if (m_currentWallet)
|
||||||
|
return m_currentWallet->parse_uri(uri, address, payment_id, amount, tx_description, recipient_name, unknown_parameters, error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void WalletManager::setLogLevel(int logLevel)
|
void WalletManager::setLogLevel(int logLevel)
|
||||||
{
|
{
|
||||||
|
|
|
@ -117,6 +117,7 @@ public:
|
||||||
Q_INVOKABLE double getPasswordStrength(const QString &password) const;
|
Q_INVOKABLE double getPasswordStrength(const QString &password) const;
|
||||||
|
|
||||||
Q_INVOKABLE QString resolveOpenAlias(const QString &address) const;
|
Q_INVOKABLE QString resolveOpenAlias(const QString &address) const;
|
||||||
|
Q_INVOKABLE bool parse_uri(const QString &uri, QString &address, QString &payment_id, uint64_t &amount, QString &tx_description, QString &recipient_name, QVector<QString> &unknown_parameters, QString &error);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue