wizard: add digital bitbox to new wizard
This commit is contained in:
@@ -771,3 +771,29 @@ class DigitalBitboxPlugin(HW_PluginBase):
|
||||
"echo": xpub['echo'],
|
||||
}
|
||||
self.comserver_post_notification(verify_request_payload, handler=keystore.handler)
|
||||
|
||||
# new wizard
|
||||
|
||||
def wizard_entry_for_device(self, device_info: 'DeviceInfo', *, new_wallet=True) -> str:
|
||||
if new_wallet:
|
||||
return 'dbitbox_start' if device_info.initialized else 'dbitbox_not_initialized'
|
||||
else:
|
||||
return 'dbitbox_unlock'
|
||||
|
||||
# insert trezor pages in new wallet wizard
|
||||
def extend_wizard(self, wizard: 'NewWalletWizard'):
|
||||
views = {
|
||||
'dbitbox_start': {
|
||||
'next': 'dbitbox_xpub',
|
||||
},
|
||||
'dbitbox_xpub': {
|
||||
'next': lambda d: wizard.wallet_password_view(d) if wizard.last_cosigner(d) else 'multisig_cosigner_keystore',
|
||||
'accept': wizard.maybe_master_pubkey,
|
||||
'last': lambda d: wizard.is_single_password() and wizard.last_cosigner(d)
|
||||
},
|
||||
'dbitbox_not_initialized': {},
|
||||
'dbitbox_unlock': {
|
||||
'last': True
|
||||
},
|
||||
}
|
||||
wizard.navmap_merge(views)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from functools import partial
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from electrum.i18n import _
|
||||
from electrum.plugin import hook
|
||||
@@ -7,6 +8,10 @@ from electrum.wallet import Standard_Wallet, Abstract_Wallet
|
||||
from ..hw_wallet.qt import QtHandlerBase, QtPluginBase
|
||||
from ..hw_wallet.plugin import only_hook_if_libraries_available
|
||||
from .digitalbitbox import DigitalBitboxPlugin
|
||||
from electrum.gui.qt.wizard.wallet import WCScriptAndDerivation, WCHWXPub, WCHWUninitialized, WCHWUnlock
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from electrum.gui.qt.wizard.wallet import QENewWalletWizard
|
||||
|
||||
|
||||
class Plugin(DigitalBitboxPlugin, QtPluginBase):
|
||||
@@ -38,6 +43,21 @@ class Plugin(DigitalBitboxPlugin, QtPluginBase):
|
||||
|
||||
menu.addAction(_("Show on {}").format(self.device), show_address)
|
||||
|
||||
@hook
|
||||
def init_wallet_wizard(self, wizard: 'QENewWalletWizard'):
|
||||
self.extend_wizard(wizard)
|
||||
|
||||
# insert trezor pages in new wallet wizard
|
||||
def extend_wizard(self, wizard: 'QENewWalletWizard'):
|
||||
super().extend_wizard(wizard)
|
||||
views = {
|
||||
'dbitbox_start': {'gui': WCScriptAndDerivation},
|
||||
'dbitbox_xpub': {'gui': WCHWXPub},
|
||||
'dbitbox_not_initialized': {'gui': WCHWUninitialized},
|
||||
'dbitbox_unlock': {'gui': WCHWUnlock}
|
||||
}
|
||||
wizard.navmap_merge(views)
|
||||
|
||||
|
||||
class DigitalBitbox_Handler(QtHandlerBase):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user