Merge pull request #227 from kdmukai/bump_embit_0_5_0

Bump `embit` to v0.5.0
This commit is contained in:
Nick Klockenga
2022-08-05 10:55:47 -04:00
committed by GitHub
3 changed files with 36 additions and 55 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
embit @ git+https://github.com/seedsigner/embit.git@03cba13e0add64b241972c67e2aa970cb2e3a5d2 embit==0.5.0
numpy==1.21.1 numpy==1.21.1
picamera==1.13 picamera==1.13
Pillow==8.2.0 Pillow==8.2.0
+3 -9
View File
@@ -472,15 +472,9 @@ class PSBTFinalizeView(View):
if selected_menu_num == 0: if selected_menu_num == 0:
# Sign PSBT # Sign PSBT
loading_screen = LoadingScreenThread(text="Signing PSBT...") sig_cnt = PSBTParser.sig_count(psbt)
loading_screen.start() psbt.sign_with(psbt_parser.root)
trimmed_psbt = PSBTParser.trim(psbt)
try:
sig_cnt = PSBTParser.sig_count(psbt)
psbt.sign_with(psbt_parser.root)
trimmed_psbt = PSBTParser.trim(psbt)
finally:
loading_screen.stop()
if sig_cnt == PSBTParser.sig_count(trimmed_psbt): if sig_cnt == PSBTParser.sig_count(trimmed_psbt):
# Signing failed / didn't do anything # Signing failed / didn't do anything
+32 -45
View File
@@ -643,53 +643,42 @@ class SeedExportXpubDetailsView(View):
def run(self): def run(self):
# The calc_derivation takes a few moments. Run the loading screen while we wait. if self.script_type == SettingsConstants.CUSTOM_DERIVATION:
self.loading_screen = LoadingScreenThread(text="Generating xpub...") derivation_path = self.custom_derivation
self.loading_screen.start() else:
derivation_path = PSBTParser.calc_derivation(
network=self.settings.get_value(SettingsConstants.SETTING__NETWORK),
wallet_type=self.sig_type,
script_type=self.script_type
)
try: if self.settings.get_value(SettingsConstants.SETTING__XPUB_DETAILS) == SettingsConstants.OPTION__ENABLED:
if self.script_type == SettingsConstants.CUSTOM_DERIVATION: embit_network = NETWORKS[SettingsConstants.map_network_to_embit(self.settings.get_value(SettingsConstants.SETTING__NETWORK))]
derivation_path = self.custom_derivation version = embit.bip32.detect_version(
else: derivation_path,
derivation_path = PSBTParser.calc_derivation( default="xpub",
network=self.settings.get_value(SettingsConstants.SETTING__NETWORK), network=embit_network
wallet_type=self.sig_type, )
script_type=self.script_type
)
if self.settings.get_value(SettingsConstants.SETTING__XPUB_DETAILS) == SettingsConstants.OPTION__ENABLED: root = embit.bip32.HDKey.from_seed(
embit_network = NETWORKS[SettingsConstants.map_network_to_embit(self.settings.get_value(SettingsConstants.SETTING__NETWORK))] self.seed.seed_bytes,
version = embit.bip32.detect_version( version=embit_network["xprv"]
derivation_path, )
default="xpub",
network=embit_network
)
root = embit.bip32.HDKey.from_seed( fingerprint = hexlify(root.child(0).fingerprint).decode('utf-8')
self.seed.seed_bytes, xprv = root.derive(derivation_path)
version=embit_network["xprv"] xpub = xprv.to_public()
) xpub_base58 = xpub.to_string(version=version)
fingerprint = hexlify(root.child(0).fingerprint).decode('utf-8') selected_menu_num = seed_screens.SeedExportXpubDetailsScreen(
xprv = root.derive(derivation_path) fingerprint=fingerprint,
xpub = xprv.to_public() has_passphrase=self.seed.passphrase is not None,
xpub_base58 = xpub.to_string(version=version) derivation_path=derivation_path,
xpub=xpub_base58,
).display()
screen = seed_screens.SeedExportXpubDetailsScreen( else:
fingerprint=fingerprint, selected_menu_num = 0
has_passphrase=self.seed.passphrase is not None,
derivation_path=derivation_path,
xpub=xpub_base58,
)
self.loading_screen.stop()
selected_menu_num = screen.display()
else:
selected_menu_num = 0
finally:
self.loading_screen.stop()
if selected_menu_num == 0: if selected_menu_num == 0:
@@ -697,8 +686,6 @@ class SeedExportXpubDetailsView(View):
SeedExportXpubQRDisplayView, SeedExportXpubQRDisplayView,
{ {
"seed_num": self.seed_num, "seed_num": self.seed_num,
"sig_type": self.sig_type,
"script_type": self.script_type,
"coordinator": self.coordinator, "coordinator": self.coordinator,
"derivation_path": derivation_path, "derivation_path": derivation_path,
} }
@@ -710,7 +697,7 @@ class SeedExportXpubDetailsView(View):
class SeedExportXpubQRDisplayView(View): class SeedExportXpubQRDisplayView(View):
def __init__(self, seed_num: int, sig_type: str, script_type: str, coordinator: str, derivation_path: str): def __init__(self, seed_num: int, coordinator: str, derivation_path: str):
super().__init__() super().__init__()
self.seed = self.controller.get_seed(seed_num) self.seed = self.controller.get_seed(seed_num)