From 7fdf1e06696f464959ac4cf1a1e101114bc865ba Mon Sep 17 00:00:00 2001 From: ThomasV Date: Sat, 19 Oct 2024 13:40:18 +0200 Subject: [PATCH] add nostr, and nostr_relays in config --- contrib/requirements/requirements.txt | 1 + electrum/gui/qt/settings_dialog.py | 8 ++++++++ electrum/simple_config.py | 12 ++++++++++++ 3 files changed, 21 insertions(+) diff --git a/contrib/requirements/requirements.txt b/contrib/requirements/requirements.txt index 8ccf307b3..d3d9e3f8b 100644 --- a/contrib/requirements/requirements.txt +++ b/contrib/requirements/requirements.txt @@ -8,6 +8,7 @@ certifi attrs>=20.1.0 jsonpatch electrum_ecc +electrum_aionostr>=0.0.6 # Note that we also need the dnspython[DNSSEC] extra which pulls in cryptography, # but as that is not pure-python it cannot be listed in this file! diff --git a/electrum/gui/qt/settings_dialog.py b/electrum/gui/qt/settings_dialog.py index 7f1fedbb1..84cabe20b 100644 --- a/electrum/gui/qt/settings_dialog.py +++ b/electrum/gui/qt/settings_dialog.py @@ -194,6 +194,13 @@ class SettingsDialog(QDialog, QtEventListener): self.set_alias_color() self.alias_e.editingFinished.connect(self.on_alias_edit) + nostr_relays_label = HelpLabel.from_configvar(self.config.cv.NOSTR_RELAYS) + nostr_relays = self.config.NOSTR_RELAYS + self.nostr_relays_e = QLineEdit(nostr_relays) + def on_nostr_edit(): + self.config.NOSTR_RELAYS = str(self.nostr_relays_e.text()) + self.nostr_relays_e.editingFinished.connect(on_nostr_edit) + msat_cb = checkbox_from_configvar(self.config.cv.BTC_AMOUNTS_PREC_POST_SAT) msat_cb.setChecked(self.config.BTC_AMOUNTS_PREC_POST_SAT > 0) def on_msat_checked(_x): @@ -392,6 +399,7 @@ class SettingsDialog(QDialog, QtEventListener): misc_widgets = [] misc_widgets.append((updatecheck_cb, None)) misc_widgets.append((filelogging_cb, None)) + misc_widgets.append((nostr_relays_label, self.nostr_relays_e)) misc_widgets.append((alias_label, self.alias_e)) misc_widgets.append((qr_label, qr_combo)) diff --git a/electrum/simple_config.py b/electrum/simple_config.py index 1c1d17d3f..92645b66e 100644 --- a/electrum/simple_config.py +++ b/electrum/simple_config.py @@ -1207,6 +1207,18 @@ Warning: setting this to too low will result in lots of payment failures."""), SWAPSERVER_FEE_MILLIONTHS = ConfigVar('swapserver_fee_millionths', default=5000, type_=int) TEST_SWAPSERVER_REFUND = ConfigVar('test_swapserver_refund', default=False, type_=bool) + # nostr + NOSTR_RELAYS = ConfigVar( + 'nostr_relays', + default='wss://relay.damus.io,wss://brb.io,wss://nostr.mom', + type_=str, + short_desc=lambda: _("Nostr relays"), + long_desc=lambda: ' '.join([ + _('Nostr relays are used to send and receive submarine swap offers'), + _('If this list is empty, Electrum will use http instead'), + ]), + ) + # zeroconf channels ACCEPT_ZEROCONF_CHANNELS = ConfigVar('accept_zeroconf_channels', default=False, type_=bool) ZEROCONF_TRUSTED_NODE = ConfigVar('zeroconf_trusted_node', default='', type_=str)