本文整理汇总了Python中electrum_ltc.Wallet.init_seed方法的典型用法代码示例。如果您正苦于以下问题:Python Wallet.init_seed方法的具体用法?Python Wallet.init_seed怎么用?Python Wallet.init_seed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类electrum_ltc.Wallet
的用法示例。
在下文中一共展示了Wallet.init_seed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from electrum_ltc import Wallet [as 别名]
# 或者: from electrum_ltc.Wallet import init_seed [as 别名]
def __init__(self, config, _network):
global wallet, network
network = _network
network.register_callback('updated', update_callback)
network.register_callback('connected', update_callback)
network.register_callback('disconnected', update_callback)
network.register_callback('disconnecting', update_callback)
storage = WalletStorage(config)
if not storage.file_exists:
action = self.restore_or_create()
if not action: exit()
wallet = Wallet(storage)
if action == 'create':
wallet.init_seed(None)
self.show_seed()
wallet.save_seed(None)
wallet.synchronize() # generate first addresses offline
elif action == 'restore':
seed = self.seed_dialog()
if not seed:
exit()
wallet.init_seed(str(seed))
wallet.save_seed(None)
else:
exit()
wallet.start_threads(network)
if action == 'restore':
if not self.restore_wallet():
exit()
self.password_dialog()
else:
wallet = Wallet(storage)
wallet.start_threads(network)
示例2: run
# 需要导入模块: from electrum_ltc import Wallet [as 别名]
# 或者: from electrum_ltc.Wallet import init_seed [as 别名]
def run(self):
action = self.restore_or_create()
if not action:
return
#gap = self.config.get('gap_limit', 5)
#if gap != 5:
# wallet.gap_limit = gap
# wallet.storage.put('gap_limit', gap, True)
if action == 'create':
wallet = Wallet(self.storage)
wallet.init_seed(None)
if not self.show_seed(wallet):
return
if not self.verify_seed(wallet):
return
ok, old_password, password = self.password_dialog(wallet)
def create():
wallet.save_seed(password)
wallet.synchronize() # generate first addresses offline
self.waiting_dialog(create)
elif action == 'restore':
seed = self.seed_dialog()
if not Wallet.is_seed(seed):
return
wallet = Wallet.from_seed(seed, self.storage)
ok, old_password, password = self.password_dialog(wallet)
wallet.save_seed(password)
elif action == 'watching':
mpk = self.mpk_dialog()
if not mpk:
return
wallet = Wallet.from_mpk(mpk, self.storage)
else: raise
#if not self.config.get('server'):
if self.network:
if self.network.interfaces:
self.network_dialog()
else:
QMessageBox.information(None, _('Warning'), _('You are offline'), _('OK'))
self.network.stop()
self.network = None
# start wallet threads
wallet.start_threads(self.network)
if action == 'restore':
self.waiting_dialog(lambda: wallet.restore(self.waiting_label.setText))
if self.network:
if wallet.is_found():
QMessageBox.information(None, _('Information'), _("Recovery successful"), _('OK'))
else:
QMessageBox.information(None, _('Information'), _("No transactions found for this seed"), _('OK'))
else:
QMessageBox.information(None, _('Information'), _("This wallet was restored offline. It may contain more addresses than displayed."), _('OK'))
return wallet