|
|
@ -3,7 +3,7 @@ from PyQt4.QtCore import * |
|
|
|
import PyQt4.QtCore as QtCore |
|
|
|
|
|
|
|
from electrum.i18n import _ |
|
|
|
from electrum import Wallet, Wallet_2of3 |
|
|
|
from electrum import Wallet, Wallet_2of2, Wallet_2of3 |
|
|
|
|
|
|
|
import seed_dialog |
|
|
|
from network_dialog import NetworkDialog |
|
|
@ -250,14 +250,18 @@ class InstallWizard(QDialog): |
|
|
|
gb = QGroupBox() |
|
|
|
|
|
|
|
b1 = QRadioButton(gb) |
|
|
|
b1.setText(_("Standard wallet (protected by password)")) |
|
|
|
b1.setText(_("Standard wallet")) |
|
|
|
b1.setChecked(True) |
|
|
|
|
|
|
|
b2 = QRadioButton(gb) |
|
|
|
b2.setText(_("Multi-signature wallet (two-factor authentication)")) |
|
|
|
b2.setText(_("Wallet with two-factor authentication (plugin)")) |
|
|
|
|
|
|
|
b3 = QRadioButton(gb) |
|
|
|
b3.setText(_("Multisig wallet (paired manually)")) |
|
|
|
|
|
|
|
grid.addWidget(b1,1,0) |
|
|
|
grid.addWidget(b2,2,0) |
|
|
|
grid.addWidget(b3,3,0) |
|
|
|
|
|
|
|
vbox = QVBoxLayout() |
|
|
|
|
|
|
@ -272,7 +276,9 @@ class InstallWizard(QDialog): |
|
|
|
if b1.isChecked(): |
|
|
|
return 'standard' |
|
|
|
elif b2.isChecked(): |
|
|
|
return '2of3' |
|
|
|
return 'multisig_plugin' |
|
|
|
elif b3.isChecked(): |
|
|
|
return 'multisig_manual' |
|
|
|
|
|
|
|
|
|
|
|
def run(self, action): |
|
|
@ -283,17 +289,21 @@ class InstallWizard(QDialog): |
|
|
|
if action is None: |
|
|
|
return |
|
|
|
|
|
|
|
if action == 'create': |
|
|
|
if action == 'create': |
|
|
|
t = self.choose_wallet_type() |
|
|
|
if not t: |
|
|
|
return |
|
|
|
|
|
|
|
if t == '2of3': |
|
|
|
action = 'create_cold' |
|
|
|
|
|
|
|
if t == 'multisig_plugin': |
|
|
|
action = 'create_2of3_1' |
|
|
|
if t == 'multisig_manual': |
|
|
|
action = 'create_2of2_1' |
|
|
|
|
|
|
|
if action in ['create', 'create_cold', 'create_hot', 'create_remote']: |
|
|
|
if action in ['create']: |
|
|
|
wallet = Wallet(self.storage) |
|
|
|
elif action in ['create_2of2_1','create_2of2_2']: |
|
|
|
wallet = Wallet_2of2(self.storage) |
|
|
|
|
|
|
|
|
|
|
|
if action == 'create': |
|
|
|
seed = wallet.make_seed() |
|
|
@ -304,16 +314,15 @@ class InstallWizard(QDialog): |
|
|
|
password = self.password_dialog() |
|
|
|
wallet.add_seed(seed, password) |
|
|
|
wallet.create_accounts(password) |
|
|
|
# generate first addresses offline |
|
|
|
self.waiting_dialog(wallet.synchronize) |
|
|
|
|
|
|
|
|
|
|
|
if action == 'create_cold': |
|
|
|
if action == 'create_2of3_1': |
|
|
|
run_hook('create_cold_seed', self.storage, self) |
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
if action == 'create_hot': |
|
|
|
if action in ['create_2of2_1', 'create_2of3_2']: |
|
|
|
msg = _('You are about to create the hot seed of a multisig wallet') |
|
|
|
if not self.question(msg): |
|
|
|
return |
|
|
@ -324,10 +333,22 @@ class InstallWizard(QDialog): |
|
|
|
return |
|
|
|
password = self.password_dialog() |
|
|
|
wallet.add_seed(seed, password) |
|
|
|
action = 'create_remote' |
|
|
|
if action == 'create_2of2_1': |
|
|
|
# display mpk |
|
|
|
action = 'create_2of2_2' |
|
|
|
else: |
|
|
|
action = 'create_2of3_3' |
|
|
|
|
|
|
|
if action == 'create_2of2_2': |
|
|
|
xpub = self.enter_seed_dialog(True, 'cold') |
|
|
|
if not Wallet.is_mpk(xpub): |
|
|
|
return |
|
|
|
wallet.add_master_public_key("cold/", xpub) |
|
|
|
wallet.create_account() |
|
|
|
self.waiting_dialog(wallet.synchronize) |
|
|
|
|
|
|
|
if action == 'create_remote': |
|
|
|
|
|
|
|
if action == 'create_2of3_3': |
|
|
|
run_hook('create_remote_key', wallet, self) |
|
|
|
if not wallet.master_public_keys.get("remote/"): |
|
|
|
return |
|
|
@ -352,13 +373,16 @@ class InstallWizard(QDialog): |
|
|
|
else: |
|
|
|
raise |
|
|
|
|
|
|
|
elif t in ['2of2', '2of3']: |
|
|
|
elif t in ['multisig_plugin', 'multisig_manual']: |
|
|
|
r = self.double_seed_dialog() |
|
|
|
if not r: |
|
|
|
return |
|
|
|
text1, text2 = r |
|
|
|
password = self.password_dialog() |
|
|
|
wallet = Wallet_2of3(self.storage) |
|
|
|
if t == 'multisig_manual': |
|
|
|
wallet = Wallet_2of2(self.storage) |
|
|
|
else: |
|
|
|
wallet = Wallet_2of3(self.storage) |
|
|
|
|
|
|
|
if Wallet.is_seed(text1): |
|
|
|
wallet.add_seed(text1, password) |
|
|
@ -375,9 +399,10 @@ class InstallWizard(QDialog): |
|
|
|
wallet.add_master_public_key("m/", text1) |
|
|
|
wallet.add_master_public_key("cold/", text2) |
|
|
|
|
|
|
|
run_hook('restore_third_key', wallet, self) |
|
|
|
if t == '2of3': |
|
|
|
run_hook('restore_third_key', wallet, self) |
|
|
|
|
|
|
|
wallet.create_accounts(None) |
|
|
|
wallet.create_account() |
|
|
|
|
|
|
|
else: |
|
|
|
raise |
|
|
|