Skip to content

Commit 759a57a

Browse files
committed
use is_pending_electrum instead of seed type
1 parent 2217a6b commit 759a57a

File tree

2 files changed

+6
-20
lines changed

2 files changed

+6
-20
lines changed

src/seedsigner/models/seed.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import logging
21
import unicodedata
32
import hashlib
43
import hmac
@@ -10,18 +9,13 @@
109

1110
from seedsigner.models.settings import SettingsConstants
1211

13-
logger = logging.getLogger(__name__)
14-
1512

1613
class InvalidSeedException(Exception):
1714
pass
1815

1916

2017

2118
class Seed:
22-
TYPE__BIP39 = "bip39"
23-
TYPE__ELECTRUM = "electrum"
24-
2519
def __init__(self,
2620
mnemonic: List[str] = None,
2721
passphrase: str = "",
@@ -52,7 +46,7 @@ def _generate_seed(self):
5246
try:
5347
self.seed_bytes = bip39.mnemonic_to_seed(self.mnemonic_str, password=self._passphrase, wordlist=self.wordlist)
5448
except Exception as e:
55-
logger.info(repr(e), exc_info=True)
49+
print(repr(e))
5650
raise InvalidSeedException(repr(e))
5751

5852

@@ -81,11 +75,6 @@ def mnemonic_display_list(self) -> List[str]:
8175
return unicodedata.normalize("NFC", " ".join(self._mnemonic)).split()
8276

8377

84-
@property
85-
def has_passphrase(self):
86-
return self._passphrase != ""
87-
88-
8978
@property
9079
def passphrase(self):
9180
return self._passphrase

src/seedsigner/views/seed_views.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -209,19 +209,18 @@ def run(self):
209209

210210

211211
class SeedMnemonicEntryView(View):
212-
def __init__(self, cur_word_index: int = 0, is_calc_final_word: bool=False, seed_type: str = Seed.TYPE__BIP39):
212+
def __init__(self, cur_word_index: int = 0, is_calc_final_word: bool=False):
213213
super().__init__()
214214
self.cur_word_index = cur_word_index
215215
self.cur_word = self.controller.storage.get_pending_mnemonic_word(cur_word_index)
216216
self.is_calc_final_word = is_calc_final_word
217-
self.seed_type = seed_type
218217

219218

220219
def run(self):
221220
is_final_word = (
222221
self.cur_word_index == self.controller.storage.pending_mnemonic_length - 1 and
223222
not self.is_calc_final_word and
224-
self.seed_type == Seed.TYPE__BIP39
223+
not self.controller.storage._pending_is_electrum
225224
)
226225

227226
partial_mnemonic = None
@@ -265,8 +264,7 @@ def run(self):
265264
SeedMnemonicEntryView,
266265
view_args={
267266
"cur_word_index": self.cur_word_index + 1,
268-
"is_calc_final_word": self.is_calc_final_word,
269-
"seed_type": self.seed_type
267+
"is_calc_final_word": self.is_calc_final_word
270268
}
271269
)
272270
else:
@@ -301,8 +299,7 @@ def run(self):
301299
)
302300

303301
if button_data[selected_menu_num] == self.EDIT:
304-
seed_type = Seed.TYPE__ELECTRUM if self.controller.storage._pending_is_electrum else Seed.TYPE__BIP39
305-
return Destination(SeedMnemonicEntryView, view_args={"cur_word_index": 0, "seed_type": seed_type})
302+
return Destination(SeedMnemonicEntryView, view_args={"cur_word_index": 0})
306303

307304
elif button_data[selected_menu_num] == self.DISCARD:
308305
self.controller.storage.discard_pending_mnemonic()
@@ -529,7 +526,7 @@ def run(self):
529526

530527
self.controller.storage.init_pending_mnemonic(num_words=12, is_electrum=True)
531528

532-
return Destination(SeedMnemonicEntryView, view_args={"seed_type": Seed.TYPE__ELECTRUM})
529+
return Destination(SeedMnemonicEntryView)
533530

534531

535532

0 commit comments

Comments
 (0)