From 1731c36234f5289cfd656bc30f691f52effcc3bb Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Fri, 18 Nov 2022 23:08:22 +0100 Subject: [PATCH] qml: add lightning node id to walletdetails --- electrum/gui/qml/components/WalletDetails.qml | 36 +++++++++++++++++++ electrum/gui/qml/qewallet.py | 4 +++ 2 files changed, 40 insertions(+) diff --git a/electrum/gui/qml/components/WalletDetails.qml b/electrum/gui/qml/components/WalletDetails.qml index 046c48c79..3c2f30e2a 100644 --- a/electrum/gui/qml/components/WalletDetails.qml +++ b/electrum/gui/qml/components/WalletDetails.qml @@ -174,6 +174,41 @@ Pane { visible: Daemon.currentWallet columns: 2 + Label { + Layout.columnSpan: 2 + visible: Daemon.currentWallet.isLightning + text: qsTr('Lightning Node ID') + color: Material.accentColor + } + + TextHighlightPane { + Layout.columnSpan: 2 + Layout.fillWidth: true + visible: Daemon.currentWallet.isLightning + + RowLayout { + width: parent.width + Label { + Layout.fillWidth: true + text: Daemon.currentWallet.lightningNodePubkey + wrapMode: Text.Wrap + font.family: FixedFont + font.pixelSize: constants.fontSizeMedium + } + ToolButton { + icon.source: '../../icons/share.png' + icon.color: 'transparent' + onClicked: { + var dialog = app.genericShareDialog.createObject(rootItem, { + title: qsTr('Lightning Node ID'), + text: Daemon.currentWallet.lightningNodePubkey + }) + dialog.open() + } + } + } + } + Label { visible: _is2fa text: qsTr('2FA') @@ -278,6 +313,7 @@ Pane { Layout.fillWidth: true text: modelData.derivation_prefix visible: modelData.derivation_prefix + font.family: FixedFont } Label { diff --git a/electrum/gui/qml/qewallet.py b/electrum/gui/qml/qewallet.py index bb38a4a7a..3a6303bd7 100644 --- a/electrum/gui/qml/qewallet.py +++ b/electrum/gui/qml/qewallet.py @@ -349,6 +349,10 @@ class QEWallet(AuthMixin, QObject, QtEventListener): }) return result + @pyqtProperty(str, notify=dataChanged) + def lightningNodePubkey(self): + return self.wallet.lnworker.node_keypair.pubkey.hex() if self.wallet.lnworker else '' + @pyqtProperty(str, notify=dataChanged) def derivationPrefix(self): keystores = self.wallet.get_keystores()