}
void TxConfAdvDialog::txKeyCopy() {
+ if (m_ctx->wallet->isHwBacked()) {
+ QMessageBox::warning(this, "Unable to get tx private key", "Unable to get tx secret key: wallet is backed by hardware device");
+ return;
+ }
+
Utils::copyToClipboard(m_tx->transaction(0)->txKey());
}
}
void TxInfoDialog::copyTxKey() {
+ if (m_ctx->wallet->isHwBacked()) {
+ QMessageBox::warning(this, "Unable to get tx private key", "Unable to get tx secret key: wallet is backed by hardware device");
+ return;
+ }
+
m_ctx->wallet->getTxKeyAsync(m_txid, [this](QVariantMap map){
QString txKey = map.value("tx_key").toString();
if (txKey.isEmpty()) {
ui->input_inMessage->clear();
ui->input_InProof->clear();
break;
+ case 3:
+ ui->line_keyTxID->clear();
+ ui->line_keyTxKey->clear();
+ ui->line_keyAddress->clear();
+ break;
}
});
case 2:
this->checkInProof();
break;
+ case 3:
+ this->checkTxKey();
+ break;
}
}
this->checkTxProof(ui->lineEdit_inTxID->text(), ui->lineEdit_inAddress->text(), ui->input_inMessage->toPlainText(), ui->input_InProof->toPlainText());
}
+void VerifyProofDialog::checkTxKey() {
+ ui->btn_verifyFormattedProof->setEnabled(false);
+ ui->btn_verify->setEnabled(false);
+ TxKeyResult res = m_wallet->checkTxKey(ui->line_keyTxID->text(), ui->line_keyTxKey->text(), ui->line_keyAddress->text());
+
+ if (!res.succes) {
+ this->proofStatus(false, QString("Error: %1").arg(res.errorString));
+ return;
+ }
+
+ if (!res.good) {
+ this->proofStatus(false, QString("Tx secret key does not decode any outputs for this transaction."));
+ return;
+ }
+
+ this->proofStatus(true, QString("Proof is valid.\n\nThis address received %1 XMR, with %2 confirmations").arg(res.amount, QString::number(res.confirmations)));
+}
+
void VerifyProofDialog::checkFormattedProof() {
QRegularExpression proof("-----BEGIN (?<type>\\w+)-----\\n"
"Network: (?<coin>\\w+) (?<network>\\w+)\\n"
void checkSpendProof(const QString &txId, const QString &message, const QString &signature);
void checkOutProof();
void checkInProof();
+ void checkTxKey();
void checkFormattedProof();
void proofStatus(bool success, const QString &message);
void onTxProofVerified(TxProofResult result);
</item>
</layout>
</widget>
+ <widget class="QWidget" name="TxKey">
+ <attribute name="title">
+ <string>TxKey</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_7">
+ <item>
+ <widget class="QLabel" name="label_20">
+ <property name="text">
+ <string>Similar to an OutProof, the Transaction Secret Key can be used to prove the sum of outputs sent to an address in a transaction.</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QFormLayout" name="formLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_17">
+ <property name="text">
+ <string>Transaction ID:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_18">
+ <property name="text">
+ <string>Transaction Secret Key:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_19">
+ <property name="text">
+ <string>Address:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="line_keyTxID"/>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="line_keyTxKey"/>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLineEdit" name="line_keyAddress"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer_4">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
</widget>
</item>
<item>
}, callback);
}
-QString Wallet::checkTxKey(const QString &txid, const QString &tx_key, const QString &address)
+TxKeyResult Wallet::checkTxKey(const QString &txid, const QString &tx_key, const QString &address)
{
uint64_t received;
bool in_pool;
uint64_t confirmations;
bool success = m_walletImpl->checkTxKey(txid.toStdString(), tx_key.toStdString(), address.toStdString(), received, in_pool, confirmations);
- std::string result = std::string(success ? "true" : "false") + "|" + QString::number(received).toStdString() + "|" + std::string(in_pool ? "true" : "false") + "|" + QString::number(confirmations).toStdString();
- return QString::fromStdString(result);
+ QString errorString = success ? "" : this->errorString();
+ bool good = received > 0;
+ return {success, good, QString::fromStdString(Monero::Wallet::displayAmount(received)), in_pool, confirmations, errorString};
}
TxProof Wallet::getTxProof(const QString &txid, const QString &address, const QString &message) const
QString error;
};
+struct TxKeyResult {
+ bool succes = false;
+ bool good = false;
+ QString amount;
+ bool inPool;
+ uint64_t confirmations;
+ QString errorString;
+};
+
struct SubaddressIndex {
SubaddressIndex(int major, int minor) {
this->major = major;
QString getTxKey(const QString &txid) const;
void getTxKeyAsync(const QString &txid, const std::function<void (QVariantMap)> &callback);
- QString checkTxKey(const QString &txid, const QString &tx_key, const QString &address);
+ TxKeyResult checkTxKey(const QString &txid, const QString &tx_key, const QString &address);
TxProof getTxProof(const QString &txid, const QString &address, const QString &message) const;
// void getTxProofAsync(const QString &txid, const QString &address, const QString &message, const QJSValue &callback);
//QString checkTxProof(const QString &txid, const QString &address, const QString &message, const QString &signature);