Merge branch 'SeedSigner:dev' into dev

This commit is contained in:
ValueOverflow
2023-02-16 10:10:53 -05:00
committed by GitHub
13 changed files with 34 additions and 26 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -18,7 +18,7 @@ from ..components import BaseComponent, Button, GUIConstants, Fonts, IconButton,
@dataclass
class ScanScreen(BaseScreen):
decoder: DecodeQR = None
instructions_text: str = "Scan a QR code"
instructions_text: str = "< back | Scan a QR code"
resolution: Tuple[int,int] = (480, 480)
framerate: int = 12
render_rect: Tuple[int,int,int,int] = None
+6 -1
View File
@@ -365,7 +365,12 @@ class SettingsDefinition:
display_name="Coordinator software",
type=SettingsConstants.TYPE__MULTISELECT,
selection_options=SettingsConstants.ALL_COORDINATORS,
default_value=SettingsConstants.ALL_COORDINATORS),
default_value=[
SettingsConstants.COORDINATOR__BLUE_WALLET,
SettingsConstants.COORDINATOR__NUNCHUK,
SettingsConstants.COORDINATOR__SPARROW,
SettingsConstants.COORDINATOR__SPECTER_DESKTOP,
]),
SettingsEntry(category=SettingsConstants.CATEGORY__SYSTEM,
attr_name=SettingsConstants.SETTING__BTC_DENOMINATION,
+5 -7
View File
@@ -40,19 +40,17 @@ class PSBTSelectSeedView(View):
if not PSBTParser.has_matching_input_fingerprint(psbt=self.controller.psbt, seed=seed, network=self.settings.get_value(SettingsConstants.SETTING__NETWORK)):
# Doesn't look like this seed can sign the current PSBT
button_str += " (?)"
if seed.passphrase is not None:
# TODO: Include lock icon on right side of button
pass
button_data.append((button_str, SeedSignerCustomIconConstants.FINGERPRINT, "blue"))
button_data.append(SCAN_SEED)
button_data.append(TYPE_12WORD)
button_data.append(TYPE_24WORD)
if self.controller.psbt_seed:
if PSBTParser.has_matching_input_fingerprint(psbt=self.controller.psbt, seed=self.controller.psbt_seed, network=self.settings.get_value(SettingsConstants.SETTING__NETWORK)):
# skip the seed prompt if a seed was previous selected and has matching input fingerprint
return Destination(PSBTOverviewView)
if PSBTParser.has_matching_input_fingerprint(psbt=self.controller.psbt, seed=self.controller.psbt_seed, network=self.settings.get_value(SettingsConstants.SETTING__NETWORK)):
# skip the seed prompt if a seed was previous selected and has matching input fingerprint
return Destination(PSBTOverviewView)
selected_menu_num = ButtonListScreen(
title="Select Signer",
+6 -2
View File
@@ -46,7 +46,7 @@ class ScanView(View):
psbt = self.decoder.get_psbt()
self.controller.psbt = psbt
self.controller.psbt_parser = None
return Destination(PSBTSelectSeedView)
return Destination(PSBTSelectSeedView, skip_current_view=True)
elif self.decoder.is_settings:
from seedsigner.models.settings import Settings
@@ -83,7 +83,7 @@ class ScanView(View):
return Destination(NotYetImplementedView)
self.controller.multisig_wallet_descriptor = descriptor
return Destination(MultisigWalletDescriptorView)
return Destination(MultisigWalletDescriptorView, skip_current_view=True)
elif self.decoder.is_address:
from seedsigner.views.seed_views import AddressVerificationStartView
@@ -92,6 +92,7 @@ class ScanView(View):
return Destination(
AddressVerificationStartView,
skip_current_view=True,
view_args={
"address": address,
"script_type": script_type,
@@ -102,6 +103,9 @@ class ScanView(View):
else:
return Destination(NotYetImplementedView)
elif self.decoder.is_invalid:
raise Exception("QRCode not recognized or not yet supported.")
return Destination(MainMenuView)
+15 -10
View File
@@ -36,8 +36,7 @@ class SeedsMenuView(View):
self.seeds = []
for seed in self.controller.storage.seeds:
self.seeds.append({
"fingerprint": seed.get_fingerprint(self.settings.get_value(SettingsConstants.SETTING__NETWORK)),
"has_passphrase": seed.passphrase is not None
"fingerprint": seed.get_fingerprint(self.settings.get_value(SettingsConstants.SETTING__NETWORK))
})
@@ -373,6 +372,14 @@ class SeedOptionsView(View):
addr = self.controller.unverified_address["address"][:7]
VERIFY_ADDRESS += f" {addr}"
button_data.append(VERIFY_ADDRESS)
if self.controller.psbt:
if PSBTParser.has_matching_input_fingerprint(self.controller.psbt, self.seed, network=self.settings.get_value(SettingsConstants.SETTING__NETWORK)):
if self.controller.resume_main_flow and self.controller.resume_main_flow == Controller.FLOW__PSBT:
# Re-route us directly back to the start of the PSBT flow
self.controller.resume_main_flow = None
self.controller.psbt_seed = self.seed
return Destination(PSBTOverviewView, skip_current_view=True)
button_data.append(SCAN_PSBT)
@@ -522,6 +529,9 @@ class SeedExportXpubScriptTypeView(View):
).display()
if selected_menu_num == RET_CODE__BACK_BUTTON:
# If previous view is SeedOptionsView then that should be where resume_main_flow started (otherwise it would have been skipped).
if len(self.controller.back_stack) >= 2 and self.controller.back_stack[-2].View_cls == SeedOptionsView:
self.controller.resume_main_flow = None
return Destination(BackStackView)
else:
@@ -1387,14 +1397,14 @@ class AddressVerificationStartView(View):
sig_type = SettingsConstants.MULTISIG
if self.controller.multisig_wallet_descriptor:
# Can jump straight to the brute-force verification View
destination = Destination(SeedAddressVerificationView)
destination = Destination(SeedAddressVerificationView, skip_current_view=True)
else:
self.controller.resume_main_flow = Controller.FLOW__VERIFY_MULTISIG_ADDR
destination = Destination(LoadMultisigWalletDescriptorView)
destination = Destination(LoadMultisigWalletDescriptorView, skip_current_view=True)
else:
sig_type = SettingsConstants.SINGLE_SIG
destination = Destination(SeedSingleSigAddressVerificationSelectSeedView)
destination = Destination(SeedSingleSigAddressVerificationSelectSeedView, skip_current_view=True)
elif self.controller.unverified_address["script_type"] == SettingsConstants.TAPROOT:
# TODO: add Taproot support
@@ -1472,12 +1482,7 @@ class SeedSingleSigAddressVerificationSelectSeedView(View):
for seed in seeds:
button_str = seed.get_fingerprint(self.settings.get_value(SettingsConstants.SETTING__NETWORK))
if seed.passphrase is not None:
# TODO: Include lock icon on right side of button
pass
button_data.append((button_str, SeedSignerCustomIconConstants.FINGERPRINT, "blue"))
text = "Select seed to verify"
button_data.append(SCAN_SEED)
-4
View File
@@ -433,10 +433,6 @@ class ToolsAddressExplorerSelectSourceView(View):
seeds = self.controller.storage.seeds
for seed in seeds:
button_str = seed.get_fingerprint(self.settings.get_value(SettingsConstants.SETTING__NETWORK))
if seed.passphrase is not None:
# TODO: Include lock icon on right side of button
pass
button_data.append((button_str, SeedSignerCustomIconConstants.FINGERPRINT, "blue"))
button_data.append(SCAN_SEED)
+1 -1
View File
@@ -52,7 +52,7 @@ def test_missing_settings_get_defaults(reset_controller):
assert controller.settings.get_value(SettingsConstants.SETTING__LANGUAGE) == SettingsConstants.LANGUAGE__ENGLISH
assert controller.settings.get_value(SettingsConstants.SETTING__WORDLIST_LANGUAGE) == SettingsConstants.WORDLIST_LANGUAGE__ENGLISH
assert controller.settings.get_value(SettingsConstants.SETTING__PERSISTENT_SETTINGS) == SettingsConstants.OPTION__DISABLED
assert controller.settings.get_value(SettingsConstants.SETTING__COORDINATORS) == [i for i,j in SettingsConstants.ALL_COORDINATORS]
assert controller.settings.get_value(SettingsConstants.SETTING__COORDINATORS) == [i for i,j in SettingsConstants.ALL_COORDINATORS if i!="kpr"]
assert controller.settings.get_value(SettingsConstants.SETTING__BTC_DENOMINATION) == SettingsConstants.BTC_DENOMINATION__THRESHOLD
# Advanced Settings defaults