async def menu(self, show_screen, show_all=False): net = NETWORKS[self.network] buttons = [ (None, "Recommended"), ("m/84h/%dh/0h" % net["bip32"], "Single key"), ("m/48h/%dh/0h/2h" % net["bip32"], "Multisig"), (None, "Other keys"), ] if show_all: coin = net["bip32"] buttons += [ ("m/84h/%dh/0h" % coin, "Single Native Segwit\nm/84h/%dh/0h" % coin), ("m/49h/%dh/0h" % coin, "Single Nested Segwit\nm/49h/%dh/0h" % coin), ( "m/48h/%dh/0h/2h" % coin, "Multisig Native Segwit\nm/48h/%dh/0h/2h" % coin, ), ( "m/48h/%dh/0h/1h" % coin, "Multisig Nested Segwit\nm/48h/%dh/0h/1h" % coin, ), ] else: buttons += [(0, "Show more keys"), (1, "Enter custom derivation")] # wait for menu selection menuitem = await show_screen(Menu(buttons, last=(255, None))) # process the menu button: # back button if menuitem == 255: return False elif menuitem == 0: return await self.menu(show_screen, show_all=True) elif menuitem == 1: der = await show_screen(DerivationScreen()) if der is not None: await self.show_xpub(der, show_screen) return True else: await self.show_xpub(menuitem, show_screen) return True return False
async def menu(self, show_screen, show_all=False): net = NETWORKS[self.network] coin = net["bip32"] if not show_all: buttons = [ (None, "Recommended"), ("m/84h/%dh/%dh" % (coin, self.account), "Single key"), ("m/48h/%dh/%dh/2h" % (coin, self.account), "Multisig"), (None, "Other keys"), (0, "Show more keys"), (2, "Change account number"), (1, "Enter custom derivation"), (3, "Export all keys to SD"), ] else: buttons = [ (None, "Recommended"), ( "m/84h/%dh/%dh" % (coin, self.account), "Single Native Segwit\nm/84h/%dh/%dh" % (coin, self.account) ), ( "m/48h/%dh/%dh/2h" % (coin, self.account), "Multisig Native Segwit\nm/48h/%dh/%dh/2h" % (coin, self.account), ), (None, "Other keys"), ] if self.is_taproot_enabled: buttons.append(( "m/86h/%dh/%dh" % (coin, self.account), "Single Taproot\nm/86h/%dh/%dh" % (coin, self.account) )) buttons.extend([ ( "m/49h/%dh/%dh" % (coin, self.account), "Single Nested Segwit\nm/49h/%dh/%dh" % (coin, self.account) ), ( "m/48h/%dh/%dh/1h" % (coin, self.account), "Multisig Nested Segwit\nm/48h/%dh/%dh/1h" % (coin, self.account), ), ]) # wait for menu selection menuitem = await show_screen(Menu(buttons, last=(255, None), title="Select the key", note="Current account number: %d" % self.account)) # process the menu button: # back button if menuitem == 255: return False elif menuitem == 0: return await self.menu(show_screen, show_all=True) elif menuitem == 1: der = await show_screen(DerivationScreen()) if der is not None: await self.show_xpub(der, show_screen) return True elif menuitem == 3: file_format = await self.save_menu(show_screen) if file_format: filename = self.save_all_to_sd(file_format) await show_screen( Alert("Saved!", "Public keys are saved to the file:\n\n%s" % filename, button_text="Close") ) elif menuitem == 2: account = await show_screen(NumericScreen(current_val=str(self.account))) if account and int(account) > 0x80000000: raise AppError('Account number too large') try: self.account = int(account) except: self.account = 0 return await self.menu(show_screen) else: await self.show_xpub(menuitem, show_screen) return True return False
async def menu(self, show_screen, show_all=False): net = NETWORKS[self.network] coin = net["bip32"] buttons = [ (None, "Recommended"), ("m/84h/%dh/%dh" % (coin, self.account), "Single key"), ("m/48h/%dh/%dh/2h" % (coin, self.account), "Multisig"), (None, "Other keys"), ] if show_all: buttons += [ ("m/84h/%dh/%dh" % (coin, self.account), "Single Native Segwit\nm/84h/%dh/%dh" % (coin, self.account)), ("m/49h/%dh/%dh" % (coin, self.account), "Single Nested Segwit\nm/49h/%dh/%dh" % (coin, self.account)), ( "m/48h/%dh/%dh/2h" % (coin, self.account), "Multisig Native Segwit\nm/48h/%dh/%dh/2h" % (coin, self.account), ), ( "m/48h/%dh/%dh/1h" % (coin, self.account), "Multisig Nested Segwit\nm/48h/%dh/%dh/1h" % (coin, self.account), ), ] else: buttons += [(0, "Show more keys"), (2, "Change account number"), (1, "Enter custom derivation")] # wait for menu selection menuitem = await show_screen( Menu(buttons, last=(255, None), title="Select the key", note="Current account number: %d" % self.account)) # process the menu button: # back button if menuitem == 255: return False elif menuitem == 0: return await self.menu(show_screen, show_all=True) elif menuitem == 1: der = await show_screen(DerivationScreen()) if der is not None: await self.show_xpub(der, show_screen) return True elif menuitem == 2: account = await show_screen( NumericScreen(current_val=str(self.account))) if account and int(account) > 0x80000000: raise AppError('Account number too large') try: self.account = int(account) except: self.account = 0 return await self.menu(show_screen) else: await self.show_xpub(menuitem, show_screen) return True return False