From d8d2426e83bd3580aa25c940e4ab6e86b91c87e9 Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Mon, 20 Nov 2023 13:35:18 +0100 Subject: [PATCH] qml: add local/remote SCID alias to ChannelDetails --- .../gui/qml/components/ChannelDetails.qml | 24 +++++++++++++++++++ electrum/gui/qml/qechanneldetails.py | 11 +++++++++ 2 files changed, 35 insertions(+) diff --git a/electrum/gui/qml/components/ChannelDetails.qml b/electrum/gui/qml/components/ChannelDetails.qml index f597d60a8..50a37c424 100644 --- a/electrum/gui/qml/components/ChannelDetails.qml +++ b/electrum/gui/qml/components/ChannelDetails.qml @@ -212,6 +212,30 @@ Pane { text: channeldetails.shortCid } + Label { + text: qsTr('Local SCID alias') + color: Material.accentColor + visible: channeldetails.localScidAlias + } + + Label { + Layout.fillWidth: true + text: channeldetails.localScidAlias + visible: channeldetails.localScidAlias + } + + Label { + text: qsTr('Remote SCID alias') + color: Material.accentColor + visible: channeldetails.remoteScidAlias + } + + Label { + Layout.fillWidth: true + text: channeldetails.remoteScidAlias + visible: channeldetails.remoteScidAlias + } + Label { visible: !channeldetails.isBackup text: qsTr('Initiator') diff --git a/electrum/gui/qml/qechanneldetails.py b/electrum/gui/qml/qechanneldetails.py index 8f1b810be..3956adfb5 100644 --- a/electrum/gui/qml/qechanneldetails.py +++ b/electrum/gui/qml/qechanneldetails.py @@ -8,6 +8,7 @@ from electrum.gui import messages from electrum.logging import get_logger from electrum.lnutil import LOCAL, REMOTE from electrum.lnchannel import ChanCloseOption, ChannelState +from electrum.util import format_short_id from .auth import AuthMixin, auth_protect from .qewallet import QEWallet @@ -99,6 +100,16 @@ class QEChannelDetails(AuthMixin, QObject, QtEventListener): def shortCid(self): return self._channel.short_id_for_GUI() + @pyqtProperty(str, notify=channelChanged) + def localScidAlias(self): + lsa = self._channel.get_local_scid_alias() + return format_short_id(lsa) if lsa else '' + + @pyqtProperty(str, notify=channelChanged) + def remoteScidAlias(self): + rsa = self._channel.get_remote_scid_alias() + return format_short_id(rsa) if rsa else '' + @pyqtProperty(str, notify=channelChanged) def state(self): return self._channel.get_state_for_GUI()