Skip to content

[Refactor] use _Seed_cls to handle seed type#807

Open
notTanveer wants to merge 2 commits intoSeedSigner:devfrom
notTanveer:refactor-seed-type
Open

[Refactor] use _Seed_cls to handle seed type#807
notTanveer wants to merge 2 commits intoSeedSigner:devfrom
notTanveer:refactor-seed-type

Conversation

@notTanveer
Copy link
Contributor

@notTanveer notTanveer commented Aug 27, 2025

This PR addresses this comment.

Description

Reason for Change

eliminates conditional logic throughout the codebase. instead of checking boolean flags and then deciding which class to instantiate, we directly store the class and follows the same pattern as Destination class and makes the code cleaner and less error prone.

This pull request is categorized as a:

  • Code refactor

Checklist

  • I’ve run pytest and made sure all unit tests pass before sumbitting the PR

If you modified or added functionality/workflow, did you add new unit tests?

  • N/A

I have tested this PR on the following platforms/os:

@kdmukai
Copy link
Contributor

kdmukai commented Aug 27, 2025

PR description should document the fact that validate_mnemonic() was removed and the rationale.

@notTanveer
Copy link
Contributor Author

updated the PR: init_pending_mnemonic method now takes seed_class as input instead of the is_electrum flag. this makes the code more extensible and future-proof for supporting additional seed formats.

@notTanveer notTanveer requested a review from alvroble August 29, 2025 15:09
notTanveer added a commit to notTanveer/seedsigner that referenced this pull request Aug 29, 2025
notTanveer added a commit to notTanveer/seedsigner that referenced this pull request Aug 29, 2025
seed = self._pending_Seed_cls(self._pending_mnemonic)
return seed.get_fingerprint(network)
except InvalidSeedException:
return None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new approach LGTM now

Copy link
Contributor

@alvroble alvroble left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the flexibility the seed_class parameter permits now. Tested ACK on Raspberry Pi OS Manual Build as of 0198399 .

@newtonick
Copy link
Collaborator

@notTanveer can you add to the top comment/description the reason/context for this change? Is this related to this comment? #800 (comment)

@notTanveer
Copy link
Contributor Author

@notTanveer can you add to the top comment/description the reason/context for this change? Is this related to this comment? #800 (comment)

updated the PR description

@newtonick newtonick moved this from SoB In Progress to 0.9.0 In Progress in @SeedSigner Development Board Dec 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 0.9.0 In Progress

Development

Successfully merging this pull request may close these issues.

4 participants