nwc plugin: settings_dialog is wallet agnostic.
instead, test wallet in start_plugin. prevent plugin from using several wallets.
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user