Skip to content

Commit

Permalink
Transfer: remove references of long payment ids
Browse files Browse the repository at this point in the history
  • Loading branch information
tobtoht committed Dec 19, 2019
1 parent 46227bd commit a14a3d3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 90 deletions.
4 changes: 2 additions & 2 deletions MiddlePanel.qml
Expand Up @@ -63,7 +63,7 @@ Rectangle {
property Keys keysView: Keys { }
property Account accountView: Account { }

signal paymentClicked(string address, string paymentId, string amount, int mixinCount, int priority, string description)
signal paymentClicked(string address, string amount, int mixinCount, int priority, string description)
signal sweepUnmixableClicked()
signal generatePaymentIdInvoked()
signal getProofClicked(string txid, string address, string message);
Expand Down Expand Up @@ -265,7 +265,7 @@ Rectangle {
target: transferView
onPaymentClicked : {
console.log("MiddlePanel: paymentClicked")
paymentClicked(address, paymentId, amount, mixinCount, priority, description)
paymentClicked(address, amount, mixinCount, priority, description)
}
onSweepUnmixableClicked : {
console.log("MiddlePanel: sweepUnmixableClicked")
Expand Down
7 changes: 3 additions & 4 deletions main.qml
Expand Up @@ -839,10 +839,9 @@ ApplicationWindow {


// called on "transfer"
function handlePayment(address, paymentId, amount, mixinCount, priority, description, createFile) {
function handlePayment(address, amount, mixinCount, priority, description, createFile) {
console.log("Creating transaction: ")
console.log("\taddress: ", address,
", payment_id: ", paymentId,
", amount: ", amount,
", mixins: ", mixinCount,
", priority: ", priority,
Expand Down Expand Up @@ -886,9 +885,9 @@ ApplicationWindow {
}

if (amount === "(all)")
currentWallet.createTransactionAllAsync(address, paymentId, mixinCount, priority);
currentWallet.createTransactionAllAsync(address, "", mixinCount, priority);
else
currentWallet.createTransactionAsync(address, paymentId, amountxmr, mixinCount, priority);
currentWallet.createTransactionAsync(address, "", amountxmr, mixinCount, priority);
}

//Choose where to save transaction
Expand Down
87 changes: 3 additions & 84 deletions pages/Transfer.qml
Expand Up @@ -42,7 +42,7 @@ import "../js/TxUtils.js" as TxUtils

Rectangle {
id: root
signal paymentClicked(string address, string paymentId, string amount, int mixinCount,
signal paymentClicked(string address, string amount, int mixinCount,
int priority, string description)
signal sweepUnmixableClicked()

Expand All @@ -54,9 +54,6 @@ Rectangle {
property string sendButtonWarning: ""
property string startLinkText: qsTr("<style type='text/css'>a {text-decoration: none; color: #FF6C3C; font-size: 14px;}</style><font size='2'> (</font><a href='#'>Start daemon</a><font size='2'>)</font>") + translationManager.emptyString
property bool showAdvanced: false
// @TODO: remove after pid removal hardfork
property bool warningLongPidTransfer: false
property bool warningLongPidDescription: descriptionLine.text.match(/^[0-9a-f]{64}$/i)

Clipboard { id: clipboard }

Expand All @@ -71,7 +68,6 @@ Rectangle {
function updateFromQrCode(address, payment_id, amount, tx_description, recipient_name) {
console.log("updateFromQrCode")
addressLine.text = address
setPaymentId(payment_id);
amountLine.text = amount
setDescription(recipient_name + " " + tx_description);
cameraUi.qrcode_decoded.disconnect(updateFromQrCode)
Expand All @@ -82,25 +78,8 @@ Rectangle {
descriptionCheckbox.checked = descriptionLine.text != "";
}

function setPaymentId(value) {
paymentIdLine.text = value;
paymentIdCheckbox.checked = paymentIdLine.text != "";
}

function isLongPidService(text) {
// @TODO: remove after pid removal hardfork
return text.length == 95 &&
[ "44tLjmXrQNrWJ5NBsEj2R77ZBEgDa3fEe9GLpSf2FRmhexPvfYDUAB7EXX1Hdb3aMQ9FLqdJ56yaAhiXoRsceGJCRS3Jxkn", // Binance
"4AQ3ZREb53FMYKBmpPn7BD7hphPk6G1ceinQX6gefAvhFJsNbeFsGwebZWCNxoJAbZhD9cjetBAqmLhfXmcNLBpPMsBL6yM", // KuCoin
"47YzEcMrU2S42UitURo7ukUDaSaL485Z1QbmFgq1vSs5g3JesL4rChwWf2uWk1va99JAaRxt65jhX9uAqQnjeFM44ckgZtp", // AnycoinDirect
"4BCeEPhodgPMbPWFN1dPwhWXdRX8q4mhhdZdA1dtSMLTLCEYvAj9QXjXAfF7CugEbmfBhgkqHbdgK9b2wKA6nqRZQCgvCDm", // Bitfinex
"463tWEBn5XZJSxLU6uLQnQ2iY9xuNcDbjLSjkn3XAXHCbLrTTErJrBWYgHJQyrCwkNgYvyV3z8zctJLPCZy24jvb3NiTcTJ" // Bittrex
].indexOf(text) > -1
}

function clearFields() {
addressLine.text = ""
setPaymentId("");
amountLine.text = ""
root.sendButtonWarning = ""
setDescription("");
Expand Down Expand Up @@ -273,11 +252,9 @@ Rectangle {
const parsed = walletManager.parse_uri_to_object(text);
if (!parsed.error) {
addressLine.text = parsed.address;
setPaymentId(parsed.payment_id);
amountLine.text = parsed.amount;
setDescription(parsed.tx_description);
}
warningLongPidTransfer = isLongPidService(text);
}
inlineButton.text: FontAwesome.qrcode
inlineButton.fontPixelSize: 22
Expand Down Expand Up @@ -338,12 +315,6 @@ Rectangle {
}
}

MoneroComponents.WarningBox {
text: qsTr("Description field contents match long payment ID format. \
Please don't paste long payment ID into description field, your funds might be lost.") + translationManager.emptyString;
visible: warningLongPidDescription
}

ColumnLayout {
spacing: 15

Expand Down Expand Up @@ -372,48 +343,6 @@ Rectangle {
visible: descriptionCheckbox.checked
}
}

ColumnLayout {
visible: paymentIdCheckbox.checked
// @TODO: remove after pid removal hardfork
CheckBox {
id: paymentIdCheckbox
border: false
checkedIcon: FontAwesome.minusCircle
uncheckedIcon: FontAwesome.plusCircle
fontAwesomeIcons: true
fontSize: paymentIdLine.labelFontSize
iconOnTheLeft: true
Layout.fillWidth: true
text: qsTr("Add payment ID") + translationManager.emptyString
onClicked: {
if (!paymentIdCheckbox.checked) {
paymentIdLine.text = "";
}
}
}

// payment id input
LineEditMulti {
id: paymentIdLine
fontBold: true
placeholderText: qsTr("64 hexadecimal characters") + translationManager.emptyString
readOnly: true
Layout.fillWidth: true
wrapMode: Text.WrapAnywhere
addressValidation: false
visible: paymentIdCheckbox.checked
}
}
}

MoneroComponents.WarningBox {
// @TODO: remove after pid removal hardfork
id: paymentIdWarningBox
text: qsTr("Long payment IDs are obsolete. \
Long payment IDs were not encrypted on the blockchain and would harm your privacy. \
If the party you're sending to still requires a long payment ID, please notify them.") + translationManager.emptyString;
visible: warningLongPidTransfer || paymentIdCheckbox.checked
}

MoneroComponents.WarningBox {
Expand All @@ -438,8 +367,7 @@ Rectangle {
console.log("priority: " + priority)
console.log("amount: " + amountLine.text)
addressLine.text = addressLine.text.trim()
setPaymentId(paymentIdLine.text.trim());
root.paymentClicked(addressLine.text, paymentIdLine.text, amountLine.text, root.mixin, priority, descriptionLine.text)
root.paymentClicked(addressLine.text, amountLine.text, root.mixin, priority, descriptionLine.text)
}
}
}
Expand Down Expand Up @@ -513,8 +441,7 @@ Rectangle {
console.log("priority: " + priority)
console.log("amount: " + amountLine.text)
addressLine.text = addressLine.text.trim()
setPaymentId(paymentIdLine.text.trim());
root.paymentClicked(addressLine.text, paymentIdLine.text, amountLine.text, root.mixin, priority, descriptionLine.text)
root.paymentClicked(addressLine.text, amountLine.text, root.mixin, priority, descriptionLine.text)

}
}
Expand Down Expand Up @@ -594,7 +521,6 @@ Rectangle {
for (var i = 0; i < transaction.txCount; ++i) {
confirmationDialog.text += qsTr("\nTransaction #%1").arg(i+1)
+qsTr("\nRecipient: ") + transaction.recipientAddress[i]
+ (transaction.paymentId[i] == "" ? "" : qsTr("\n\payment ID: ") + transaction.paymentId[i])
+ qsTr("\nAmount: ") + walletManager.displayAmount(transaction.amount(i))
+ qsTr("\nFee: ") + walletManager.displayAmount(transaction.fee(i))
+ qsTr("\nRingsize: ") + (transaction.mixin(i)+1)
Expand Down Expand Up @@ -750,9 +676,6 @@ Rectangle {
if(typeof address !== 'undefined')
addressLine.text = address

if(typeof paymentId !== 'undefined')
setPaymentId(paymentId);

if(typeof description !== 'undefined')
setDescription(description);

Expand Down Expand Up @@ -789,10 +712,6 @@ Rectangle {
return false;
}

if (paymentIdWarningBox.visible) {
return false;
}

return true;
}
}

0 comments on commit a14a3d3

Please sign in to comment.