2018-01-07 06:20:45 +01:00
// Copyright (c) 2014-2018, The Monero Project
2016-11-05 15:58:49 +01:00
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.0
import QtQuick . Controls 1.4
import QtQuick . Controls . Styles 1.4
import QtQuick . Layouts 1.1
import "../components"
import moneroComponents . Clipboard 1.0
2018-03-21 01:35:34 +01:00
import "../js/TxUtils.js" as TxUtils
2016-11-05 15:58:49 +01:00
Rectangle {
2018-03-19 23:30:34 +01:00
color: "transparent"
2016-11-05 15:58:49 +01:00
Clipboard { id: clipboard }
/* main layout */
ColumnLayout {
id: mainLayout
2018-03-21 02:39:09 +01:00
anchors.margins: 40 * scaleRatio
2016-11-05 15:58:49 +01:00
anchors.left: parent . left
anchors.top: parent . top
anchors.right: parent . right
2018-03-19 23:30:34 +01:00
anchors.bottom: parent . bottom
2018-03-21 02:39:09 +01:00
spacing: 20 * scaleRatio
2017-09-12 10:42:00 +02:00
2018-03-19 23:30:34 +01:00
// solo
ColumnLayout {
id: soloBox
anchors.left: parent . left
anchors.right: parent . right
anchors.top: parent . top
2018-03-21 02:39:09 +01:00
spacing: 20 * scaleRatio
2018-03-19 23:30:34 +01:00
2017-09-12 10:42:00 +02:00
Label {
2018-03-19 23:30:34 +01:00
id: soloTitleLabel
2018-03-21 02:39:09 +01:00
fontSize: 24 * scaleRatio
2018-03-19 23:30:34 +01:00
text: qsTr ( "Prove Transaction" ) + translationManager . emptyString
2017-09-12 10:42:00 +02:00
}
2016-11-10 19:33:25 +01:00
2018-03-19 23:30:34 +01:00
Text {
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
2017-09-12 10:42:00 +02:00
Layout.fillWidth: true
2018-03-24 20:48:19 +01:00
font.family: Style . fontRegular . name
2018-03-19 23:30:34 +01:00
font.pixelSize: 14 * scaleRatio
color: Style . defaultFontColor
}
2017-09-12 10:42:00 +02:00
2018-03-19 23:30:34 +01:00
RowLayout {
LineEdit {
labelText: qsTr ( "Transaction ID" ) + translationManager . emptyString
id: getProofTxIdLine
fontSize: 16 * scaleRatio
placeholderText: qsTr ( "Paste tx ID" ) + translationManager . emptyString
readOnly: false
Layout.fillWidth: true
copyButton: true
2016-11-05 15:58:49 +01:00
}
}
2018-03-19 23:30:34 +01:00
RowLayout {
LineEdit {
id: getProofAddressLine
labelText: qsTr ( "Address" ) + translationManager . emptyString
fontSize: 16 * scaleRatio
placeholderText: qsTr ( "Recipient's wallet address" ) + translationManager . emptyString ;
readOnly: false
Layout.fillWidth: true
copyButton: true
}
2016-11-05 15:58:49 +01:00
}
2018-03-19 23:30:34 +01:00
RowLayout {
LineEdit {
id: getProofMessageLine
fontSize: 16 * scaleRatio
labelText: qsTr ( "Message" ) + translationManager . emptyString
placeholderText: qsTr ( "Optional message against which the signature is signed" ) + translationManager . emptyString ;
readOnly: false
width: mainLayout . editWidth
Layout.fillWidth: true
copyButton: true
2016-11-05 15:58:49 +01:00
}
}
2018-03-19 23:30:34 +01:00
StandardButton {
anchors.left: parent . left
2018-03-21 02:39:09 +01:00
anchors.topMargin: 17 * scaleRatio
width: 60 * scaleRatio
2018-04-22 20:07:31 +02:00
small: true
2018-03-19 23:30:34 +01:00
text: qsTr ( "Generate" ) + translationManager . emptyString
2018-03-27 02:03:59 +02:00
enabled: TxUtils . checkTxID ( getProofTxIdLine . text ) && ( getProofAddressLine . text . length == 0 || TxUtils . checkAddress ( getProofAddressLine . text , appWindow . persistentSettings . nettype ) )
2018-03-19 23:30:34 +01:00
onClicked: {
console . log ( "getProof: Generate clicked: txid " + getProofTxIdLine . text + ", address " + getProofAddressLine . text + ", message: " + getProofMessageLine . text ) ;
root . getProofClicked ( getProofTxIdLine . text , getProofAddressLine . text , getProofMessageLine . text )
}
2016-11-05 15:58:49 +01:00
}
2018-03-19 23:30:34 +01:00
// underline
Rectangle {
height: 1
color: "#404040"
2017-09-12 10:42:00 +02:00
Layout.fillWidth: true
2018-03-19 23:30:34 +01:00
Layout.alignment: Qt . AlignHCenter
2018-03-21 02:39:09 +01:00
anchors.bottomMargin: 3 * scaleRatio
2017-09-12 10:42:00 +02:00
}
Label {
2018-03-19 23:30:34 +01:00
id: soloTitleLabel2
2018-03-21 02:39:09 +01:00
fontSize: 24 * scaleRatio
2018-03-19 23:30:34 +01:00
text: qsTr ( "Check Transaction" ) + translationManager . emptyString
2017-09-12 10:42:00 +02:00
}
2016-11-05 15:58:49 +01:00
2018-03-19 23:30:34 +01:00
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.\n" +
"For the case with Spend Proof, you don't need to specify the recipient address." ) + translationManager . emptyString
wrapMode: Text . Wrap
2016-11-05 15:58:49 +01:00
Layout.fillWidth: true
2018-03-24 20:48:19 +01:00
font.family: Style . fontRegular . name
2018-03-19 23:30:34 +01:00
font.pixelSize: 14 * scaleRatio
color: Style . defaultFontColor
2017-09-12 10:42:00 +02:00
}
2018-03-19 23:30:34 +01:00
RowLayout {
LineEdit {
id: checkProofTxIdLine
labelText: qsTr ( "Transaction ID" ) + translationManager . emptyString
fontSize: 16 * scaleRatio
placeholderText: qsTr ( "Paste tx ID" ) + translationManager . emptyString
readOnly: false
width: mainLayout . editWidth
Layout.fillWidth: true
copyButton: true
}
2017-09-12 10:42:00 +02:00
}
2018-03-19 23:30:34 +01:00
RowLayout {
LineEdit {
id: checkProofAddressLine
labelText: qsTr ( "Address" ) + translationManager . emptyString
fontSize: 16 * scaleRatio
placeholderText: qsTr ( "Recipient's wallet address" ) + translationManager . emptyString ;
readOnly: false
width: mainLayout . editWidth
Layout.fillWidth: true
copyButton: true
2016-11-05 15:58:49 +01:00
}
2017-09-12 10:42:00 +02:00
}
2018-03-19 23:30:34 +01:00
RowLayout {
LineEdit {
id: checkProofMessageLine
fontSize: 16 * scaleRatio
labelText: qsTr ( "Message" ) + translationManager . emptyString
placeholderText: qsTr ( "Optional message against which the signature is signed" ) + translationManager . emptyString ;
readOnly: false
width: mainLayout . editWidth
Layout.fillWidth: true
copyButton: true
}
2017-09-12 10:42:00 +02:00
}
2018-03-19 23:30:34 +01:00
RowLayout {
LineEdit {
id: checkProofSignatureLine
fontSize: 16 * scaleRatio
labelText: qsTr ( "Signature" ) + translationManager . emptyString
placeholderText: qsTr ( "Paste tx proof" ) + translationManager . emptyString ;
readOnly: false
width: mainLayout . editWidth
Layout.fillWidth: true
copyButton: true
2017-09-12 10:42:00 +02:00
}
2016-11-05 15:58:49 +01:00
}
2018-03-19 23:30:34 +01:00
StandardButton {
anchors.left: parent . left
2018-03-21 02:39:09 +01:00
anchors.topMargin: 17 * scaleRatio
2018-03-19 23:30:34 +01:00
width: 60
2018-04-22 20:07:31 +02:00
small: true
2018-03-19 23:30:34 +01:00
text: qsTr ( "Check" ) + translationManager . emptyString
2018-03-27 02:03:59 +02:00
enabled: TxUtils . checkTxID ( checkProofTxIdLine . text ) && TxUtils . checkSignature ( checkProofSignatureLine . text ) && ( ( checkProofSignatureLine . text . indexOf ( "SpendProofV" ) === 0 && checkProofAddressLine . text . length == 0 ) || ( checkProofSignatureLine . text . indexOf ( "SpendProofV" ) !== 0 && TxUtils . checkAddress ( checkProofAddressLine . text , appWindow . persistentSettings . nettype ) ) )
2018-03-19 23:30:34 +01:00
onClicked: {
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 )
}
2016-11-05 15:58:49 +01:00
}
2018-03-19 23:30:34 +01:00
// underline
Rectangle {
height: 1
color: "#404040"
2016-11-05 15:58:49 +01:00
Layout.fillWidth: true
2018-03-19 23:30:34 +01:00
Layout.alignment: Qt . AlignHCenter
2018-03-21 02:39:09 +01:00
anchors.bottomMargin: 3 * scaleRatio
2016-11-05 15:58:49 +01:00
}
2018-03-19 23:30:34 +01:00
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
2018-03-24 20:48:19 +01:00
font.family: Style . fontRegular . name
2018-03-19 23:30:34 +01:00
font.pixelSize: 14 * scaleRatio
color: Style . defaultFontColor
2016-11-05 15:58:49 +01:00
}
}
}
function onPageCompleted ( ) {
console . log ( "TxKey page loaded" ) ;
}
}