1
0

generic restore from command line

This commit is contained in:
ThomasV
2015-10-27 14:33:41 +01:00
parent 614f3df4b8
commit 26682491b2
4 changed files with 59 additions and 65 deletions

View File

@@ -2085,3 +2085,24 @@ class Wallet(object):
self.storage.put('use_encryption', self.use_encryption, True)
self.create_main_account(password)
return self
@classmethod
def from_text(klass, text, password_dialog, storage):
if Wallet.is_xprv(text):
password = password_dialog()
wallet = klass.from_xprv(text, password, storage)
elif Wallet.is_old_mpk(text):
wallet = klass.from_old_mpk(text, storage)
elif Wallet.is_xpub(text):
wallet = klass.from_xpub(text, storage)
elif Wallet.is_address(text):
wallet = klass.from_address(text, storage)
elif Wallet.is_private_key(text):
password = password_dialog()
wallet = klass.from_private_key(text, password, storage)
elif Wallet.is_seed(text):
password = password_dialog()
wallet = klass.from_seed(text, password, storage)
else:
raise BaseException('Invalid seedphrase or key')
return wallet