Skip to content

Commit 62ac119

Browse files
committed
gui: display address on external signer
1 parent 450cb40 commit 62ac119

File tree

6 files changed

+36
-0
lines changed

6 files changed

+36
-0
lines changed

src/interfaces/wallet.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,9 @@ class Wallet
258258
// Return whether private keys enabled.
259259
virtual bool privateKeysDisabled() = 0;
260260

261+
// Return whether wallet uses an external signer.
262+
virtual bool hasExternalSigner() = 0;
263+
261264
// Get default address type.
262265
virtual OutputType getDefaultAddressType() = 0;
263266

src/qt/forms/receiverequestdialog.ui

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,19 @@
254254
</property>
255255
</widget>
256256
</item>
257+
<item>
258+
<widget class="QPushButton" name="btnVerify">
259+
<property name="text">
260+
<string>&amp;Verify</string>
261+
</property>
262+
<property name="toolTip">
263+
<string>Verify this address on e.g. a hardware wallet screen</string>
264+
</property>
265+
<property name="autoDefault">
266+
<bool>false</bool>
267+
</property>
268+
</widget>
269+
</item>
257270
<item>
258271
<widget class="QPushButton" name="btnSaveAs">
259272
<property name="text">

src/qt/receiverequestdialog.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ void ReceiveRequestDialog::setInfo(const SendCoinsRecipient &_info)
8989
ui->wallet_tag->hide();
9090
ui->wallet_content->hide();
9191
}
92+
93+
ui->btnVerify->setVisible(this->model->wallet().hasExternalSigner());
94+
95+
connect(ui->btnVerify, &QPushButton::clicked, [this] {
96+
model->displayAddress(info.address.toStdString());
97+
});
9298
}
9399

94100
void ReceiveRequestDialog::updateDisplayUnit()

src/qt/walletmodel.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,18 @@ bool WalletModel::bumpFee(uint256 hash, uint256& new_hash)
571571
return true;
572572
}
573573

574+
bool WalletModel::displayAddress(std::string sAddress)
575+
{
576+
CTxDestination dest = DecodeDestination(sAddress);
577+
bool res = false;
578+
try {
579+
res = m_wallet->displayAddress(dest);
580+
} catch (const std::runtime_error& e) {
581+
QMessageBox::critical(nullptr, tr("Can't display address"), e.what());
582+
}
583+
return res;
584+
}
585+
574586
bool WalletModel::isWalletEnabled()
575587
{
576588
return !gArgs.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET);

src/qt/walletmodel.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ class WalletModel : public QObject
139139
bool saveReceiveRequest(const std::string &sAddress, const int64_t nId, const std::string &sRequest);
140140

141141
bool bumpFee(uint256 hash, uint256& new_hash);
142+
bool displayAddress(std::string sAddress);
142143

143144
static bool isWalletEnabled();
144145

src/wallet/interfaces.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,7 @@ class WalletImpl : public Wallet
459459
unsigned int getConfirmTarget() override { return m_wallet->m_confirm_target; }
460460
bool hdEnabled() override { return m_wallet->IsHDEnabled(); }
461461
bool canGetAddresses() override { return m_wallet->CanGetAddresses(); }
462+
bool hasExternalSigner() override { return m_wallet->IsWalletFlagSet(WALLET_FLAG_EXTERNAL_SIGNER); }
462463
bool privateKeysDisabled() override { return m_wallet->IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS); }
463464
OutputType getDefaultAddressType() override { return m_wallet->m_default_address_type; }
464465
CAmount getDefaultMaxTxFee() override { return m_wallet->m_default_max_tx_fee; }

0 commit comments

Comments
 (0)