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
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()
if b1.isChecked():
return 'standard'
elif b2.isChecked():
- return '2of3'
+ return 'multisig_plugin'
+ elif b3.isChecked():
+ return 'multisig_manual'
def run(self, action):
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()
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
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
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)
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
def can_create_accounts(self):
return False
- def create_account(self, account_id):
- """Creates and saves the master keys, but does not save the account"""
+ def create_account(self):
xpub1 = self.master_public_keys.get("m/")
xpub2 = self.master_public_keys.get("cold/")
account = BIP32_Account_2of2({'xpub':xpub1, 'xpub2':xpub2})
xpub2 = self.master_public_keys.get("cold/")
return {'hot':xpub1, 'cold':xpub2}
+ def get_action(self):
+ xpub1 = self.master_public_keys.get("m/")
+ xpub2 = self.master_public_keys.get("cold/")
+ if xpub1 is None:
+ return 'create_2of2_1'
+ if xpub2 is None:
+ return 'create_2of2_2'
xpub2 = self.master_public_keys.get("cold/")
xpub3 = self.master_public_keys.get("remote/")
if xpub2 is None:
- return 'create_cold'
+ return 'create_2of3_1'
if xpub1 is None:
- return 'create_hot'
+ return 'create_2of3_2'
if xpub3 is None:
- return 'create_remote'
+ return 'create_2of3_3'
class WalletSynchronizer(threading.Thread):