|
|
@ -439,99 +439,16 @@ class InstallWizard(QDialog): |
|
|
|
wallet = Wallet.from_private_key(text, password, self.storage) |
|
|
|
elif Wallet.is_seed(text): |
|
|
|
password = self.password_dialog() |
|
|
|
wallet = Wallet.from_seed(text, self.storage) |
|
|
|
wallet.add_seed(text, password) |
|
|
|
wallet.create_master_keys(password) |
|
|
|
wallet.create_main_account(password) |
|
|
|
wallet = Wallet.from_seed(text, password, self.storage) |
|
|
|
else: |
|
|
|
raise BaseException('unknown wallet type') |
|
|
|
|
|
|
|
elif t in ['2of2']: |
|
|
|
r = self.multi_seed_dialog(1) |
|
|
|
if not r: |
|
|
|
elif t in ['2of2', '2of3']: |
|
|
|
key_list = self.multi_seed_dialog(1 if t == '2of2' else 2) |
|
|
|
if not key_list: |
|
|
|
return |
|
|
|
text1, text2 = r |
|
|
|
wallet = Wallet_2of2(self.storage) |
|
|
|
if (Wallet.is_seed(text1) or Wallet.is_seed(text2) or |
|
|
|
Wallet.is_xprv(text1) or Wallet.is_xprv(text2)): |
|
|
|
password = self.password_dialog() |
|
|
|
else: |
|
|
|
password = None |
|
|
|
|
|
|
|
if (Wallet.is_seed(text2) or Wallet.is_xprv(text2)) and Wallet.is_xpub(text1): |
|
|
|
c = text1 |
|
|
|
text1 = text2 |
|
|
|
text2 = c |
|
|
|
|
|
|
|
if Wallet.is_seed(text1): |
|
|
|
wallet.add_seed(text1, password) |
|
|
|
wallet.create_master_keys(password) |
|
|
|
elif Wallet.is_xprv(text1): |
|
|
|
xpub = bitcoin.xpub_from_xprv(text1) |
|
|
|
wallet.add_master_public_key(wallet.root_name, xpub) |
|
|
|
wallet.add_master_private_key(wallet.root_name, text1, password) |
|
|
|
else: |
|
|
|
wallet.add_master_public_key("x1/", text1) |
|
|
|
|
|
|
|
if Wallet.is_seed(text2): |
|
|
|
wallet.add_cosigner_seed(text2, "x2/", password) |
|
|
|
elif Wallet.is_xpub(text2): |
|
|
|
wallet.add_master_public_key("x2/", text2) |
|
|
|
|
|
|
|
wallet.create_main_account(password) |
|
|
|
|
|
|
|
|
|
|
|
elif t in ['2of3']: |
|
|
|
r = self.multi_seed_dialog(2) |
|
|
|
if not r: |
|
|
|
return |
|
|
|
text1, text2, text3 = r |
|
|
|
wallet = Wallet_2of3(self.storage) |
|
|
|
if (Wallet.is_seed(text1) or Wallet.is_seed(text2) or Wallet.is_seed(text3) or |
|
|
|
Wallet.is_xprv(text1) or Wallet.is_xprv(text2) or Wallet.is_xprv(text3)): |
|
|
|
password = self.password_dialog() |
|
|
|
else: |
|
|
|
password = None |
|
|
|
|
|
|
|
if Wallet.is_xpub(text1) and (Wallet.is_seed(text2) or Wallet.is_xprv(text2)): |
|
|
|
temp = text1 |
|
|
|
text1 = text2 |
|
|
|
text2 = temp |
|
|
|
|
|
|
|
if Wallet.is_xpub(text1) and (Wallet.is_seed(text3) or Wallet.is_xprv(text3)): |
|
|
|
temp = text1 |
|
|
|
text1 = text3 |
|
|
|
text3 = temp |
|
|
|
|
|
|
|
if Wallet.is_seed(text1): |
|
|
|
wallet.add_seed(text1, password) |
|
|
|
wallet.create_master_keys(password) |
|
|
|
elif Wallet.is_xprv(text1): |
|
|
|
xpub = bitcoin.xpub_from_xprv(text1) |
|
|
|
wallet.add_master_public_key(wallet.root_name, xpub) |
|
|
|
wallet.add_master_private_key(wallet.root_name, text1, password) |
|
|
|
else: |
|
|
|
wallet.add_master_public_key("x1/", text1) |
|
|
|
|
|
|
|
if Wallet.is_seed(text2): |
|
|
|
wallet.add_cosigner_seed(text2, "x2/", password) |
|
|
|
elif Wallet.is_xprv(text2): |
|
|
|
xpub = bitcoin.xpub_from_xprv(text2) |
|
|
|
wallet.add_master_public_key(wallet.root_name, xpub) |
|
|
|
wallet.add_master_private_key(wallet.root_name, text2, password) |
|
|
|
elif Wallet.is_xpub(text2): |
|
|
|
wallet.add_master_public_key("x2/", text2) |
|
|
|
|
|
|
|
if Wallet.is_seed(text3): |
|
|
|
wallet.add_cosigner_seed(text3, "x3/", password) |
|
|
|
elif Wallet.is_xprv(text3): |
|
|
|
xpub = bitcoin.xpub_from_xprv(text3) |
|
|
|
wallet.add_master_public_key(wallet.root_name, xpub) |
|
|
|
wallet.add_master_private_key(wallet.root_name, text3, password) |
|
|
|
elif Wallet.is_xpub(text3): |
|
|
|
wallet.add_master_public_key("x3/", text3) |
|
|
|
|
|
|
|
wallet.create_main_account(password) |
|
|
|
password = self.password_dialog() if any(map(lambda x: Wallet.is_seed(x) or Wallet.is_xprv(x), key_list)) else None |
|
|
|
wallet = Wallet.from_multisig(key_list, password, self.storage) |
|
|
|
|
|
|
|
else: |
|
|
|
self.storage.put('wallet_type', t) |
|
|
|