- 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
23 lines
729 B
Python
23 lines
729 B
Python
from electrum.commands import plugin_command
|
|
from typing import TYPE_CHECKING
|
|
|
|
if TYPE_CHECKING:
|
|
from .labels import LabelsPlugin
|
|
from electrum.commands import Commands
|
|
|
|
plugin_name = "labels"
|
|
|
|
@plugin_command('w', plugin_name)
|
|
async def push(self: 'Commands', wallet=None) -> int:
|
|
""" push labels to server """
|
|
plugin: 'LabelsPlugin' = self.daemon._plugins.get_plugin(plugin_name)
|
|
return await plugin.push_thread(wallet)
|
|
|
|
|
|
@plugin_command('w', plugin_name)
|
|
async def pull(self: 'Commands', wallet=None) -> int:
|
|
""" pull labels from server """
|
|
assert wallet is not None
|
|
plugin: 'LabelsPlugin' = self.daemon._plugins.get_plugin(plugin_name)
|
|
return await plugin.pull_thread(wallet, force=False)
|