-
Notifications
You must be signed in to change notification settings - Fork 558
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
Refactor AccountSelector
#2779
Refactor AccountSelector
#2779
Conversation
9de797f
to
a205ba6
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2779 +/- ##
=======================================
Coverage 94.43% 94.44%
=======================================
Files 483 483
Lines 10297 10310 +13
Branches 1568 1571 +3
=======================================
+ Hits 9724 9737 +13
Misses 573 573 ☔ View full report in Codecov by Sentry. |
4c25571
to
dbb84a2
Compare
👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎ This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. Ignoring: Next stepsTake a deeper look at the dependencyTake a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev. Remove the packageIf you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency. Mark a package as acceptable riskTo ignore an alert, reply with a comment starting with |
dbb84a2
to
2d24433
Compare
New dependencies detected. Learn more about Socket for GitHub ↗︎
|
@SocketSecurity ignore-all these depedencies are pulled by packages we own or are packages we own |
assert( | ||
account, | ||
`Account with ID ${element.props.selectedAccount} not found.`, | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just return undefined
or null
in that case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to throw because we then don't know which account to select in the UI since it always need to have an account selected
This refactors the
AccountSelector
:id
andaddress
key.switchGlobalAccount
that defaults tofalse
. It allows the component to switch the global selected account of the Extension to be switched on selection of an account.hideExternalAccounts
that defaults tofalse
. It allows the component to hide the accounts that are not owned by the snap.selectedAccount
prop optional. If it's not provided we will get the selected account in theAccountsController
, if it is we will try to get the address related to this account and if it doesn't exist we will throw an error.chainIds
prop optional.