Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add account derivation for mnemonic users #1853

Merged
merged 6 commits into from
Sep 12, 2024

Conversation

OKendigelyan
Copy link
Contributor

@OKendigelyan OKendigelyan commented Sep 6, 2024

Proposed changes

Task link

Types of changes

  • Bugfix
  • New feature
  • Refactor
  • Breaking change
  • UI fix

Screenshots

Add the screenshots of how the app used to look like and how it looks now

Screen.Recording.2024-09-09.at.14.23.11.mov

Checklist

  • Tests that prove my fix is effective or that my feature works have been added
  • Documentation has been added (if appropriate)
  • Screenshots are added (if any UI changes have been made)
  • All TODOs have a corresponding task created (and the link is attached to it)

Copy link

vercel bot commented Sep 6, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
umami-v2-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 12, 2024 10:03am
umami-v2-web-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 12, 2024 10:03am

@OKendigelyan OKendigelyan force-pushed the add-account-derivation-for-mnemonic-users branch from b44438a to f1cebbd Compare September 6, 2024 14:53
@OKendigelyan OKendigelyan force-pushed the add-account-derivation-for-mnemonic-users branch from f1cebbd to 553c523 Compare September 6, 2024 15:27
@OKendigelyan OKendigelyan force-pushed the add-account-derivation-for-mnemonic-users branch 2 times, most recently from 2365bb6 to 407c0da Compare September 6, 2024 15:42
@OKendigelyan OKendigelyan force-pushed the add-account-derivation-for-mnemonic-users branch from 407c0da to d9a7944 Compare September 6, 2024 15:47
@OKendigelyan OKendigelyan force-pushed the add-account-derivation-for-mnemonic-users branch from d9a7944 to 8695e6c Compare September 6, 2024 17:59
@OKendigelyan OKendigelyan force-pushed the add-account-derivation-for-mnemonic-users branch from 8695e6c to aacfb48 Compare September 9, 2024 13:01
@OKendigelyan OKendigelyan marked this pull request as ready for review September 9, 2024 13:27
@OKendigelyan OKendigelyan force-pushed the add-account-derivation-for-mnemonic-users branch 2 times, most recently from 3996863 to ca600ae Compare September 9, 2024 14:42
Copy link
Contributor

@asiia-trilitech asiia-trilitech left a comment

Choose a reason for hiding this comment

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

Thank you, Oleg!

No issues with deriving logic, but please take a look at the comments regarding

  • + button
  • goToIndex in DynamicDisclosure

{
files: ["*.ts", "*.tsx"],
rules: {
"import/no-unused-modules": "off",
Copy link
Contributor

Choose a reason for hiding this comment

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

Why this rule was changed?

Copy link
Contributor Author

@OKendigelyan OKendigelyan Sep 10, 2024

Choose a reason for hiding this comment

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

the rule fixes eslint, which currently does not work properly in the components package (especially rule no-unused-modules)

size="sm"
variant="ghost"
/>
<IconButton
Copy link
Contributor

Choose a reason for hiding this comment

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

I think, this button should only be displayed for mnemonic accounts 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From the business perspective this button should open Add new account modal for any accounts other than mnemonic

</Center>
{accounts.map(account => {
{accounts?.map(account => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why accounts can be null here?
Maybe empty groups can be filtered out to avoid this check?

expect(screen.getByText("First")).toBeVisible();
});

it("goToIndex should go back one step when is called with out-of-bounds index", async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we have both goBack & goToIndex with the same functionality?

Maybe we can remove goBack, or only allow goToIndex for correct indexes?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd personally prefer to only allow goToIndex for correct indexes to simplify methods logic

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Previously, this logic was implemented in the goBack function, but after discussing it with @serjonya-trili, we decided to split this logic and keep both functions for different purposes - goBack for going directly to the previous disclosure and goToIndex for navigating through different disclosures

Copy link
Contributor

Choose a reason for hiding this comment

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

We should check that account name is valid before proceeding (similar to RenameAccountModal check)

Copy link
Contributor Author

@OKendigelyan OKendigelyan Sep 10, 2024

Choose a reason for hiding this comment

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

we don't need these validation rules for this case since Account name field in this modal is optional.
Basically logic of NameAccountModal is the same as for desktop's NameAccountDisplay

Copy link
Contributor

Choose a reason for hiding this comment

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

Although the warning is shown, maybe we can also make the form invalid on entering wrong password
Screenshot 2024-09-09 at 17 02 47

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Password validation takes place inside useDeriveMnemonicAccount. We don't know if the password is valid or not until we process useDeriveMnemonicAccount

expect(screen.getByTestId("master-password-modal")).toBeVisible();
});
});

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can also check the case with incorrect password

And that after successful deriving, the modal will be closed

Copy link
Contributor

@asiia-trilitech asiia-trilitech left a comment

Choose a reason for hiding this comment

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

Thank you @OKendigelyan 👍

@OKendigelyan OKendigelyan force-pushed the add-account-derivation-for-mnemonic-users branch from ce70f0f to 65c9fdc Compare September 12, 2024 10:00
@OKendigelyan OKendigelyan enabled auto-merge (squash) September 12, 2024 10:00
@OKendigelyan OKendigelyan merged commit 47c28d4 into main Sep 12, 2024
6 checks passed
@OKendigelyan OKendigelyan deleted the add-account-derivation-for-mnemonic-users branch September 12, 2024 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants