1
0

nwc plugin: settings_dialog is wallet agnostic.

instead, test wallet in start_plugin.
prevent plugin from using several wallets.
This commit is contained in:
ThomasV
2025-04-11 20:15:16 +02:00
parent 13024be4da
commit 3a18000f7a
2 changed files with 5 additions and 6 deletions

View File

@@ -42,6 +42,11 @@ class NWCServerPlugin(BasePlugin):
self.logger.debug(f"NWCServerPlugin created, waiting for wallet to load...")
def start_plugin(self, wallet: 'Abstract_Wallet'):
if not wallet.has_lightning():
return
if self.is_initialized:
# this might be called for several wallets. only use one.
return
storage = self.get_plugin_storage(wallet)
self.connections = storage['connections']
self.delete_expired_connections()

View File

@@ -43,12 +43,6 @@ class Plugin(NWCServerPlugin):
partial(self.settings_dialog, window))
def settings_dialog(self, window: WindowModalDialog):
wallet: 'Abstract_Wallet' = window.parent().wallet
if not wallet.has_lightning():
window.show_error(_("{} plugin requires a lightning enabled wallet. Setup lightning first.")
.format("NWC"))
return
d = WindowModalDialog(window, _("Nostr Wallet Connect"))
main_layout = QVBoxLayout(d)