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

chore(deps): bump @metamask/keyring-api to 6.0.0, @metamask/eth-snap-keyring to 4.0.0 and snap dependencies #4193

Merged
merged 4 commits into from
Apr 19, 2024

Conversation

montelaidev
Copy link
Contributor

Explanation

This PR bumps the @metamask/keyring-api, @metamask/eth-snap-keyring and snap dependencies in the AccountsController

References

Resolves: 4135

Changelog

@metamask/accounts-controller

  • CHANGED: Bump dependency @metamask/keyring-api to ^6.0.0
  • CHANGED: Bump dependency @metamask/eth-snap-keyring to ^4.0.0
  • CHANGED: Bump dev dependency @metamask/snaps-controller to ^7.0.1
  • CHANGED: Bump dependency @metamask/snaps-sdk to ^4.0.1
  • CHANGED: Bump dependency @metamask/snaps-utils to ^7.1.0

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate

Copy link

socket-security bot commented Apr 19, 2024

@montelaidev montelaidev changed the title Bump/keyring api to 6.0.0 and snap dependencies chore(deps): Bump @metamask/keyring-api to 6.0.0, @metamask/eth-snap-keyring to 4.0.0 and snap dependencies Apr 19, 2024
@montelaidev
Copy link
Contributor Author

@metamaskbot publish-preview

@montelaidev montelaidev marked this pull request as ready for review April 19, 2024 12:45
@montelaidev montelaidev requested a review from a team as a code owner April 19, 2024 12:45
Copy link
Contributor

Preview builds have been published. See these instructions for more information about preview builds.

Expand for full list of packages and versions.
{
  "@metamask-previews/accounts-controller": "13.0.0-preview-11ae513",
  "@metamask-previews/address-book-controller": "4.0.1-preview-11ae513",
  "@metamask-previews/announcement-controller": "6.1.0-preview-11ae513",
  "@metamask-previews/approval-controller": "6.0.1-preview-11ae513",
  "@metamask-previews/assets-controllers": "28.0.0-preview-11ae513",
  "@metamask-previews/base-controller": "5.0.1-preview-11ae513",
  "@metamask-previews/build-utils": "2.0.1-preview-11ae513",
  "@metamask-previews/composable-controller": "6.0.1-preview-11ae513",
  "@metamask-previews/controller-utils": "9.1.0-preview-11ae513",
  "@metamask-previews/ens-controller": "10.0.1-preview-11ae513",
  "@metamask-previews/eth-json-rpc-provider": "3.0.1-preview-11ae513",
  "@metamask-previews/gas-fee-controller": "15.0.0-preview-11ae513",
  "@metamask-previews/json-rpc-engine": "8.0.1-preview-11ae513",
  "@metamask-previews/json-rpc-middleware-stream": "7.0.1-preview-11ae513",
  "@metamask-previews/keyring-controller": "15.0.0-preview-11ae513",
  "@metamask-previews/logging-controller": "3.0.1-preview-11ae513",
  "@metamask-previews/message-manager": "8.0.1-preview-11ae513",
  "@metamask-previews/name-controller": "6.0.1-preview-11ae513",
  "@metamask-previews/network-controller": "18.1.0-preview-11ae513",
  "@metamask-previews/notification-controller": "5.0.1-preview-11ae513",
  "@metamask-previews/permission-controller": "9.0.2-preview-11ae513",
  "@metamask-previews/permission-log-controller": "2.0.1-preview-11ae513",
  "@metamask-previews/phishing-controller": "9.0.1-preview-11ae513",
  "@metamask-previews/polling-controller": "6.0.1-preview-11ae513",
  "@metamask-previews/preferences-controller": "10.0.0-preview-11ae513",
  "@metamask-previews/queued-request-controller": "0.9.0-preview-11ae513",
  "@metamask-previews/rate-limit-controller": "5.0.1-preview-11ae513",
  "@metamask-previews/selected-network-controller": "12.0.0-preview-11ae513",
  "@metamask-previews/signature-controller": "15.0.0-preview-11ae513",
  "@metamask-previews/transaction-controller": "28.1.0-preview-11ae513",
  "@metamask-previews/user-operation-controller": "8.0.0-preview-11ae513"
}

@danroc danroc changed the title chore(deps): Bump @metamask/keyring-api to 6.0.0, @metamask/eth-snap-keyring to 4.0.0 and snap dependencies chore(deps): bump @metamask/keyring-api to 6.0.0, @metamask/eth-snap-keyring to 4.0.0 and snap dependencies Apr 19, 2024
@montelaidev montelaidev merged commit f51a020 into main Apr 19, 2024
139 checks passed
@montelaidev montelaidev deleted the bump/keyring-api-to-6.0.0-and-snap-dependencies branch April 19, 2024 15:16
Comment on lines +802 to +803
const internalAccount = this.getAccount(accountId);
return internalAccount ? internalAccount.metadata[metadataKey] : undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

Normally getAccount will return either an InternalAccount or undefined so I guess we can use this notation:

Suggested change
const internalAccount = this.getAccount(accountId);
return internalAccount ? internalAccount.metadata[metadataKey] : undefined;
return internalAccount?.metadata[metadataKey];

If you find it less clear, we can keep yours!

* @returns The value of the specified metadata key, or undefined if the account or metadata key does not exist.
*/
#populateExistingMetadata<T extends keyof InternalAccount['metadata']>(
accountId: string,
Copy link
Contributor

Choose a reason for hiding this comment

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

This could be undefined as well with this expression: existingAccount?.id?

I believe there's always a "previous account" during the update, but in terms of typing this could be undefined (hence the ?)

What about new accounts, they are not used in then updateAccounts methods, right?

? existingAccount.metadata.name
: `${keyringTypeName} ${keyringAccountIndex + 1}`,
lastSelected: existingAccount?.metadata?.lastSelected,
this.#populateExistingMetadata(existingAccount?.id, 'name') ??
Copy link
Contributor

Choose a reason for hiding this comment

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

Related to my other comment that exitstingAccount?.id could be undefined. I guess we can use internalAccount.id here directly, no? This way we know it's not "potentially" undefined?

@montelaidev montelaidev mentioned this pull request Apr 23, 2024
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.

feat: add importTime to the accounts controller metadata
3 participants