mirror of
https://github.com/monero-project/monero-gui.git
synced 2026-04-09 13:07:27 -04:00
Tx proof
This commit is contained in:
293
pages/TxKey.qml
293
pages/TxKey.qml
@@ -37,9 +37,6 @@ import moneroComponents.Clipboard 1.0
|
||||
Rectangle {
|
||||
|
||||
color: "#F0EEEE"
|
||||
property alias addressText : addressLine.text
|
||||
property alias txIdText : txIdLine.text
|
||||
property alias txKeyText : txKeyLine.text
|
||||
|
||||
Clipboard { id: clipboard }
|
||||
|
||||
@@ -47,10 +44,10 @@ Rectangle {
|
||||
return walletManager.addressValid(address, testnet)
|
||||
}
|
||||
|
||||
function check256(str) {
|
||||
if (str.length != 64)
|
||||
function check256(str, length) {
|
||||
if (str.length != length)
|
||||
return false;
|
||||
for (var i = 0; i < 64; ++i) {
|
||||
for (var i = 0; i < length; ++i) {
|
||||
if (str[i] >= '0' && str[i] <= '9')
|
||||
continue;
|
||||
if (str[i] >= 'a' && str[i] <= 'z')
|
||||
@@ -63,11 +60,12 @@ Rectangle {
|
||||
}
|
||||
|
||||
function checkTxID(txid) {
|
||||
return check256(txid)
|
||||
return check256(txid, 64)
|
||||
}
|
||||
|
||||
function checkTxKey(txid) {
|
||||
return check256(txid)
|
||||
function checkSignature(signature) {
|
||||
return signature.startsWith("OutProofV") && check256(signature, 142) ||
|
||||
signature.startsWith("InProofV") && check256(signature, 141)
|
||||
}
|
||||
|
||||
/* main layout */
|
||||
@@ -83,93 +81,32 @@ Rectangle {
|
||||
property int editWidth: 400
|
||||
property int lineEditFontSize: 12
|
||||
|
||||
RowLayout {
|
||||
ColumnLayout {
|
||||
|
||||
Text {
|
||||
text: qsTr("Verify that a third party made a payment by supplying:") + translationManager.emptyString
|
||||
wrapMode: Text.Wrap
|
||||
Layout.fillWidth: true;
|
||||
}
|
||||
Text {
|
||||
text: qsTr(" - the recipient address") + translationManager.emptyString
|
||||
wrapMode: Text.Wrap
|
||||
Layout.fillWidth: true;
|
||||
}
|
||||
Text {
|
||||
text: qsTr(" - the transaction ID") + translationManager.emptyString
|
||||
wrapMode: Text.Wrap
|
||||
Layout.fillWidth: true;
|
||||
}
|
||||
Text {
|
||||
text: qsTr(" - the secret transaction key supplied by the sender") + translationManager.emptyString
|
||||
wrapMode: Text.Wrap
|
||||
Layout.fillWidth: true;
|
||||
}
|
||||
Text {
|
||||
text: qsTr("If a payment had several transactions then each must be checked and the results combined.") + translationManager.emptyString
|
||||
wrapMode: Text.Wrap
|
||||
Layout.fillWidth: true;
|
||||
}
|
||||
}
|
||||
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
|
||||
wrapMode: Text.Wrap
|
||||
Layout.fillWidth: true;
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: addressRow
|
||||
|
||||
Label {
|
||||
id: addressLabel
|
||||
fontSize: 14
|
||||
text: qsTr("Address") + translationManager.emptyString
|
||||
width: mainLayout.labelWidth
|
||||
}
|
||||
|
||||
LineEdit {
|
||||
id: addressLine
|
||||
fontSize: mainLayout.lineEditFontSize
|
||||
placeholderText: qsTr("Recipient's wallet address") + translationManager.emptyString;
|
||||
readOnly: false
|
||||
width: mainLayout.editWidth
|
||||
Layout.fillWidth: true
|
||||
onTextChanged: cursorPosition = 0
|
||||
|
||||
IconButton {
|
||||
imageSource: "../images/copyToClipboard.png"
|
||||
onClicked: {
|
||||
if (addressLine.text.length > 0) {
|
||||
clipboard.setText(addressLine.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: txIdRow
|
||||
Label {
|
||||
id: txIdLabel
|
||||
fontSize: 14
|
||||
text: qsTr("Transaction ID") + translationManager.emptyString
|
||||
width: mainLayout.labelWidth
|
||||
}
|
||||
|
||||
|
||||
LineEdit {
|
||||
|
||||
id: txIdLine
|
||||
id: getProofTxIdLine
|
||||
fontSize: mainLayout.lineEditFontSize
|
||||
placeholderText: qsTr("Paste tx ID") + translationManager.emptyString
|
||||
readOnly: false
|
||||
width: mainLayout.editWidth
|
||||
Layout.fillWidth: true
|
||||
|
||||
onTextChanged: cursorPosition = 0
|
||||
|
||||
IconButton {
|
||||
imageSource: "../images/copyToClipboard.png"
|
||||
onClicked: {
|
||||
if (txIdLine.text.length > 0) {
|
||||
clipboard.setText(txIdLine.text)
|
||||
if (getProofTxIdLine.text.length > 0) {
|
||||
clipboard.setText(getProofTxIdLine.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -178,29 +115,190 @@ Rectangle {
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: txKeyRow
|
||||
Label {
|
||||
id: paymentIdLabel
|
||||
fontSize: 14
|
||||
text: qsTr("Transaction key") + translationManager.emptyString
|
||||
text: qsTr("Address") + translationManager.emptyString
|
||||
width: mainLayout.labelWidth
|
||||
}
|
||||
|
||||
|
||||
LineEdit {
|
||||
id: txKeyLine
|
||||
id: getProofAddressLine
|
||||
fontSize: mainLayout.lineEditFontSize
|
||||
placeholderText: qsTr("Paste tx key") + translationManager.emptyString;
|
||||
placeholderText: qsTr("Recipient's wallet address") + translationManager.emptyString;
|
||||
readOnly: false
|
||||
|
||||
width: mainLayout.editWidth
|
||||
Layout.fillWidth: true
|
||||
|
||||
IconButton {
|
||||
imageSource: "../images/copyToClipboard.png"
|
||||
onClicked: {
|
||||
if (TxKeyLine.text.length > 0) {
|
||||
clipboard.setText(TxKeyLine.text)
|
||||
if (getProofAddressLine.text.length > 0) {
|
||||
clipboard.setText(getProofAddressLine.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Label {
|
||||
fontSize: 14
|
||||
text: qsTr("Message") + translationManager.emptyString
|
||||
width: mainLayout.labelWidth
|
||||
}
|
||||
|
||||
LineEdit {
|
||||
id: getProofMessageLine
|
||||
fontSize: mainLayout.lineEditFontSize
|
||||
placeholderText: qsTr("Optional message against which the signature is signed") + translationManager.emptyString;
|
||||
readOnly: false
|
||||
width: mainLayout.editWidth
|
||||
Layout.fillWidth: true
|
||||
|
||||
IconButton {
|
||||
imageSource: "../images/copyToClipboard.png"
|
||||
onClicked: {
|
||||
if (getProofMessageLine.text.length > 0) {
|
||||
clipboard.setText(getProofMessageLine.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StandardButton {
|
||||
anchors.left: parent.left
|
||||
anchors.topMargin: 17
|
||||
width: 60
|
||||
text: qsTr("Generate") + translationManager.emptyString
|
||||
shadowReleasedColor: "#FF4304"
|
||||
shadowPressedColor: "#B32D00"
|
||||
releasedColor: "#FF6C3C"
|
||||
pressedColor: "#FF4304"
|
||||
enabled: checkTxID(getProofTxIdLine.text) && checkAddress(getProofAddressLine.text, appWindow.persistentSettings.testnet)
|
||||
onClicked: {
|
||||
console.log("getProof: Generate clicked: txid " + getProofTxIdLine.text + ", address " + getProofAddressLine.text + ", message: " + getProofMessageLine.text);
|
||||
root.getProofClicked(getProofTxIdLine.text, getProofAddressLine.text, getProofMessageLine.text)
|
||||
}
|
||||
}
|
||||
|
||||
// underline
|
||||
Rectangle {
|
||||
height: 1
|
||||
color: "#DBDBDB"
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
anchors.bottomMargin: 3
|
||||
|
||||
}
|
||||
|
||||
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
|
||||
wrapMode: Text.Wrap
|
||||
Layout.fillWidth: true;
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Label {
|
||||
fontSize: 14
|
||||
text: qsTr("Transaction ID") + translationManager.emptyString
|
||||
width: mainLayout.labelWidth
|
||||
}
|
||||
|
||||
LineEdit {
|
||||
id: checkProofTxIdLine
|
||||
fontSize: mainLayout.lineEditFontSize
|
||||
placeholderText: qsTr("Paste tx ID") + translationManager.emptyString
|
||||
readOnly: false
|
||||
width: mainLayout.editWidth
|
||||
Layout.fillWidth: true
|
||||
|
||||
IconButton {
|
||||
imageSource: "../images/copyToClipboard.png"
|
||||
onClicked: {
|
||||
if (checkProofTxIdLine.text.length > 0) {
|
||||
clipboard.setText(checkProofTxIdLine.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Label {
|
||||
fontSize: 14
|
||||
text: qsTr("Address") + translationManager.emptyString
|
||||
width: mainLayout.labelWidth
|
||||
}
|
||||
|
||||
LineEdit {
|
||||
id: checkProofAddressLine
|
||||
fontSize: mainLayout.lineEditFontSize
|
||||
placeholderText: qsTr("Recipient's wallet address") + translationManager.emptyString;
|
||||
readOnly: false
|
||||
width: mainLayout.editWidth
|
||||
Layout.fillWidth: true
|
||||
|
||||
IconButton {
|
||||
imageSource: "../images/copyToClipboard.png"
|
||||
onClicked: {
|
||||
if (checkProofAddressLine.text.length > 0) {
|
||||
clipboard.setText(checkProofAddressLine.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Label {
|
||||
fontSize: 14
|
||||
text: qsTr("Message") + translationManager.emptyString
|
||||
width: mainLayout.labelWidth
|
||||
}
|
||||
|
||||
LineEdit {
|
||||
id: checkProofMessageLine
|
||||
fontSize: mainLayout.lineEditFontSize
|
||||
placeholderText: qsTr("Optional message against which the signature is signed") + translationManager.emptyString;
|
||||
readOnly: false
|
||||
width: mainLayout.editWidth
|
||||
Layout.fillWidth: true
|
||||
|
||||
IconButton {
|
||||
imageSource: "../images/copyToClipboard.png"
|
||||
onClicked: {
|
||||
if (checkProofMessageLine.text.length > 0) {
|
||||
clipboard.setText(checkProofMessageLine.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Label {
|
||||
fontSize: 14
|
||||
text: qsTr("Signature") + translationManager.emptyString
|
||||
width: mainLayout.labelWidth
|
||||
}
|
||||
|
||||
|
||||
LineEdit {
|
||||
id: checkProofSignatureLine
|
||||
fontSize: mainLayout.lineEditFontSize
|
||||
placeholderText: qsTr("Paste tx proof") + translationManager.emptyString;
|
||||
readOnly: false
|
||||
|
||||
width: mainLayout.editWidth
|
||||
Layout.fillWidth: true
|
||||
|
||||
IconButton {
|
||||
imageSource: "../images/copyToClipboard.png"
|
||||
onClicked: {
|
||||
if (checkProofSignatureLine.text.length > 0) {
|
||||
clipboard.setText(checkProofSignatureLine.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -208,9 +306,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
StandardButton {
|
||||
id: checkButton
|
||||
anchors.left: parent.left
|
||||
anchors.top: txKeyRow.bottom
|
||||
anchors.topMargin: 17
|
||||
width: 60
|
||||
text: qsTr("Check") + translationManager.emptyString
|
||||
@@ -218,13 +314,28 @@ Rectangle {
|
||||
shadowPressedColor: "#B32D00"
|
||||
releasedColor: "#FF6C3C"
|
||||
pressedColor: "#FF4304"
|
||||
enabled: checkAddress(addressLine.text, appWindow.persistentSettings.testnet) && checkTxID(txIdLine.text) && checkTxKey(txKeyLine.text)
|
||||
enabled: checkTxID(checkProofTxIdLine.text) && checkAddress(checkProofAddressLine.text, appWindow.persistentSettings.testnet) && checkSignature(checkProofSignatureLine.text)
|
||||
onClicked: {
|
||||
console.log("TxKey: Check clicked: address " + addressLine.text + ", txid " << txIdLine.text + ", tx key " + txKeyLine.text);
|
||||
root.checkPaymentClicked(addressLine.text, txIdLine.text, txKeyLine.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)
|
||||
}
|
||||
}
|
||||
|
||||
// underline
|
||||
Rectangle {
|
||||
height: 1
|
||||
color: "#DBDBDB"
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
anchors.bottomMargin: 3
|
||||
|
||||
}
|
||||
|
||||
Text {
|
||||
text: qsTr("If a payment had several transactions then each must be checked and the results combined.") + translationManager.emptyString
|
||||
wrapMode: Text.Wrap
|
||||
Layout.fillWidth: true;
|
||||
}
|
||||
}
|
||||
|
||||
function onPageCompleted() {
|
||||
|
||||
Reference in New Issue
Block a user