-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatically correct minor mnemonic phrase errors on import (#508)
### Description Utilizing the functions included in `@celo/utils` in celo-org/celo-monorepo#8034, this PR adds support for the wallet to automatically correct minor mnemonic phrase errors, such as typos or replacement of simmilar words, during the restore/import wallet flow. When given an invalid mnemonic, the applications will spend up to 5 seconds searching for an simmilar corrected mnemonic phrase. It tries suggestions by order of edit distance from the given phrase and checks the balance of each valid mnemonic phrase it derives. If one of the phrases has a balance, it is almost surely the intended account, so the wallet uses that phrase instead of the invalid user given phrase. If no phrase can be found with a balance, then an error is displayed to the user as before. ### Other changes * Modified the error text upon input of an incorrect phrase. * Added comments to various React compenents. * Include cEUR where needed to allow the code to compile. * Remove `celotool` and `celocli` commands from `package.json` * Updates translation mocks and tests to use the parameters passed in ### Tested * Added unit tests to ensure the new functionality works in the import saga. * Manually tested with various phrases. ### How others should test Using a wallet that has a balance, restore the wallet from the mnemonic phrase. (With the mnemonic phrase, reset the application and upon relaunching it, enter the restore wallet flow) When entering the phrase, make sure to add some errors (if you don't naturally make errors when typing). Press submit and it the mnemonic phrase is accepted, then the feature worked. ### Related issues - Fixes celo-org/celo-monorepo#7060 - Requires celo-org/celo-monorepo#8034 - Requires celo-org/celo-monorepo#8146 ### Backwards compatibility No concerns
- Loading branch information
Victor "Nate" Graf
authored
Jul 19, 2021
1 parent
e6872e6
commit 0107b7e
Showing
59 changed files
with
635 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.