Commit Graph

353 Commits

Author SHA1 Message Date
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 92b03d827c cmdline: suppress the display of global options when displaying the help of a command 2025-03-19 12:17:18 +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
ThomasV 26910ef81d Merge pull request #9620 from accumulator/lightning_pass_invoice_not_bolt11
refactor lnworker.pay_invoice to accept Invoice object instead of bolt11 string
2025-03-18 20:09:01 +01:00
f321x e74029c880 move plugin commands to init file of plugin 2025-03-18 09:37:07 +01:00
ThomasV 58be5a3ad5 Allow wallets to use non-deterministic lightning,
if they use a software keystore.

This excludes hardware wallets and watching-only wallet.
Also, this forbids creation of new channels in those wallets,
in case lightning was previously enabled.

Fixes #9440
2025-03-17 09:51:52 +01: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
ThomasV cb39737a39 Plugins call with cmd_only:
- pass temporary config to Plugins
 - load only enabled plugins
 - parse the command line again after plugins are loaded
2025-03-15 13:31:00 +01:00
f321x ae64583ebc add handling of plugin commands 2025-03-15 13:22:28 +01:00
SomberNight 2763e14bb3 commands: payto can just call paytomany 2025-03-14 17:38:45 +00:00
SomberNight 977d8b1dd6 wallet: kill create_transaction 2025-03-14 17:19:41 +00:00
SomberNight 4689a0e78c wallet: towards killing create_transaction: rm "coins" logic 2025-03-14 17:14:59 +00:00
SomberNight cab1dc5c29 wallet: towards killing create_transaction: pass through "locktime", "version" 2025-03-14 17:03:49 +00:00
SomberNight 3c3778db9c wallet: towards killing create_transaction: rm "sign" arg 2025-03-14 16:44:46 +00:00
Sander van Grieken 6fdb6c93f7 refactor lnworker.pay_invoice to accept Invoice object instead of bolt11 string
rename lnworker._check_invoice to lnworker._check_bolt11_invoice
2025-03-09 14:47:34 +01:00
ThomasV 840243e029 separate fee policy from config
- Wallet.make_unsigned_transaction takes a FeePolicy parameter
 - fee sliders act on a FeePolicy instead of config
 - different fee policies may be used for different purposes
 - do not detect dust outputs in lnsweep, delegate that to lnwatcher
2025-03-05 10:29:26 +01:00
ThomasV 96d0dad41c gossip: less log lines, use command line instead 2025-03-04 14:33:54 +01:00
ThomasV 3d2531cb93 reintroduce separate request types for lightning and onchain
cmdline: add_request has a --lightning option
2025-02-25 11:27:32 +01:00
ThomasV ea4adbb4d6 Merge pull request #9573 from f321x/simplify_subswap_fee
Simplify submarine swap onchain fee model to single base fee 'mining_fee'
2025-02-20 18:42:56 +01:00
f321x 6f97b7b5f9 simplify submarine swap onchain fee model to single base fee 2025-02-20 16:51:48 +01:00
Sander van Grieken 6e35ffe4b5 lnmsg: support both primitive and complex types (subtypes) in LNSerializer.
This renames lnmsg._{read,write}_field to lnmsg._{read,write}_primitive_field, renames
LNSerializer._{read,write}_complex_type to LNSerializer.{read,write}_field and allows
LNSerializer.{read,write}_field to handle both primitive and complex types.

Also makes these funcs public, as these encodings are used outside of lnmsg as well
(e.g. encoding blinded paths in BOLT12 invoice_request)
2025-02-19 14:29:50 +01:00
ThomasV a157108e75 onion_messages: fix code indentation 2025-02-19 14:29:34 +01:00
Sander van Grieken 7109c22317 unasync, no add_peer in create_onion_message_route_to, add manager tests 2025-02-19 14:29:34 +01:00
Sander van Grieken 7b4180202a add onion message support 2025-02-19 14:29:02 +01:00
ThomasV 392c219913 simplify history-related commands:
- reduce number of methods
 - use nametuples instead of dicts
 - only two types: OnchainHistoryItem and LightningHistoryItem
 - channel open/closes are groups
 - move capital gains into separate RPC
2025-02-19 11:40:21 +01:00
Sander van Grieken 19cd408f98 organize import, whitespace 2025-01-23 12:58:28 +01:00
ThomasV f23971660e simplify helpconfig
Co-authored-by: ghost43 <somber.night@protonmail.com>
2025-01-17 14:40:33 +01:00
ThomasV aacc6a9dd6 cmdline: add listconfig/helpconfig 2025-01-17 11:27:34 +01:00
ThomasV 29a8c41025 move watchtower to a plugin.
remove watchtower dialog in qt
2024-12-20 15:34:26 +01:00
ThomasV 81baaa52cd CLI: raise UserFacingException when passed unknown channel point. fixes #9326 2024-11-29 10:38:57 +01:00
ThomasV 60f13a977e Swaps over Nostr
- Separation between SwapManager and its transport:
   Legacy transpport uses http, Nostr uses websockets
 - The transport uses a context to open/close connections.
   This context is not async, because it needs to be called
   from the GUI
 - Swapserver fees values are initialized to None instead
   of 0, so that any attempt to use them before the swap
   manager is initialized will raise an exception.
 - Remove swapserver fees disk caching (swap_pairs file)
 - Regtests use http transport
 - Android uses http transport (until QML is ready)
2024-11-12 09:32:25 +01:00
ThomasV c58c4d7451 Make lntransport not require lnutil.
This will be useful if we decide to ship lntransport as a separate
package. It is also a conceptual cleanup.

Notes:
 - lntransport still requires crypto.py
 - parsing node id from a bolt11 invoice is not supported.
2024-10-22 09:26:36 +02:00
ThomasV 3721f04ac8 replace electrum/ecc with electrum_ecc package 2024-10-10 15:46:00 +00:00
ThomasV 6006971ab7 rm deprecated helptext from old swap protocol 2024-10-10 15:21:40 +02:00
ghost43 acc839623f Merge pull request #9238 from accumulator/issue9236
commands: require wallet password for lnpay command

closes https://github.com/spesmilo/electrum/issues/9236
2024-10-10 00:40:04 +00:00
Sander van Grieken c191fbec29 cli: require password for close_channel, request_force_close, export_channel_backup, reverse_swap, rebalance_channels 2024-10-09 18:04:26 +02:00
Sander van Grieken b209d09c1e commands: require wallet password for lnpay, get_channel_ctx commands 2024-10-09 11:21:16 +02:00
ghost43 8c9263fb20 Merge pull request #7154 from SomberNight/202103_cmd_importprivkey
commands: extend "importprivkey" to allow importing a list of keys
2024-10-08 16:52:14 +00:00
SomberNight 37d090c621 commands: check password already in decorator
Previously it was only the actual commands that directly or indirectly verified
the password. This adds a check that runs for any command requiring a password.

related https://github.com/spesmilo/electrum/pull/9238
2024-10-08 15:15:42 +00:00
SomberNight d35ed6935d commands: extend "importprivkey" to allow importing a list of keys
This is most useful if the user wants to import a significant number of keys,
as every invocation of `importprivkey` results in rewriting the wallet file to disk.

The API of "importprivkey" is left unchanged for the single privkey case.
2024-10-08 14:11:19 +02:00
wakiyamap 1d9ff40d0b Add suport testnet4 2024-09-14 03:52:03 +09:00
ThomasV 2f3d89f415 prepare for separation of ecc module:
- move encrypt/sign functions elsewhere
- remove local dependencies in ecc.py, ecc_fast.py (except logging)
2024-06-17 13:05:57 +02:00
ThomasV 912e1a3a5b reintroduce 'unlock' command
- the unlock command was replaced by an option to load_wallet,
because some applications (the swapserver plugin) need to be
executed with an unlocked password. Now the swapserver plugin
waits until the wallet is unlocked.
- wallet.unlock now checks password unconditionally, see #8799
2024-06-08 11:10:33 +02:00
SomberNight 1705e47a88 commands: add comment to load_wallet re "unlock" quirk 2024-06-07 16:26:09 +00:00
SomberNight 13d9677e53 transaction: tx.sign API change: rm hex usage 2024-04-29 17:10:30 +00:00
SomberNight 2f1095510c bitcoin.py/transaction.py: API changes: rm most hex usage
Instead of some functions operating with hex strings,
and others using bytes, this consolidates most things to use bytes.

This mainly focuses on bitcoin.py and transaction.py,
and then adapts the API usages in other files.

Notably,
- scripts,
- pubkeys,
- signatures
should be bytes in almost all places now.
2024-04-29 17:10:26 +00:00
SomberNight bd9d0ccc33 ecc: refactor/clean-up sign/verify APIs 2024-04-11 15:25:45 +00:00