mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-03 02:35:20 +00:00
ledger: cmdline plugin
This commit is contained in:
parent
ddae2516c1
commit
d8e65782e1
2 changed files with 28 additions and 24 deletions
28
plugins/ledger/cmdline.py
Normal file
28
plugins/ledger/cmdline.py
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
from legder import LedgerPlugin
|
||||||
|
from electrum.util import print_msg
|
||||||
|
from electrum.plugins import hook
|
||||||
|
|
||||||
|
class BTChipCmdLineHandler:
|
||||||
|
def stop(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def show_message(self, msg):
|
||||||
|
print_msg(msg)
|
||||||
|
|
||||||
|
def prompt_auth(self, msg):
|
||||||
|
import getpass
|
||||||
|
print_msg(msg)
|
||||||
|
response = getpass.getpass('')
|
||||||
|
if len(response) == 0:
|
||||||
|
return None
|
||||||
|
return response
|
||||||
|
|
||||||
|
class Plugin(LedgerPlugin):
|
||||||
|
@hook
|
||||||
|
def cmdline_load_wallet(self, wallet):
|
||||||
|
self.wallet = wallet
|
||||||
|
self.wallet.plugin = self
|
||||||
|
if self.handler is None:
|
||||||
|
self.handler = BTChipCmdLineHandler()
|
||||||
|
|
||||||
|
|
|
@ -496,27 +496,3 @@ class LedgerPlugin(BasePlugin):
|
||||||
tx.error = str(e)
|
tx.error = str(e)
|
||||||
|
|
||||||
|
|
||||||
class CmdlinePlugin(LedgerPlugin):
|
|
||||||
@hook
|
|
||||||
def cmdline_load_wallet(self, wallet):
|
|
||||||
self.wallet = wallet
|
|
||||||
self.wallet.plugin = self
|
|
||||||
if self.handler is None:
|
|
||||||
self.handler = BTChipCmdLineHandler()
|
|
||||||
|
|
||||||
|
|
||||||
class BTChipCmdLineHandler:
|
|
||||||
|
|
||||||
def stop(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def show_message(self, msg):
|
|
||||||
print_msg(msg)
|
|
||||||
|
|
||||||
def prompt_auth(self, msg):
|
|
||||||
import getpass
|
|
||||||
print_msg(msg)
|
|
||||||
response = getpass.getpass('')
|
|
||||||
if len(response) == 0:
|
|
||||||
return None
|
|
||||||
return response
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue