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

Validate hex seed in case activate account #3474

Merged
merged 11 commits into from
Oct 10, 2024

Conversation

samaradel
Copy link
Contributor

@samaradel samaradel commented Sep 26, 2024

Description

  • Validate the hex seed that passed to activate and create an account function.
  • Fix the hex seed label in the profile dialog.
  • Refactor code as it could exit early if the case matched.

Changes

Screencast.from.26-09-24.16.39.33.webm

Related Issues

Tested Scenarios

  • Using new hex seed without 0x in the beginning and activate the account.

Checklist

  • Tests included
  • Build pass
  • Documentation
  • Code format and docstrings
  • Screenshots/Video attached (needed for UI changes)

@samaradel samaradel marked this pull request as draft September 30, 2024 09:14
@samaradel samaradel marked this pull request as ready for review October 1, 2024 00:13
@0oM4R
Copy link
Contributor

0oM4R commented Oct 1, 2024

Can you please update the PR description with the new changes? and explanation would be great addition.

Copy link
Contributor

@0oM4R 0oM4R left a comment

Choose a reason for hiding this comment

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

verified creating account from hex with the 0x and without it, all works fine.
great job ya Samar, just few suggestions

Comment on lines 731 to 735
const mnemonicValue = validateMnemonic(mnemonic.value)
? mnemonic.value
: mnemonic.value.length === 66
? mnemonic.value
: `0x${mnemonic.value}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

should we use if/else if ? i think it will be more readable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's good, less code, and the results depend on the previous one. it's fine.
@AhmedHanafy725 what do you think ?

Copy link
Contributor

Choose a reason for hiding this comment

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

it's fine but what confuses me is the variable name, it can be mnemonic or hex seed

packages/tfchain_client/src/client.ts Outdated Show resolved Hide resolved
@samaradel samaradel requested a review from 0oM4R October 3, 2024 10:12
@samaradel samaradel marked this pull request as draft October 9, 2024 07:57
@samaradel samaradel marked this pull request as ready for review October 9, 2024 10:15
Copy link
Contributor

@0oM4R 0oM4R left a comment

Choose a reason for hiding this comment

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

activated two accounts, one with 0x prefix and another without, both works fine

@samaradel samaradel merged commit 038404b into development Oct 10, 2024
10 checks passed
@samaradel samaradel deleted the development_validate_seed branch October 10, 2024 10:58
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.

4 participants