diff --git a/src/qt/forms/sendcoinsentry.ui b/src/qt/forms/sendcoinsentry.ui index 361f182f0a..965657edb9 100644 --- a/src/qt/forms/sendcoinsentry.ui +++ b/src/qt/forms/sendcoinsentry.ui @@ -221,7 +221,7 @@ - + Message: @@ -231,15 +231,12 @@ - - + + - A message that was attached to the firo: URI which will be stored with the transaction for your reference. Note: This message will not be sent over the Firo network. + Optional message for this transaction - - Qt::PlainText - - + diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 3bfbfbc6a7..f67d5ea1cf 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -265,6 +265,7 @@ void SendCoinsDialog::on_sendButton_clicked() } ctx = dialog->getUnlockContext(); } + recipient.message = entry->getValue().message; recipients.append(recipient); } else @@ -532,6 +533,13 @@ void SendCoinsDialog::on_sendButton_clicked() QString questionString = tr("Are you sure you want to send?"); questionString.append(warningMessage); questionString.append("

%1"); + questionString.append("\n\nMessage: "); + for (auto rec : recipients) + { + questionString.append(rec.message); + questionString.append("\n"); + } + double txSize; if ((fAnonymousMode == false) && (recipients.size() == sparkAddressCount) && spark::IsSparkAllowed()) { diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp index c250db4d21..c762262041 100644 --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -55,6 +55,9 @@ SendCoinsEntry::SendCoinsEntry(const PlatformStyle *_platformStyle, QWidget *par connect(ui->deleteButton, &QToolButton::clicked, this, &SendCoinsEntry::deleteClicked); connect(ui->deleteButton_is, &QToolButton::clicked, this, &SendCoinsEntry::deleteClicked); connect(ui->deleteButton_s, &QToolButton::clicked, this, &SendCoinsEntry::deleteClicked); + + ui->messageLabel->setVisible(false); + ui->messageTextLabel->setVisible(false); } SendCoinsEntry::~SendCoinsEntry() @@ -85,6 +88,10 @@ void SendCoinsEntry::on_payTo_textChanged(const QString &address) { updateLabel(address); setWarning(fAnonymousMode); + + bool isSparkAddress = model && model->validateSparkAddress(address); + ui->messageLabel->setVisible(isSparkAddress); + ui->messageTextLabel->setVisible(isSparkAddress); } void SendCoinsEntry::setModel(WalletModel *_model) diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp index a13eb7e347..85d04babc4 100644 --- a/src/qt/transactiondesc.cpp +++ b/src/qt/transactiondesc.cpp @@ -311,10 +311,14 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco strHTML += "" + tr("Transaction total size") + ": " + QString::number(wtx.tx->GetTotalSize()) + " bytes
"; strHTML += "" + tr("Output index") + ": " + QString::number(rec->getOutputIndex()) + "
"; - // Message from normal firo:URI (firo:123...?message=example) - for (const PAIRTYPE(std::string, std::string)& r : wtx.vOrderForm) - if (r.first == "Message") - strHTML += "
" + tr("Message") + ":
" + GUIUtil::HtmlEscape(r.second, true) + "
"; + uint256 selectedTxID = rec->hash; + std::unordered_map coins = wallet->sparkWallet->getMintMap(); + + for (const auto& [id, meta] : coins) { + if (meta.txid == selectedTxID && !meta.memo.empty()) { + strHTML += "" + tr("Message") + ": " + GUIUtil::HtmlEscape(meta.memo, true) + "
\n"; + } + } if (wtx.IsCoinBase()) { diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index 66a8538941..c625cf4b77 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -1384,7 +1384,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareMintSparkTransaction(std::vecto address.decode(rcp.address.toStdString()); spark::MintedCoinData data; data.address = address; - data.memo = ""; + data.memo = rcp.message.toStdString(); data.v = rcp.amount; outputs.push_back(data); total += rcp.amount; @@ -1481,7 +1481,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareSpendSparkTransaction(WalletMod address.decode(rcp.address.toStdString()); spark::OutputCoinData data; data.address = address; - data.memo = ""; + data.memo = rcp.message.toStdString(); data.v = rcp.amount; privateRecipients.push_back(std::make_pair(data, rcp.fSubtractFeeFromAmount)); } else {