|
|
@ -3,7 +3,7 @@ from typing import TYPE_CHECKING, Sequence |
|
|
|
import PyQt5.QtGui as QtGui |
|
|
|
import PyQt5.QtWidgets as QtWidgets |
|
|
|
import PyQt5.QtCore as QtCore |
|
|
|
from PyQt5.QtWidgets import QLabel, QLineEdit, QHBoxLayout |
|
|
|
from PyQt5.QtWidgets import QLabel, QLineEdit, QHBoxLayout, QGridLayout |
|
|
|
|
|
|
|
from electrum.util import EventListener |
|
|
|
from electrum.i18n import _ |
|
|
@ -14,7 +14,7 @@ from electrum.lnaddr import LnAddr, lndecode |
|
|
|
from electrum.bitcoin import COIN |
|
|
|
from electrum.wallet import Abstract_Wallet |
|
|
|
|
|
|
|
from .util import Buttons, CloseButton, ButtonsLineEdit, MessageBoxMixin, WWLabel |
|
|
|
from .util import Buttons, CloseButton, ShowQRLineEdit, MessageBoxMixin, WWLabel |
|
|
|
from .util import QtEventListener, qt_event_listener |
|
|
|
|
|
|
|
if TYPE_CHECKING: |
|
|
@ -147,69 +147,69 @@ class ChannelDetailsDialog(QtWidgets.QDialog, MessageBoxMixin, QtEventListener): |
|
|
|
|
|
|
|
# add layouts |
|
|
|
vbox = QtWidgets.QVBoxLayout(self) |
|
|
|
vbox.addWidget(QLabel(_('Remote Node ID:'))) |
|
|
|
remote_id_e = ButtonsLineEdit(bh2u(chan.node_id)) |
|
|
|
remote_id_e.addCopyButton() |
|
|
|
remote_id_e.setReadOnly(True) |
|
|
|
vbox.addWidget(remote_id_e) |
|
|
|
form = QtWidgets.QFormLayout(None) |
|
|
|
remote_id_e = ShowQRLineEdit(chan.node_id.hex(), self.window.config, title=_("Remote Node ID")) |
|
|
|
form.addRow(QLabel(_('Remote Node') + ':'), remote_id_e) |
|
|
|
channel_id_e = ShowQRLineEdit(chan.channel_id.hex(), self.window.config, title=_("Channel ID")) |
|
|
|
form.addRow(QLabel(_('Channel ID') + ':'), channel_id_e) |
|
|
|
funding_label_text = f'<a href=click_destination>{chan.funding_outpoint.txid}</a>:{chan.funding_outpoint.output_index}' |
|
|
|
vbox.addWidget(QLabel(_('Funding Outpoint:'))) |
|
|
|
vbox.addWidget(LinkedLabel(funding_label_text, self.show_tx)) |
|
|
|
|
|
|
|
form.addRow(QLabel(_('Funding Outpoint') + ':'), LinkedLabel(funding_label_text, self.show_tx)) |
|
|
|
form.addRow(QLabel(_('Short Channel ID') + ':'), QLabel(str(chan.short_channel_id))) |
|
|
|
form.addRow(QLabel(_('State') + ':'), SelectableLabel(chan.get_state_for_GUI())) |
|
|
|
self.capacity = self.format_sat(chan.get_capacity()) |
|
|
|
form.addRow(QLabel(_('Capacity') + ':'), SelectableLabel(self.capacity)) |
|
|
|
form.addRow(QLabel(_('Channel type:')), SelectableLabel(chan.storage['channel_type'].name_minimal)) |
|
|
|
initiator = 'Local' if chan.constraints.is_initiator else 'Remote' |
|
|
|
form.addRow(QLabel(_('Initiator:')), SelectableLabel(initiator)) |
|
|
|
vbox.addLayout(form) |
|
|
|
hbox_stats = QHBoxLayout() |
|
|
|
|
|
|
|
# channel stats left column |
|
|
|
form_layout_left = QtWidgets.QFormLayout(None) |
|
|
|
form_layout_left.addRow(_('Channel ID:'), WWLabel(f"{chan.channel_id.hex()} (Short: {chan.short_channel_id})")) |
|
|
|
form_layout_left.addRow(_('State:'), SelectableLabel(chan.get_state_for_GUI())) |
|
|
|
self.initiator = 'Local' if chan.constraints.is_initiator else 'Remote' |
|
|
|
form_layout_left.addRow(_('Initiator:'), SelectableLabel(self.initiator)) |
|
|
|
self.capacity = self.format_sat(chan.get_capacity()) |
|
|
|
form_layout_left.addRow(_('Capacity:'), SelectableLabel(self.capacity)) |
|
|
|
form_layout_right = QtWidgets.QFormLayout(None) |
|
|
|
self.local_balance_label = SelectableLabel() |
|
|
|
self.remote_balance_label = SelectableLabel() |
|
|
|
form_layout_left.addRow(_('Local balance') + ':', self.local_balance_label) |
|
|
|
form_layout_right.addRow(_('Remote balance') + ':', self.remote_balance_label) |
|
|
|
self.can_send_label = SelectableLabel() |
|
|
|
self.can_receive_label = SelectableLabel() |
|
|
|
form_layout_left.addRow(_('Can send:'), self.can_send_label) |
|
|
|
form_layout_left.addRow(_('Can receive:'), self.can_receive_label) |
|
|
|
form_layout_left.addRow(_('Can send') + ':', self.can_send_label) |
|
|
|
form_layout_right.addRow(_('Can receive') + ':', self.can_receive_label) |
|
|
|
local_reserve_label = SelectableLabel("{}".format( |
|
|
|
self.format_sat(chan.config[LOCAL].reserve_sat), |
|
|
|
)) |
|
|
|
remote_reserve_label = SelectableLabel("{}".format( |
|
|
|
self.format_sat(chan.config[REMOTE].reserve_sat), |
|
|
|
)) |
|
|
|
form_layout_left.addRow(_('Local reserve') + ':', local_reserve_label) |
|
|
|
form_layout_right.addRow(_('Remote reserve' + ':'), remote_reserve_label) |
|
|
|
#self.htlc_minimum_msat = SelectableLabel(str(chan.config[REMOTE].htlc_minimum_msat)) |
|
|
|
#form_layout_left.addRow(_('Minimum HTLC value accepted by peer (mSAT):'), self.htlc_minimum_msat) |
|
|
|
#self.max_htlcs = SelectableLabel(str(chan.config[REMOTE].max_accepted_htlcs)) |
|
|
|
#form_layout_left.addRow(_('Maximum number of concurrent HTLCs accepted by peer:'), self.max_htlcs) |
|
|
|
#self.max_htlc_value = SelectableLabel(self.format_sat(chan.config[REMOTE].max_htlc_value_in_flight_msat / 1000)) |
|
|
|
#form_layout_left.addRow(_('Maximum value of in-flight HTLCs accepted by peer:'), self.max_htlc_value) |
|
|
|
dust_limit_label = SelectableLabel("{}, {}".format( |
|
|
|
self.format_sat(chan.config[REMOTE].dust_limit_sat), |
|
|
|
local_dust_limit_label = SelectableLabel("{}".format( |
|
|
|
self.format_sat(chan.config[LOCAL].dust_limit_sat), |
|
|
|
)) |
|
|
|
form_layout_left.addRow(_('Dust limit:'), dust_limit_label) |
|
|
|
chan_reserve_label = SelectableLabel("{}, {}".format( |
|
|
|
self.format_sat(chan.config[REMOTE].reserve_sat), |
|
|
|
self.format_sat(chan.config[LOCAL].reserve_sat), |
|
|
|
remote_dust_limit_label = SelectableLabel("{}".format( |
|
|
|
self.format_sat(chan.config[REMOTE].dust_limit_sat), |
|
|
|
)) |
|
|
|
form_layout_left.addRow(_('Channel reserve:'), chan_reserve_label) |
|
|
|
form_layout_left.addRow(_('Channel type:'), SelectableLabel(chan.storage['channel_type'].name_minimal)) |
|
|
|
form_layout_left.addRow(_('Local dust limit') + ':', local_dust_limit_label) |
|
|
|
form_layout_right.addRow(_('Remote dust limit') + ':', remote_dust_limit_label) |
|
|
|
self.received_label = SelectableLabel() |
|
|
|
self.sent_label = SelectableLabel() |
|
|
|
form_layout_left.addRow(_('Total sent') + ':', self.sent_label) |
|
|
|
form_layout_right.addRow(_('Total received') + ':', self.received_label) |
|
|
|
# channel stats left column |
|
|
|
hbox_stats.addLayout(form_layout_left, 50) |
|
|
|
|
|
|
|
# vertical line separator |
|
|
|
line_separator = QtWidgets.QFrame() |
|
|
|
line_separator.setFrameShape(QtWidgets.QFrame.VLine) |
|
|
|
line_separator.setFrameShadow(QtWidgets.QFrame.Sunken) |
|
|
|
line_separator.setLineWidth(1) |
|
|
|
hbox_stats.addWidget(line_separator) |
|
|
|
|
|
|
|
# channel stats right column |
|
|
|
form_layout_right = QtWidgets.QFormLayout(None) |
|
|
|
self.local_balance_label = SelectableLabel() |
|
|
|
self.remote_balance_label = SelectableLabel() |
|
|
|
form_layout_right.addRow(_('Local balance:'), self.local_balance_label) |
|
|
|
form_layout_right.addRow(_('Remote balance:'), self.remote_balance_label) |
|
|
|
self.received_label = SelectableLabel() |
|
|
|
self.sent_label = SelectableLabel() |
|
|
|
form_layout_right.addRow(_('Total received so far:'), self.received_label) |
|
|
|
form_layout_right.addRow(_('Total sent so far:'), self.sent_label) |
|
|
|
hbox_stats.addLayout(form_layout_right, 50) |
|
|
|
|
|
|
|
vbox.addLayout(hbox_stats) |
|
|
|
|
|
|
|
# add htlc tree view to vbox (wouldn't scale correctly in QFormLayout) |
|
|
|
vbox.addWidget(QLabel(_('Payments (HTLCs):'))) |
|
|
|
w = QtWidgets.QTreeView(self) |
|
|
|