Skip to content

Commit

Permalink
chore: bump keyring packages (#5405)
Browse files Browse the repository at this point in the history
## Explanation

<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:

* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?
* Are there any changes whose purpose might not obvious to those
unfamiliar with the domain?
* If your primary goal was to update one package but you found you had
to update another one along the way, why did you do so?
* If you had to upgrade a dependency, why did you do so?
-->

This PR bumps these packages across the core controllers:
- `@metamask/eth-simple-keyring`
- `@metamask/eth-hd-keyring`
- `@metamask/keyring-internal-api`

The package is being updated on Extension by this PR:
MetaMask/metamask-extension#30637

## References

<!--
Are there any issues that this pull request is tied to?
Are there other links that reviewers should consult to understand these
changes better?
Are there client or consumer pull requests to adopt any breaking
changes?

For example:

* Fixes #12345
* Related to #67890
-->

## Changelog

<!--
If you're making any consumer-facing changes, list those changes here as
if you were updating a changelog, using the template below as a guide.

(CATEGORY is one of BREAKING, ADDED, CHANGED, DEPRECATED, REMOVED, or
FIXED. For security-related issues, follow the Security Advisory
process.)

Please take care to name the exact pieces of the API you've added or
changed (e.g. types, interfaces, functions, or methods).

If there are any breaking changes, make sure to offer a solution for
consumers to follow once they upgrade to the changes.

Finally, if you're only making changes to development scripts or tests,
you may replace the template below with "None".
-->

### `@metamask/keyring-controller`

- **CHANGED**: Bump `@metamask/eth-simple-keyring` from `^8.1.0` to
`^9.0.0` ([#5405](#5405))
- **CHANGED**: Bump `@metamask/eth-hd-keyring` from `^10.0.0` to
`^11.0.0` ([#5405](#5405))
- **CHANGED**: Bump `@metamask/keyring-internal-api` from `^4.0.3` to
`^5.0.0` ([#5405](#5405))

### `@metamask/accounts-controller`

- **CHANGED**: Bump `@metamask/keyring-internal-api` from `^4.0.3` to
`^5.0.0` ([#5405](#5405))

### `@metamask/profile-sync-controller`

- **CHANGED**: Bump `@metamask/keyring-internal-api` from `^4.0.3` to
`^5.0.0` ([#5405](#5405))

### `@metamask/assets-controller`

- **CHANGED**: Bump `@metamask/keyring-internal-api` from `^4.0.3` to
`^5.0.0` ([#5405](#5405))

### `@metamask/multichain-transaction-controller`

- **CHANGED**: Bump `@metamask/keyring-internal-api` from `^4.0.3` to
`^5.0.0` ([#5405](#5405))

## 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
- [ ] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes
  • Loading branch information
mikesposito authored Mar 3, 2025
1 parent c50a4c6 commit ee1e79d
Show file tree
Hide file tree
Showing 16 changed files with 125 additions and 122 deletions.
4 changes: 4 additions & 0 deletions packages/accounts-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- Bump `@metamask/keyring-internal-api` from `^4.0.3` to `^5.0.0` ([#5405](https://github.com/MetaMask/core/pull/5405))

## [24.1.0]

### Changed
Expand Down
2 changes: 1 addition & 1 deletion packages/accounts-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"@metamask/base-controller": "^8.0.0",
"@metamask/eth-snap-keyring": "^11.1.0",
"@metamask/keyring-api": "^17.2.0",
"@metamask/keyring-internal-api": "^4.0.3",
"@metamask/keyring-internal-api": "^5.0.0",
"@metamask/keyring-utils": "^2.3.1",
"@metamask/network-controller": "^22.2.1",
"@metamask/snaps-sdk": "^6.17.1",
Expand Down
4 changes: 4 additions & 0 deletions packages/assets-controllers/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- Bump `@metamask/keyring-internal-api` from `^4.0.3` to `^5.0.0` ([#5405](https://github.com/MetaMask/core/pull/5405))

## [51.0.2]

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion packages/assets-controllers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"@metamask/auto-changelog": "^3.4.4",
"@metamask/ethjs-provider-http": "^0.3.0",
"@metamask/keyring-controller": "^19.2.1",
"@metamask/keyring-internal-api": "^4.0.3",
"@metamask/keyring-internal-api": "^5.0.0",
"@metamask/keyring-snap-client": "^4.0.1",
"@metamask/network-controller": "^22.2.1",
"@metamask/permission-controller": "^11.0.6",
Expand Down
10 changes: 8 additions & 2 deletions packages/keyring-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [19.2.1]

### Changed

- **BREAKING:** `addNewKeyring` method now returns `Promise<KeyringMetadata>` instead of `Promise<unknown>` ([#5372](https://github.com/MetaMask/core/pull/5372))
- Consumers can use the returned `KeyringMetadata.id` to access the created keyring instance via `withKeyring`.
- **BREAKING:** `withKeyring` method now requires a callback argument of type `({ keyring: SelectedKeyring; metadata: KeyringMetadata }) => Promise<CallbackResult>` ([#5372](https://github.com/MetaMask/core/pull/5372))
- Bump `@metamask/keyring-internal-api` from `^4.0.3` to `^5.0.0` ([#5405](https://github.com/MetaMask/core/pull/5405))
- Bump `@metamask/eth-hd-keyring` from `^10.0.0` to `^11.0.0` ([#5405](https://github.com/MetaMask/core/pull/5405))
- Bump `@metamask/eth-simple-keyring` from `^8.1.0` to `^9.0.0` ([#5405](https://github.com/MetaMask/core/pull/5405))

## [19.2.1]

### Changed

- Bump `@metamask/keyring-api"` from `^17.0.0` to `^17.2.0` ([#5366](https://github.com/MetaMask/core/pull/5366))
- Bump `@metamask/keyring-internal-api` from `^4.0.1` to `^4.0.3` ([#5356](https://github.com/MetaMask/core/pull/5356)), ([#5366](https://github.com/MetaMask/core/pull/5366))

Expand Down
7 changes: 4 additions & 3 deletions packages/keyring-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@
"@keystonehq/metamask-airgapped-keyring": "^0.14.1",
"@metamask/base-controller": "^8.0.0",
"@metamask/browser-passworder": "^4.3.0",
"@metamask/eth-hd-keyring": "^10.0.0",
"@metamask/eth-hd-keyring": "^11.0.0",
"@metamask/eth-sig-util": "^8.2.0",
"@metamask/eth-simple-keyring": "^8.1.0",
"@metamask/eth-simple-keyring": "^9.0.0",
"@metamask/keyring-api": "^17.2.0",
"@metamask/keyring-internal-api": "^4.0.3",
"@metamask/keyring-internal-api": "^5.0.0",
"@metamask/utils": "^11.2.0",
"async-mutex": "^0.5.0",
"ethereumjs-wallet": "^1.0.1",
Expand All @@ -69,6 +69,7 @@
"@lavamoat/allow-scripts": "^3.0.4",
"@lavamoat/preinstall-always-fail": "^2.1.0",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/keyring-utils": "^2.3.1",
"@metamask/scure-bip39": "^2.1.1",
"@types/jest": "^27.4.1",
"deepmerge": "^4.2.2",
Expand Down
24 changes: 12 additions & 12 deletions packages/keyring-controller/src/KeyringController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { TransactionFactory } from '@ethereumjs/tx';
import { CryptoHDKey, ETHSignature } from '@keystonehq/bc-ur-registry-eth';
import { MetaMaskKeyring as QRKeyring } from '@keystonehq/metamask-airgapped-keyring';
import { Messenger } from '@metamask/base-controller';
import HDKeyring from '@metamask/eth-hd-keyring';
import { HdKeyring } from '@metamask/eth-hd-keyring';
import {
normalize,
recoverPersonalSignature,
Expand All @@ -14,8 +14,8 @@ import {
} from '@metamask/eth-sig-util';
import SimpleKeyring from '@metamask/eth-simple-keyring';
import type { EthKeyring } from '@metamask/keyring-internal-api';
import type { KeyringClass } from '@metamask/keyring-utils';
import { wordlist } from '@metamask/scure-bip39/dist/wordlists/english';
import type { KeyringClass } from '@metamask/utils';
import {
bytesToHex,
isValidHexAddress,
Expand Down Expand Up @@ -122,7 +122,7 @@ describe('KeyringController', () => {
it('allows overwriting the built-in HD keyring builder', async () => {
// todo: keyring types are mismatched, this should be fixed in they keyrings themselves
// @ts-expect-error keyring types are mismatched
const mockHdKeyringBuilder = buildKeyringBuilderWithSpy(HDKeyring);
const mockHdKeyringBuilder = buildKeyringBuilderWithSpy(HdKeyring);
await withController(
{ keyringBuilders: [mockHdKeyringBuilder] },
async () => {
Expand Down Expand Up @@ -341,7 +341,7 @@ describe('KeyringController', () => {
// removed.
const mockKeyring = controller.getKeyringsByType(
MockShallowGetAccountsKeyring.type,
)[0] as EthKeyring<Json>;
)[0] as EthKeyring;

const addedAccountAddress =
await controller.addNewAccountForKeyring(mockKeyring);
Expand Down Expand Up @@ -421,7 +421,7 @@ describe('KeyringController', () => {
await controller.setLocked();

await expect(
controller.addNewAccountForKeyring(keyring as EthKeyring<Json>),
controller.addNewAccountForKeyring(keyring as EthKeyring),
).rejects.toThrow(KeyringControllerError.ControllerLocked);
});
});
Expand Down Expand Up @@ -637,7 +637,7 @@ describe('KeyringController', () => {
});

it('should throw error if the first account is not found on the keyring', async () => {
jest.spyOn(HDKeyring.prototype, 'getAccounts').mockReturnValue([]);
jest.spyOn(HdKeyring.prototype, 'getAccounts').mockReturnValue([]);
await withController(
{ cacheEncryptionKey, skipVaultCreation: true },
async ({ controller }) => {
Expand Down Expand Up @@ -2889,7 +2889,7 @@ describe('KeyringController', () => {
it('should rollback if an error is thrown', async () => {
await withController(async ({ controller, initialState }) => {
const selector = { type: KeyringTypes.hd };
const fn = async ({ keyring }: { keyring: EthKeyring<Json> }) => {
const fn = async ({ keyring }: { keyring: EthKeyring }) => {
await keyring.addAccounts(1);
throw new Error('Oops');
};
Expand Down Expand Up @@ -4270,7 +4270,7 @@ type WithControllerArgs<ReturnValue> =
* @param account - The account to return.
*/
function stubKeyringClassWithAccount(
keyringClass: KeyringClass<Json>,
keyringClass: KeyringClass,
account: string,
) {
jest
Expand Down Expand Up @@ -4343,14 +4343,14 @@ async function withController<ReturnValue>(
* @param KeyringConstructor - The constructor to use for building the keyring.
* @returns A keyring builder that uses `jest.fn()` to spy on invocations.
*/
function buildKeyringBuilderWithSpy(KeyringConstructor: KeyringClass<Json>): {
(): EthKeyring<Json>;
function buildKeyringBuilderWithSpy(KeyringConstructor: KeyringClass): {
(): EthKeyring;
type: string;
} {
const keyringBuilderWithSpy: { (): EthKeyring<Json>; type?: string } = jest
const keyringBuilderWithSpy: { (): EthKeyring; type?: string } = jest
.fn()
.mockImplementation((...args) => new KeyringConstructor(...args));
keyringBuilderWithSpy.type = KeyringConstructor.type;
// Not sure why TypeScript isn't smart enough to infer that `type` is set here.
return keyringBuilderWithSpy as { (): EthKeyring<Json>; type: string };
return keyringBuilderWithSpy as { (): EthKeyring; type: string };
}
Loading

0 comments on commit ee1e79d

Please sign in to comment.