1
0
Commit Graph

652 Commits

Author SHA1 Message Date
f321x
e3a3b65c03 use network proxy in psbt cosigning plugin 2025-04-23 13:54:35 +02:00
Oren
2fb0dd066f Timelock Recovery Extension (#9589)
* Timelock Recovery Extension

* Timelock Recovery Extension tests

* Use fee_policy instead of fee_est

Following 3f327eea07

* making tx with base_tx

Following ab14c3e138

* move plugin metadata from __init__.py to manifest.json

* removing json large indentation

* timelock recovery icon

* timelock recovery plugin: fix typos

* timelock recovery plugin: use menu instead of status bar.

The status bar should be used for displaying status. For example,
hardware wallet plugins use it because their connection status is
changing and needs to be displayed.

* timelock recovery plugin: ask for password only once

* timelock recovery plugin: ask whether to create cancellation tx in the initial window

* remove unnecessary code.

(calling run_hook from a plugin does not make sense)

* show alert and cancellation address at the end.

skip unnecessary dialog

* timelock recovery plugin: do not show transactions one by one.

Set the fee policy in the first dialog, and use the same fee
policy for all tx. We could add 3 sliders to this dialog, if
different fees are needed, but I think this really isn't
really necessary.

* simplify default_wallet for tests

All the lightning-related stuff is irrelevant for
this plugin.

Also use a different destination address
for the test recovery-plan (an address
that does not belong to the same wallet).

* Fee selection should be above fee calculation

also show fee calculation result with "fee: " label.

* hide Sign and Broadcast buttons during view

* recalculate cancellation transaction

The checkbox could be clicked after the fee rate
has been set. Calling update_transactions() may seem
inefficient, but it's the simplest way to avoid such edge-cases.

Also set the context's cancellation transaction to None when the
checkbox is unset.

* use context.cancellation_tx instead of checkbox value

context.cancellation_tx will be None iff the checkbox was unset

* hide cancellation address if not used

* init monospace font correctly

* timelock recovery plugin: add input info at signing time.

Fixes trezor exception: 'Missing previous tx'

* timelock recovery: remove unused parameters

* avoid saving the tx in a separate var

fixing the assertions

* avoid caching recovery & cancellation inputs

* timelock recovery: separate help window from agreement.

move agreement at the end of the flow, rephrase it

* do not cache alert_tx_outputs

* do not crash when not enough funds

not enough funds can happen
when multiple addresses are specified
in payto_e, with an amount larger
than the wallet has - so we set
the payto_e color to red.

It can also happen when the user
selects a really high fee, but this
is not common in a "recovery"
wallet with significant funds.

* If files not saved - ask before closing

* move the checkbox above the save buttons

people read the text from top to
bottom and may not understand
why the buttons are disabled

---------

Co-authored-by: f321x <f321x@tutamail.com>
Co-authored-by: ThomasV <thomasv@electrum.org>
2025-04-22 10:02:01 +02:00
ThomasV
3eac741947 Merge pull request #9739 from accumulator/psbt_nostr_fixes
plugins: psbt_nostr: start processing PSBTs after wallet is_up_to_date
2025-04-17 08:34:42 +02:00
ThomasV
c0ddce4586 plugins: rename plugin nostr cosigner, minor tweaks 2025-04-16 10:08:55 +02:00
Sander van Grieken
4e9ec5d2ea plugins: psbt_nostr: exclude 2FA wallets 2025-04-16 10:05:54 +02:00
Sander van Grieken
182accb9fb plugins: psbt_nostr: move can_send_psbt logic from GUI to backend, fix qml wallet switch bug 2025-04-16 09:47:41 +02:00
Sander van Grieken
eb52090fee plugins: psbt_nostr: start processing PSBTs after wallet is_up_to_date
also don't break the receive loop when an invalid tx is received.
2025-04-16 09:13:36 +02:00
ThomasV
9d42505eec psbt_nostr: add plugin icon to txdialog button 2025-04-15 18:23:58 +02:00
ThomasV
dff1d5b0c1 Merge pull request #9694 from accumulator/qml_psbt_over_nostr
psbt_nostr: split generic and UI parts, implement for qml
2025-04-15 18:12:17 +02:00
Sander van Grieken
3b97ab7407 plugins: psbt_nostr: qt: offer 3 choices for each PSBT; 'Open, Discard, Save to wallet' 2025-04-15 17:38:11 +02:00
ThomasV
34a8ec64f8 move audio_modem icons to plugin dir, so that the plugin is self-contained.
This requires changing the API of OverlayControlMixin.addButton
2025-04-15 15:34:01 +02:00
Sander van Grieken
60bd6327ce plugins: psbt_nostr: let GUI handle a received PSBTs one by one by pausing receiving additional PSBTs until PSBT dialog is closed.
Accepting a PSBT opens the Tx dialog and pauses receiving additional PSBTs until the Tx dialog is closed.
Rejecting a PSBT will start a cooldown and accept all pending PSBTs into the history for later inspection.
2025-04-15 14:06:57 +02:00
Sander van Grieken
3ff84f08a6 plugins: psbt_nostr: implement for qml 2025-04-15 14:06:29 +02:00
Sander van Grieken
13a4076f22 plugins: psbt_nostr: split generic and UI parts 2025-04-15 14:00:36 +02:00
ThomasV
1162f45bd5 plugins: minor tweaks
- add icon to PluginDialog
 - add icon to psbt_nosr
 - rename 'PSBT Nostr' as 'Nostr Multisig'
2025-04-15 12:23:03 +02:00
ThomasV
a92e65c561 plugins: add plugin icon to menu in init_menubar 2025-04-15 10:33:14 +02:00
ThomasV
dcf632ed1e add icons for nwc and labels plugins 2025-04-15 10:23:05 +02:00
ThomasV
0831fc3b80 plugins: move wallet-related settings to the wallet menu
Plugins should use the init_menubar hook.
References are kept to the various menu objects.
2025-04-15 10:01:00 +02:00
ThomasV
8c028f7528 Add/remove plugins from GUI
- both internal and external plugins require GUI install
   (except internal HW plugins, which are 'auto-loaded' and hidden)
 - remove init_qt hook
 - in Qt, reload wallet windows if plugin enabled/disabled
 - add 'uninstall' button to PluginDialog
 - add 'add plugins' button to wizard hw screen
 - add icons to the plugin list
2025-04-15 08:35:10 +02:00
ThomasV
c93b13f6d9 Make it possible to create zip plugins from internal plugins
specifically:
 - add 'name' field to manifest.json
 - make 'version' optional in contrib/make_plugin
 - fix import in jade plugin
2025-04-14 11:54:04 +02:00
ThomasV
eff8b65355 Plugins: pass wallet to settings_dialog
Also, remove settings_widget method.
The widget should always be a button.

nwc: is_initialized -> initialized
2025-04-12 11:09:15 +02:00
ThomasV
3a18000f7a nwc plugin: settings_dialog is wallet agnostic.
instead, test wallet in start_plugin.
prevent plugin from using several wallets.
2025-04-11 20:16:59 +02:00
ThomasV
13024be4da nwc plugin: fix config key 2025-04-11 20:06:42 +02:00
ThomasV
8f3490c87e recursive config file
move plugin variables into sub dictionaries of user config
2025-04-11 19:06:48 +02:00
ThomasV
f2692b7f2d Merge pull request #9721 from spesmilo/move_hw_wallet
move hw_wallet module from plugins to electrum library
2025-04-10 12:13:42 +02:00
ThomasV
c5e9ef558f Merge pull request #9675 from f321x/nwc
plugin: implement Nostr Wallet Connect (NIP47) plugin
2025-04-10 10:58:16 +02:00
f321x
253ab6849a implement NIP47 plugin 2025-04-10 10:22:29 +02:00
ThomasV
6e087950cf move hw_wallet.py from plugins to electrum library 2025-04-10 10:19:15 +02:00
Sander van Grieken
eb29b7c95c qml: simplify QEConfig and QEDaemon use.
force QEDaemon singleton, and refer to QEDaemon.instance where possible
In cases where we would run into circular dependencies, pass the instance

also refer to singleton QEConfig instead of passing instance in qeapp.py
2025-04-09 13:44:26 +02:00
f321x
17a9a91e1f announce actual available liquidity as swap provider 2025-04-04 15:06:50 +02:00
f321x
b8d10df2dc add expiration tag to psbt nostr event and pass ssl context to relay manager 2025-04-03 13:56:29 +02:00
ThomasV
ff3e70d743 psbt_nostr: fix for watch-only wallets 2025-04-02 11:31:08 +02:00
ThomasV
6e92a00ec4 Remove zeroconf option for submarine swaps
Since we now accept random swap providers, it is unreasonable
to keep that option.
2025-03-21 18:18:27 +01:00
ThomasV
4c14711dc7 Merge pull request #9656 from SomberNight/202503_configvar_plugins
plugin ConfigVars: define vars less dynamically
2025-03-20 08:45:40 +01:00
SomberNight
245853ff4f plugins: ledger: bump max supported ledger_bitcoin version
ledger-bitcoin 0.4 was just released (seemingly without breaking changes)
the changelog claims they want to uphold semver
2025-03-19 17:29:40 +00:00
SomberNight
a99c454c00 plugin ConfigVars: enforce "key" starts with name of plugin 2025-03-19 16:49:56 +00:00
SomberNight
b132e357a3 plugin ConfigVars: define vars less dynamically
and restore ability to have different internal ConfigVar name and user-visible "key"
(Keys are hard to change as that breaks compat, but it is nice to be able to change
the internal var name, to reorganise stuff sometimes. After new ConfigVars are added,
sometimes we get better insight into how the older ones should have been named.)

follow-up https://github.com/spesmilo/electrum/pull/9648
2025-03-19 16:42:51 +00:00
ThomasV
e67cb560f6 Commands: add option documentation in docstring.
This allows plugins to document the commands they add.

The docstring is parsed as a regular expression:

    arg:<type>:<name>:<description>\n

Types are defined in commands.arg_types.

Note that this commit removes support for single letter
shortcuts in command options.

If a command is not properly documented, a warning is issued
with print(), because no logger is available at this point.
2025-03-19 13:03:38 +01:00
ThomasV
d8964a00e7 config vars for plugins 2025-03-19 11:59:05 +01:00
ThomasV
647ae49451 Merge pull request #9651 from f321x/plugin_manifest_json
Use manifest.json instead of loading init file for plugin registration
2025-03-19 10:52:02 +01:00
f321x
a9f8048251 use manifest.json instead of loading init file for plugin registration 2025-03-19 10:38:20 +01:00
SomberNight
4c970fd8fa plugins: ledger: better error msg for hw.1 2025-03-18 17:26:12 +00:00
SomberNight
154adf0081 plugins: ledger: rm support for hw.1
This removes support for Ledger HW.1 and "Nano" (non-S) devices.
These were manufactured/sold around 2015-2016, and are long unsupported by the upstream vendor.

We previously added a deprecation warning to the GUI [0] released in 4.3.3 (2023-01-02), to warn owners of these devices.
This PR now fully removes support.

As a consequence, the unmaintained btchip-python dependency can now be removed, which solves [1].

[0]: 9b82eb6d06
[1]: https://github.com/spesmilo/electrum/issues/9370#issuecomment-2593675364
2025-03-18 16:18:49 +00:00
SomberNight
7737dbf795 plugins: ledger: fix Ledger_Client_Legacy.sign_transaction
regression from 2f1095510c
2025-03-18 15:34:17 +00:00
ThomasV
38f9cac48c Merge pull request #9649 from f321x/move_commands_to_init
Move plugin commands to init file of plugin
2025-03-18 11:14:30 +01:00
f321x
e74029c880 move plugin commands to init file of plugin 2025-03-18 09:37:07 +01:00
SomberNight
c8143957a6 plugins: keepkey: rm dependence on external keepkeylib
we will instead bundle our own fork, as a git submodule,
https://github.com/spesmilo/electrum-keepkeylib

related https://github.com/spesmilo/electrum/issues/7922
and https://github.com/keepkey/python-keepkey/issues/146
(i.e. upstream keepkeylib is unmaintained)
2025-03-17 17:53:48 +00:00
ThomasV
9d1ffe0c37 support for arguments to plugin commands:
- add a simple parser that only figures out where the config is,
   and does not complain if args are unknown
2025-03-16 15:01:22 +01:00
ThomasV
d2fa404e06 plugin commands: load the plugin in func_wrapper 2025-03-16 12:26:31 +01:00
ThomasV
a474b8674d plugin commands:
- make plugin commands start with plugin name + underscore
 - plugin_name must be passed to the plugin_command decorator
 - fixes:
    - remove plugin_commands (unneeded)
    - func_wrapper must await func()
    - setattr(Commands, name, func_wrapper)
 - add push/pull commands to labels plugin
2025-03-16 11:53:34 +01:00