add makeUri() and parseUriToObject()

pull/264/head
larteyoh 1 month ago
parent 2f13081125
commit 0fa3b190ed

@ -112,6 +112,29 @@ bool neroshop::WalletController::verifyMessage(const QString& message, const QSt
return _wallet->verify_message(message.toStdString(), signature.toStdString());
}
QString neroshop::WalletController::makeUri(const QString& address, double tx_amount, const QString& tx_description, const QString& recipient_name) const {
if(!_wallet) throw std::runtime_error("neroshop::Wallet is not initialized");
return QString::fromStdString(_wallet->make_uri(address.toStdString(), tx_amount, tx_description.toStdString(), recipient_name.toStdString()));
}
QVariantMap neroshop::WalletController::parseUriToObject(const QString& uri) const {
if(!_wallet) throw std::runtime_error("neroshop::Wallet is not initialized");
QVariantMap uri_object;
std::string address;
double tx_amount;
std::string tx_description;
std::string recipient_name;
Wallet::parse_uri(uri.toStdString(), address, tx_amount, tx_description, recipient_name);
uri_object.insert("address", QString::fromStdString(address));
uri_object.insert("tx_amount", tx_amount);
uri_object.insert("tx_description", QString::fromStdString(tx_description));
uri_object.insert("recipient_name", QString::fromStdString(recipient_name));
return uri_object;
}
int neroshop::WalletController::getWalletType() const {
if (!_wallet)
throw std::runtime_error("neroshop::Wallet is not initialized");

@ -37,6 +37,8 @@ public:
Q_INVOKABLE void transfer(const QString& address, double amount);
Q_INVOKABLE QString signMessage(const QString& message) const;
Q_INVOKABLE bool verifyMessage(const QString& message, const QString& signature) const;
Q_INVOKABLE QString makeUri(const QString& address, double tx_amount, const QString& tx_description, const QString& recipient_name) const;
Q_INVOKABLE QVariantMap parseUriToObject(const QString& uri) const;
Q_INVOKABLE double getSyncPercentage() const;
Q_INVOKABLE unsigned int getSyncHeight() const;

Loading…
Cancel
Save