-
-
Notifications
You must be signed in to change notification settings - Fork 246
chore: bump accounts dependencies #6248
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
Conversation
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
select(selector: AccountSelector<Account>): Account[] { | ||
return this.getAccounts().filter((account) => { | ||
let selected = true; | ||
|
||
if (selector.id) { | ||
selected &&= account.id === selector.id; | ||
} | ||
if (selector.address) { | ||
selected &&= account.address === selector.address; | ||
} | ||
if (selector.type) { | ||
selected &&= account.type === selector.type; | ||
} | ||
if (selector.methods !== undefined) { | ||
selected &&= selector.methods.some((method) => | ||
account.methods.includes(method), | ||
); | ||
} | ||
if (selector.scopes !== undefined) { | ||
selected &&= selector.scopes.some((scope) => { | ||
return ( | ||
// This will cover specific EVM EOA scopes as well. | ||
isScopeEqualToAny(scope, account.scopes) | ||
); | ||
}); | ||
} | ||
|
||
return selected; | ||
}); | ||
return select(this.getAccounts(), selector); |
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.
Nice and clean replacement! 👏
Although that name clash select
function calls select
selector from account-api really makes my Go dev's eyes bleed 😂 ahaha
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.
Yes... I wanted to avoid having getWhatever
in the name for this, and IDK if that was a good idea or not, but it felt "clean and concise" that way 😄
import type { Bip44Account } from '@metamask/account-api'; | ||
import { isBip44Account } from '@metamask/account-api'; | ||
import type { InternalAccount } from '@metamask/keyring-internal-api'; | ||
import type { KeyringAccount } from '@metamask/keyring-api'; |
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.
Please remind me (just for me): KeyringAccount
is a specialized InternalAccount
or... viceversa? 😳
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.
KeyringAccount
is the most "basic" account representation we have (apart from "raw addresses" ofc 🙃)
But the the keyring API is using this type to represent account (which is only used account management Snaps for the moment). It will be used more widely once we introduce the unified keyring API for all keyrings (see this ADR).
InternalAcccount
are basically KeyringAccount & { metadata: { ... } }
which can includes various timestamps, account names, keyring info, etc...
With the new shift to the new account model, the AccountTreeController
introduced new kind of metadata on wallets and groups, which will probably (in the long run) allow us to get rid of InternalAccount
entirely 🤞.
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.
Now I remember! It's one of the first topics we discussed, ever. I'm connecting all the dots now, thank you for the refresher!
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.
Approving for Asset related changes.
## Explanation Bumps @metamask/assets-controllers to 73.1.0 to add comprehensive balance selectors for multichain account groups and wallets, along with dependency updates and bug fixes. ## References - [#6235](#6235) - Comprehensive balance selectors for multichain account groups and wallets - [#6248](#6248) - Bump keyring-api dependency - [#6242](#6242) - Fix DeFiPositionsController polling rate - [#6250](#6250) - Fix AccountTrackerController cache invalidation ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've communicated my changes to consumers by updating changelogs for packages I've changed, highlighting breaking changes as necessary - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes
Explanation
Bumping all accounts-related dependencies.
References
N/A
Changelog
N/A
Checklist