refactor: split watched classes into new file

This commit is contained in:
tecnovert
2025-12-25 13:13:46 +02:00
parent b6af5ee93d
commit 6fd324ec9f
2 changed files with 52 additions and 31 deletions

View File

@@ -72,6 +72,7 @@ from .db_util import remove_expired_data
from .http_server import HttpThread
from .rpc import escape_rpcauth
from .rpc_xmr import make_xmr_rpc2_func
from .types import WatchedTransaction, WatchedScript, WatchedOutput
from .ui.app import UIApp
from .ui.util import getCoinName
from .util import (
@@ -287,37 +288,6 @@ def threadPollChainState(swap_client, coin_type):
swap_client.chainstate_delay_event.wait(random.randrange(*poll_delay_range))
class WatchedOutput: # Watch for spends
__slots__ = ("bid_id", "txid_hex", "vout", "tx_type", "swap_type")
def __init__(self, bid_id: bytes, txid_hex: str, vout, tx_type, swap_type):
self.bid_id = bid_id
self.txid_hex = txid_hex
self.vout = vout
self.tx_type = tx_type
self.swap_type = swap_type
class WatchedScript: # Watch for txns containing outputs
__slots__ = ("bid_id", "script", "tx_type", "swap_type")
def __init__(self, bid_id: bytes, script: bytes, tx_type, swap_type):
self.bid_id = bid_id
self.script = script
self.tx_type = tx_type
self.swap_type = swap_type
class WatchedTransaction:
# TODO
# Watch for presence in mempool (getrawtransaction)
def __init__(self, bid_id: bytes, txid_hex: str, tx_type, swap_type):
self.bid_id = bid_id
self.txid_hex = txid_hex
self.tx_type = tx_type
self.swap_type = swap_type
class BasicSwap(BaseApp, BSXNetwork, UIApp):
ws_server = None
protocolInterfaces = {