|
|
|
@ -80,7 +80,7 @@ def get_transport(transport_string, path, **kwargs):
|
|
|
|
|
from trezorlib.transport_fake import FakeTransport
|
|
|
|
|
return FakeTransport(path, **kwargs)
|
|
|
|
|
|
|
|
|
|
raise NotImplemented("Unknown transport")
|
|
|
|
|
raise NotImplementedError("Unknown transport")
|
|
|
|
|
|
|
|
|
|
class Commands(object):
|
|
|
|
|
def __init__(self, client):
|
|
|
|
@ -88,7 +88,7 @@ class Commands(object):
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def _list_commands(cls):
|
|
|
|
|
return [ x for x in dir(cls) if not x.startswith('_') ]
|
|
|
|
|
return [x for x in dir(cls) if not x.startswith('_')]
|
|
|
|
|
|
|
|
|
|
def list(self, args):
|
|
|
|
|
# Fake method for advertising 'list' command
|
|
|
|
@ -110,7 +110,7 @@ class Commands(object):
|
|
|
|
|
return self.client.features
|
|
|
|
|
|
|
|
|
|
def list_coins(self, args):
|
|
|
|
|
return [ coin.coin_name for coin in self.client.features.coins ]
|
|
|
|
|
return [coin.coin_name for coin in self.client.features.coins]
|
|
|
|
|
|
|
|
|
|
def ping(self, args):
|
|
|
|
|
return self.client.ping(args.msg, button_protection=args.button_protection, pin_protection=args.pin_protection, passphrase_protection=args.passphrase_protection)
|
|
|
|
@ -122,11 +122,11 @@ class Commands(object):
|
|
|
|
|
def set_label(self, args):
|
|
|
|
|
return self.client.apply_settings(label=args.label)
|
|
|
|
|
|
|
|
|
|
def set_homescreen(self,args):
|
|
|
|
|
def set_homescreen(self, args):
|
|
|
|
|
if args.filename:
|
|
|
|
|
from PIL import Image
|
|
|
|
|
im = Image.open(args.filename)
|
|
|
|
|
if im.size != (128,64):
|
|
|
|
|
if im.size != (128, 64):
|
|
|
|
|
raise Exception('Wrong size of the image')
|
|
|
|
|
im = im.convert('1')
|
|
|
|
|
pix = im.load()
|
|
|
|
@ -159,11 +159,13 @@ class Commands(object):
|
|
|
|
|
if args.mnemonic:
|
|
|
|
|
mnemonic = ' '.join(args.mnemonic)
|
|
|
|
|
return self.client.load_device_by_mnemonic(mnemonic, args.pin,
|
|
|
|
|
args.passphrase_protection, args.label, 'english', args.skip_checksum)
|
|
|
|
|
|
|
|
|
|
args.passphrase_protection,
|
|
|
|
|
args.label, 'english',
|
|
|
|
|
args.skip_checksum)
|
|
|
|
|
else:
|
|
|
|
|
return self.client.load_device_by_xprv(args.xprv, args.pin,
|
|
|
|
|
args.passphrase_protection, args.label, 'english')
|
|
|
|
|
args.passphrase_protection,
|
|
|
|
|
args.label, 'english')
|
|
|
|
|
|
|
|
|
|
def reset_device(self, args):
|
|
|
|
|
return self.client.reset_device(True, args.strength, args.passphrase_protection,
|
|
|
|
@ -296,7 +298,7 @@ class Commands(object):
|
|
|
|
|
|
|
|
|
|
set_label.arguments = (
|
|
|
|
|
(('-l', '--label',), {'type': str, 'default': ''}),
|
|
|
|
|
# (('-c', '--clear'), {'action': 'store_true', 'default': False})
|
|
|
|
|
# (('-c', '--clear'), {'action': 'store_true', 'default': False})
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
set_homescreen.arguments = (
|
|
|
|
|