Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
e939b22
refactor: replace withKeyring with withKeyringV2 in multichain accoun…
hmalik88 Apr 16, 2026
6b3d711
refactor: migrate EvmAccountProvider to use KeyringV2 interface
hmalik88 Apr 16, 2026
f114887
test: update MultichainAccountService test for withKeyringV2
hmalik88 Apr 16, 2026
69dee31
Merge remote-tracking branch 'origin/main' into hm/mul-1545
hmalik88 Apr 16, 2026
4f37340
fix: implement Keyring interface in MockHdKeyringV2 test mock
hmalik88 Apr 16, 2026
4dd112b
fix: update types in tests
hmalik88 Apr 16, 2026
ea53d9c
chore: update changelog
hmalik88 Apr 16, 2026
eae420a
Merge remote-tracking branch 'origin/main' into hm/mul-1545
hmalik88 Apr 16, 2026
44bf6db
fix: apply code review
hmalik88 Apr 16, 2026
462990e
fix: add override for snap providers to use withKeyring
hmalik88 Apr 16, 2026
e442d90
Merge remote-tracking branch 'origin/main' into hm/mul-1545
hmalik88 Apr 16, 2026
303547f
fix: type issues
hmalik88 Apr 16, 2026
b02e889
fix: use string instead of Hex
hmalik88 Apr 16, 2026
15f7986
fix: lint fix
hmalik88 Apr 16, 2026
b0359fd
Merge remote-tracking branch 'origin/main' into hm/mul-1545
hmalik88 Apr 30, 2026
f53848d
refactor: split withKeyring into withKeyringV2
hmalik88 Apr 30, 2026
df99513
refactor: revert discovery logic
hmalik88 Apr 30, 2026
60de56a
refactor: address type issues
hmalik88 Apr 30, 2026
0578780
refactor: reword changelog entry
hmalik88 Apr 30, 2026
ae898ff
Merge remote-tracking branch 'origin/main' into hm/mul-1545
hmalik88 Apr 30, 2026
9af81d4
fix: lint fix
hmalik88 Apr 30, 2026
6a8a859
Merge remote-tracking branch 'origin/main' into hm/mul-1545
hmalik88 May 4, 2026
f8f61b4
refactor: apply code review
hmalik88 May 4, 2026
72cafdc
Merge remote-tracking branch 'origin/main' into hm/mul-1545
hmalik88 May 4, 2026
1d54b67
refactor: address review
hmalik88 May 4, 2026
efd0921
Merge remote-tracking branch 'origin/main' into hm/mul-1545
hmalik88 May 4, 2026
620381d
fix: address bugbot comment
hmalik88 May 4, 2026
7e76877
Merge remote-tracking branch 'origin/main' into hm/mul-1545
hmalik88 May 4, 2026
4d78b16
refactor: throw when there's no created account
hmalik88 May 4, 2026
8135ccd
Merge remote-tracking branch 'origin/main' into hm/mul-1545
hmalik88 May 4, 2026
35a11df
test: update tests to account for removal of #getAccountId
hmalik88 May 4, 2026
cdf3ac5
fix: typo fix
hmalik88 May 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/multichain-account-service/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- **BREAKING:** Replace `KeyringController:withKeyring` with `KeyringController:withKeyringV2` for the EVM account provider ([#8491](https://github.com/MetaMask/core/pull/8491))
- Bump `@metamask/accounts-controller` from `^37.1.1` to `^38.0.0` ([#8363](https://github.com/MetaMask/core/pull/8363), [#8665](https://github.com/MetaMask/core/pull/8665))
- Bump `@metamask/keyring-controller` from `^25.1.1` to `^25.4.0` ([#8363](https://github.com/MetaMask/core/pull/8363), [#8634](https://github.com/MetaMask/core/pull/8634), [#8665](https://github.com/MetaMask/core/pull/8665))
- Bump `@metamask/messenger` from `^1.0.0` to `^1.2.0` ([#8364](https://github.com/MetaMask/core/pull/8364), [#8373](https://github.com/MetaMask/core/pull/8373), [#8632](https://github.com/MetaMask/core/pull/8632))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import {
SolAccountType,
TrxAccountType,
} from '@metamask/keyring-api';
import type { Keyring } from '@metamask/keyring-api/v2';
import { KeyringType } from '@metamask/keyring-api/v2';
import type { KeyringObject } from '@metamask/keyring-controller';
import type { EthKeyring } from '@metamask/keyring-internal-api';

import { traceFallback } from './analytics';
import { isPerfEnabled, withLocalPerfTrace } from './analytics/perf';
Expand Down Expand Up @@ -1537,13 +1538,13 @@ describe('MultichainAccountService', () => {
);

rootMessenger.registerActionHandler(
'KeyringController:withKeyring',
'KeyringController:withKeyringV2',
async (_, operation) => {
const newKeyring = mocks.KeyringController.keyrings.find(
(keyring) => keyring.type === 'HD Key Tree',
(keyring) => keyring.type === KeyringType.Hd,
) as KeyringObject;
return operation({
keyring: {} as unknown as EthKeyring,
keyring: {} as unknown as Keyring,
metadata: newKeyring.metadata,
});
},
Expand Down Expand Up @@ -1580,13 +1581,13 @@ describe('MultichainAccountService', () => {
);

rootMessenger.registerActionHandler(
'KeyringController:withKeyring',
'KeyringController:withKeyringV2',
async (_, operation) => {
const newKeyring = mocks.KeyringController.keyrings.find(
(keyring) => keyring.type === 'HD Key Tree',
) as KeyringObject;
return operation({
keyring: {} as unknown as EthKeyring,
keyring: {} as unknown as Keyring,
metadata: newKeyring.metadata,
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ import type {
EntropySourceId,
KeyringAccount,
} from '@metamask/keyring-api';
import type { KeyringCapabilities } from '@metamask/keyring-api/v2';
import type {
Keyring as KeyringV2,
KeyringCapabilities,
} from '@metamask/keyring-api/v2';
import type {
KeyringMetadata,
KeyringSelector,
KeyringSelectorV2,
} from '@metamask/keyring-controller';
import type { InternalAccount } from '@metamask/keyring-internal-api';

Expand Down Expand Up @@ -155,6 +159,17 @@ export abstract class BaseBip44AccountProvider<
) as unknown as Account;
}

/**
* Run an operation against a V1 keyring selected by `selector`.
*
* Forwards to `KeyringController:withKeyring`. Use this for keyrings that
* have not yet migrated to the unified V2 `Keyring` interface (e.g. the
* snap keyring).
*
* @param selector - The selector identifying the keyring.
* @param operation - The operation to run with the selected keyring.
* @returns The result of the operation.
*/
protected async withKeyring<SelectedKeyring, CallbackResult = void>(
selector: KeyringSelector,
operation: ({
Expand All @@ -178,6 +193,43 @@ export abstract class BaseBip44AccountProvider<
return result as CallbackResult;
}

/**
* Run an operation against a V2 keyring selected by `selector`.
*
* Forwards to `KeyringController:withKeyringV2`. Use this for keyrings
* that implement the unified V2 `Keyring` interface from
* `@metamask/keyring-api/v2`.
*
* @param selector - The selector identifying the keyring.
* @param operation - The operation to run with the selected keyring.
* @returns The result of the operation.
*/
protected async withKeyringV2<
SelectedKeyring extends KeyringV2 = KeyringV2,
CallbackResult = void,
>(
selector: KeyringSelectorV2<SelectedKeyring>,
operation: ({
keyring,
metadata,
}: {
keyring: SelectedKeyring;
metadata: KeyringMetadata;
}) => Promise<CallbackResult>,
): Promise<CallbackResult> {
const result = await this.messenger.call(
'KeyringController:withKeyringV2',
Comment thread
cursor[bot] marked this conversation as resolved.
selector,
({ keyring, metadata }) =>
operation({
keyring: keyring as SelectedKeyring,
metadata,
}),
);

return result as CallbackResult;
}

abstract get capabilities(): KeyringCapabilities;

abstract getName(): string;
Expand Down
Loading
Loading