qml QEChannelDetails: add some type hints
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import threading
|
||||
from enum import IntEnum
|
||||
from typing import Optional, TYPE_CHECKING
|
||||
|
||||
from PyQt6.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject, pyqtEnum
|
||||
|
||||
@@ -7,7 +8,7 @@ from electrum.i18n import _
|
||||
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.lnchannel import ChanCloseOption, ChannelState, AbstractChannel, Channel
|
||||
from electrum.util import format_short_id
|
||||
|
||||
from .auth import AuthMixin, auth_protect
|
||||
@@ -33,9 +34,9 @@ class QEChannelDetails(AuthMixin, QObject, QtEventListener):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
self._wallet = None
|
||||
self._channelid = None
|
||||
self._channel = None
|
||||
self._wallet = None # type: Optional[QEWallet]
|
||||
self._channelid = None # type: Optional[str]
|
||||
self._channel = None # type: Optional[AbstractChannel]
|
||||
|
||||
self._capacity = QEAmount()
|
||||
self._local_capacity = QEAmount()
|
||||
|
||||
@@ -290,6 +290,12 @@ class AbstractChannel(Logger, ABC):
|
||||
def is_backup(self):
|
||||
return False
|
||||
|
||||
def get_local_scid_alias(self, *, create_new_if_needed: bool = False) -> Optional[bytes]:
|
||||
return None
|
||||
|
||||
def get_remote_scid_alias(self) -> Optional[bytes]:
|
||||
return None
|
||||
|
||||
def sweep_ctx(self, ctx: Transaction) -> Dict[str, SweepInfo]:
|
||||
txid = ctx.txid()
|
||||
if self._sweep_info.get(txid) is None:
|
||||
@@ -468,6 +474,10 @@ class AbstractChannel(Logger, ABC):
|
||||
"""Returns channel capacity in satoshis, or None if unknown."""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def can_be_deleted(self) -> bool:
|
||||
pass
|
||||
|
||||
|
||||
class ChannelBackup(AbstractChannel):
|
||||
"""
|
||||
@@ -558,12 +568,6 @@ class ChannelBackup(AbstractChannel):
|
||||
def is_backup(self):
|
||||
return True
|
||||
|
||||
def get_local_scid_alias(self, *, create_new_if_needed: bool = False) -> Optional[bytes]:
|
||||
return None
|
||||
|
||||
def get_remote_scid_alias(self) -> Optional[bytes]:
|
||||
return None
|
||||
|
||||
def create_sweeptxs_for_their_ctx(self, ctx):
|
||||
return {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user