mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-23 12:09:57 +00:00
commit
fbd508781e
4 changed files with 47 additions and 9 deletions
24
main.qml
24
main.qml
|
@ -764,7 +764,11 @@ ApplicationWindow {
|
||||||
", address: ", address,
|
", address: ", address,
|
||||||
", message: ", message);
|
", message: ", message);
|
||||||
|
|
||||||
var result = currentWallet.getTxProof(txid, address, message);
|
var result;
|
||||||
|
if (address.length > 0)
|
||||||
|
result = currentWallet.getTxProof(txid, address, message);
|
||||||
|
if (!result || result.startsWith("error|"))
|
||||||
|
result = currentWallet.getSpendProof(txid, message);
|
||||||
informationPopup.title = qsTr("Payment proof") + translationManager.emptyString;
|
informationPopup.title = qsTr("Payment proof") + translationManager.emptyString;
|
||||||
if (result.startsWith("error|")) {
|
if (result.startsWith("error|")) {
|
||||||
var errorString = result.split("|")[1];
|
var errorString = result.split("|")[1];
|
||||||
|
@ -786,12 +790,16 @@ ApplicationWindow {
|
||||||
", message: ", message,
|
", message: ", message,
|
||||||
", signature: ", signature);
|
", signature: ", signature);
|
||||||
|
|
||||||
var result = currentWallet.checkTxProof(txid, address, message, signature);
|
var result;
|
||||||
|
if (address.length > 0)
|
||||||
|
result = currentWallet.checkTxProof(txid, address, message, signature);
|
||||||
|
else
|
||||||
|
result = currentWallet.checkSpendProof(txid, message, signature);
|
||||||
var results = result.split("|");
|
var results = result.split("|");
|
||||||
if (results.length == 5 && results[0] == "true") {
|
if (address.length > 0 && results.length == 5 && results[0] === "true") {
|
||||||
var good = results[1] == "true";
|
var good = results[1] === "true";
|
||||||
var received = results[2];
|
var received = results[2];
|
||||||
var in_pool = results[3] == "true";
|
var in_pool = results[3] === "true";
|
||||||
var confirmations = results[4];
|
var confirmations = results[4];
|
||||||
|
|
||||||
informationPopup.title = qsTr("Payment proof check") + translationManager.emptyString;
|
informationPopup.title = qsTr("Payment proof check") + translationManager.emptyString;
|
||||||
|
@ -812,6 +820,12 @@ ApplicationWindow {
|
||||||
informationPopup.text = qsTr("This address received nothing");
|
informationPopup.text = qsTr("This address received nothing");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (results.length == 2 && results[0] === "true") {
|
||||||
|
var good = results[1] === "true";
|
||||||
|
informationPopup.title = qsTr("Payment proof check") + translationManager.emptyString;
|
||||||
|
informationPopup.icon = good ? StandardIcon.Information : StandardIcon.Critical;
|
||||||
|
informationPopup.text = good ? qsTr("Good signature") : qsTr("Bad signature");
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
informationPopup.title = qsTr("Error") + translationManager.emptyString;
|
informationPopup.title = qsTr("Error") + translationManager.emptyString;
|
||||||
informationPopup.text = currentWallet.errorString;
|
informationPopup.text = currentWallet.errorString;
|
||||||
|
|
|
@ -72,6 +72,10 @@ Rectangle {
|
||||||
if ((signature.length - 9) % 132 != 0)
|
if ((signature.length - 9) % 132 != 0)
|
||||||
return false;
|
return false;
|
||||||
return check256(signature, signature.length);
|
return check256(signature, signature.length);
|
||||||
|
} else if (signature.startsWith("SpendProofV")) {
|
||||||
|
if ((signature.length - 12) % 88 != 0)
|
||||||
|
return false;
|
||||||
|
return check256(signature, signature.length);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -90,7 +94,8 @@ Rectangle {
|
||||||
property int lineEditFontSize: 12
|
property int lineEditFontSize: 12
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: qsTr("Generate a proof of your incoming/outgoing payment by supplying the transaction ID, the recipient address and an optional message:") + translationManager.emptyString
|
text: qsTr("Generate a proof of your incoming/outgoing payment by supplying the transaction ID, the recipient address and an optional message. \n" +
|
||||||
|
"For the case of outgoing payments, you can get a 'Spend Proof' that proves the authorship of a transaction. In this case, you don't need to specify the recipient address.") + translationManager.emptyString
|
||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
Layout.fillWidth: true;
|
Layout.fillWidth: true;
|
||||||
}
|
}
|
||||||
|
@ -183,7 +188,7 @@ Rectangle {
|
||||||
shadowPressedColor: "#B32D00"
|
shadowPressedColor: "#B32D00"
|
||||||
releasedColor: "#FF6C3C"
|
releasedColor: "#FF6C3C"
|
||||||
pressedColor: "#FF4304"
|
pressedColor: "#FF4304"
|
||||||
enabled: checkTxID(getProofTxIdLine.text) && checkAddress(getProofAddressLine.text, appWindow.persistentSettings.testnet)
|
enabled: checkTxID(getProofTxIdLine.text) && (getProofAddressLine.text.length == 0 || checkAddress(getProofAddressLine.text, appWindow.persistentSettings.testnet))
|
||||||
onClicked: {
|
onClicked: {
|
||||||
console.log("getProof: Generate clicked: txid " + getProofTxIdLine.text + ", address " + getProofAddressLine.text + ", message: " + getProofMessageLine.text);
|
console.log("getProof: Generate clicked: txid " + getProofTxIdLine.text + ", address " + getProofAddressLine.text + ", message: " + getProofMessageLine.text);
|
||||||
root.getProofClicked(getProofTxIdLine.text, getProofAddressLine.text, getProofMessageLine.text)
|
root.getProofClicked(getProofTxIdLine.text, getProofAddressLine.text, getProofMessageLine.text)
|
||||||
|
@ -201,7 +206,8 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: qsTr("Verify that funds were paid to an address by supplying the transaction ID, the recipient address, the message used for signing and the signature:") + translationManager.emptyString
|
text: qsTr("Verify that funds were paid to an address by supplying the transaction ID, the recipient address, the message used for signing and the signature.\n" +
|
||||||
|
"For the case with Spend Proof, you don't need to specify the recipient address.") + translationManager.emptyString
|
||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
Layout.fillWidth: true;
|
Layout.fillWidth: true;
|
||||||
}
|
}
|
||||||
|
@ -322,7 +328,7 @@ Rectangle {
|
||||||
shadowPressedColor: "#B32D00"
|
shadowPressedColor: "#B32D00"
|
||||||
releasedColor: "#FF6C3C"
|
releasedColor: "#FF6C3C"
|
||||||
pressedColor: "#FF4304"
|
pressedColor: "#FF4304"
|
||||||
enabled: checkTxID(checkProofTxIdLine.text) && checkAddress(checkProofAddressLine.text, appWindow.persistentSettings.testnet) && checkSignature(checkProofSignatureLine.text)
|
enabled: checkTxID(checkProofTxIdLine.text) && checkSignature(checkProofSignatureLine.text) && ((checkProofSignatureLine.text.startsWith("SpendProofV") && checkProofAddressLine.text.length == 0) || (!checkProofSignatureLine.text.startsWith("SpendProofV") && checkAddress(checkProofAddressLine.text, appWindow.persistentSettings.testnet)))
|
||||||
onClicked: {
|
onClicked: {
|
||||||
console.log("checkProof: Check clicked: txid " + checkProofTxIdLine.text + ", address " + checkProofAddressLine.text + ", message " + checkProofMessageLine.text + ", signature " + checkProofSignatureLine.text);
|
console.log("checkProof: Check clicked: txid " + checkProofTxIdLine.text + ", address " + checkProofAddressLine.text + ", message " + checkProofMessageLine.text + ", signature " + checkProofSignatureLine.text);
|
||||||
root.checkProofClicked(checkProofTxIdLine.text, checkProofAddressLine.text, checkProofMessageLine.text, checkProofSignatureLine.text)
|
root.checkProofClicked(checkProofTxIdLine.text, checkProofAddressLine.text, checkProofMessageLine.text, checkProofSignatureLine.text)
|
||||||
|
|
|
@ -523,6 +523,22 @@ QString Wallet::checkTxProof(const QString &txid, const QString &address, const
|
||||||
return QString::fromStdString(result);
|
return QString::fromStdString(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Q_INVOKABLE QString Wallet::getSpendProof(const QString &txid, const QString &message) const
|
||||||
|
{
|
||||||
|
std::string result = m_walletImpl->getSpendProof(txid.toStdString(), message.toStdString());
|
||||||
|
if (result.empty())
|
||||||
|
result = "error|" + m_walletImpl->errorString();
|
||||||
|
return QString::fromStdString(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_INVOKABLE QString Wallet::checkSpendProof(const QString &txid, const QString &message, const QString &signature) const
|
||||||
|
{
|
||||||
|
bool good;
|
||||||
|
bool success = m_walletImpl->checkSpendProof(txid.toStdString(), message.toStdString(), signature.toStdString(), good);
|
||||||
|
std::string result = std::string(success ? "true" : "false") + "|" + std::string(!success ? m_walletImpl->errorString() : good ? "true" : "false");
|
||||||
|
return QString::fromStdString(result);
|
||||||
|
}
|
||||||
|
|
||||||
QString Wallet::signMessage(const QString &message, bool filename) const
|
QString Wallet::signMessage(const QString &message, bool filename) const
|
||||||
{
|
{
|
||||||
if (filename) {
|
if (filename) {
|
||||||
|
|
|
@ -235,6 +235,8 @@ public:
|
||||||
Q_INVOKABLE QString checkTxKey(const QString &txid, const QString &tx_key, const QString &address);
|
Q_INVOKABLE QString checkTxKey(const QString &txid, const QString &tx_key, const QString &address);
|
||||||
Q_INVOKABLE QString getTxProof(const QString &txid, const QString &address, const QString &message) const;
|
Q_INVOKABLE QString getTxProof(const QString &txid, const QString &address, const QString &message) const;
|
||||||
Q_INVOKABLE QString checkTxProof(const QString &txid, const QString &address, const QString &message, const QString &signature);
|
Q_INVOKABLE QString checkTxProof(const QString &txid, const QString &address, const QString &message, const QString &signature);
|
||||||
|
Q_INVOKABLE QString getSpendProof(const QString &txid, const QString &message) const;
|
||||||
|
Q_INVOKABLE QString checkSpendProof(const QString &txid, const QString &message, const QString &signature) const;
|
||||||
// Rescan spent outputs
|
// Rescan spent outputs
|
||||||
Q_INVOKABLE bool rescanSpent();
|
Q_INVOKABLE bool rescanSpent();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue