Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion packages/account-tree-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Bump `@metamask/keyring-api` from `^23.1.0` to `^23.3.0` ([#9249](https://github.com/MetaMask/core/pull/9249))
- Bump `@metamask/keyring-api` from `^23.1.0` to `^23.4.0` ([#9249](https://github.com/MetaMask/core/pull/9249), [#9377](https://github.com/MetaMask/core/pull/9377))
- Bump `@metamask/multichain-account-service` from `^11.0.0` to `^11.1.0` ([#9264](https://github.com/MetaMask/core/pull/9264))
- Bump `@metamask/accounts-controller` from `^39.0.3` to `^39.0.4` ([#9349](https://github.com/MetaMask/core/pull/9349))

Expand Down
2 changes: 1 addition & 1 deletion packages/account-tree-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"dependencies": {
"@metamask/accounts-controller": "^39.0.4",
"@metamask/base-controller": "^9.1.0",
"@metamask/keyring-api": "^23.3.0",
"@metamask/keyring-api": "^23.4.0",
"@metamask/keyring-controller": "^27.1.0",
"@metamask/messenger": "^1.2.0",
"@metamask/multichain-account-service": "^11.1.0",
Expand Down
5 changes: 5 additions & 0 deletions packages/accounts-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- Bump `@metamask/eth-snap-keyring` from `^22.3.0` to `^22.4.0` ([#9377](https://github.com/MetaMask/core/pull/9377))
- Bump `@metamask/keyring-api` from `^23.3.0` to `^23.4.0` ([#9377](https://github.com/MetaMask/core/pull/9377))

## [39.0.4]

### Changed
Expand Down
4 changes: 2 additions & 2 deletions packages/accounts-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
"dependencies": {
"@ethereumjs/util": "^9.1.0",
"@metamask/base-controller": "^9.1.0",
"@metamask/eth-snap-keyring": "^22.3.0",
"@metamask/keyring-api": "^23.3.0",
"@metamask/eth-snap-keyring": "^22.4.0",
"@metamask/keyring-api": "^23.4.0",
"@metamask/keyring-controller": "^27.1.0",
"@metamask/keyring-internal-api": "^11.0.1",
"@metamask/keyring-sdk": "^2.2.0",
Expand Down
5 changes: 5 additions & 0 deletions packages/assets-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- Bump `@metamask/keyring-api` from `^23.3.0` to `^23.4.0` ([#9377](https://github.com/MetaMask/core/pull/9377))
- Bump `@metamask/keyring-snap-client` from `^9.0.2` to `^9.1.0` ([#9377](https://github.com/MetaMask/core/pull/9377))

## [10.0.1]

### Changed
Expand Down
4 changes: 2 additions & 2 deletions packages/assets-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@
"@metamask/client-controller": "^1.0.1",
"@metamask/controller-utils": "^12.3.0",
"@metamask/core-backend": "^6.5.0",
"@metamask/keyring-api": "^23.3.0",
"@metamask/keyring-api": "^23.4.0",
"@metamask/keyring-controller": "^27.1.0",
"@metamask/keyring-internal-api": "^11.0.1",
"@metamask/keyring-snap-client": "^9.0.2",
"@metamask/keyring-snap-client": "^9.1.0",
"@metamask/messenger": "^1.2.0",
"@metamask/network-controller": "^34.0.0",
"@metamask/network-enablement-controller": "^5.4.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-api` from `^23.3.0` to `^23.4.0` ([#9377](https://github.com/MetaMask/core/pull/9377))

## [109.3.0]

### Added
Expand Down
4 changes: 2 additions & 2 deletions packages/assets-controllers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"@metamask/controller-utils": "^12.3.0",
"@metamask/core-backend": "^6.5.0",
"@metamask/eth-query": "^4.0.0",
"@metamask/keyring-api": "^23.3.0",
"@metamask/keyring-api": "^23.4.0",
"@metamask/keyring-controller": "^27.1.0",
"@metamask/messenger": "^1.2.0",
"@metamask/metamask-eth-abis": "^3.1.1",
Expand Down Expand Up @@ -106,7 +106,7 @@
"@metamask/auto-changelog": "^6.1.0",
"@metamask/ethjs-provider-http": "^0.3.0",
"@metamask/keyring-internal-api": "^11.0.1",
"@metamask/keyring-snap-client": "^9.0.2",
"@metamask/keyring-snap-client": "^9.1.0",
"@metamask/providers": "^22.1.0",
"@ts-bridge/cli": "^0.6.4",
"@types/jest": "^29.5.14",
Expand Down
4 changes: 4 additions & 0 deletions packages/bridge-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-api` from `^23.3.0` to `^23.4.0` ([#9377](https://github.com/MetaMask/core/pull/9377))

## [77.3.2]

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion packages/bridge-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"@metamask/base-controller": "^9.1.0",
"@metamask/controller-utils": "^12.3.0",
"@metamask/gas-fee-controller": "^26.2.4",
"@metamask/keyring-api": "^23.3.0",
"@metamask/keyring-api": "^23.4.0",
"@metamask/messenger": "^1.2.0",
"@metamask/metamask-eth-abis": "^3.1.1",
"@metamask/multichain-network-controller": "^3.2.1",
Expand Down
4 changes: 4 additions & 0 deletions packages/earn-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-api` from `^23.3.0` to `^23.4.0` ([#9377](https://github.com/MetaMask/core/pull/9377))

## [12.2.2]

### Changed
Expand Down
2 changes: 1 addition & 1 deletion packages/earn-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"@metamask/account-tree-controller": "^7.5.3",
"@metamask/base-controller": "^9.1.0",
"@metamask/controller-utils": "^12.3.0",
"@metamask/keyring-api": "^23.3.0",
"@metamask/keyring-api": "^23.4.0",
"@metamask/messenger": "^1.2.0",
"@metamask/network-controller": "^34.0.0",
"@metamask/stake-sdk": "^3.2.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/keyring-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Bump `@metamask/keyring-api` from `^23.1.0` to `^23.3.0` ([#9249](https://github.com/MetaMask/core/pull/9249))
- Bump `@metamask/keyring-api` from `^23.1.0` to `^23.4.0` ([#9249](https://github.com/MetaMask/core/pull/9249), [#9377](https://github.com/MetaMask/core/pull/9377))

## [27.1.0]

Expand Down
2 changes: 1 addition & 1 deletion packages/keyring-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"@metamask/eth-hd-keyring": "^14.1.1",
"@metamask/eth-sig-util": "^8.2.0",
"@metamask/eth-simple-keyring": "^12.0.2",
"@metamask/keyring-api": "^23.3.0",
"@metamask/keyring-api": "^23.4.0",
"@metamask/keyring-internal-api": "^11.0.1",
"@metamask/messenger": "^1.2.0",
"@metamask/utils": "^11.11.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/money-account-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Bump `@metamask/utils` from `^11.9.0` to `^11.11.0` ([#9074](https://github.com/MetaMask/core/pull/9074))
- Bump `@metamask/keyring-controller` from `^27.0.0` to `^27.1.0` ([#9129](https://github.com/MetaMask/core/pull/9129))
- Bump `@metamask/accounts-controller` from `^39.0.1` to `^39.0.4` ([#9218](https://github.com/MetaMask/core/pull/9218), [#9231](https://github.com/MetaMask/core/pull/9231), [#9349](https://github.com/MetaMask/core/pull/9349))
- Bump `@metamask/keyring-api` from `^23.1.0` to `^23.3.0` ([#9249](https://github.com/MetaMask/core/pull/9249))
- Bump `@metamask/keyring-api` from `^23.1.0` to `^23.4.0` ([#9249](https://github.com/MetaMask/core/pull/9249), [#9377](https://github.com/MetaMask/core/pull/9377))

## [0.3.3]

Expand Down
2 changes: 1 addition & 1 deletion packages/money-account-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"@metamask/accounts-controller": "^39.0.4",
"@metamask/base-controller": "^9.1.0",
"@metamask/eth-money-keyring": "^2.0.4",
"@metamask/keyring-api": "^23.3.0",
"@metamask/keyring-api": "^23.4.0",
"@metamask/keyring-controller": "^27.1.0",
"@metamask/messenger": "^1.2.0",
"async-mutex": "^0.5.0"
Expand Down
10 changes: 9 additions & 1 deletion packages/multichain-account-service/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Adds `MultichainAccountGroup.isProviderAligned(provider)` to check alignment per provider ([#9269](https://github.com/MetaMask/core/pull/9269))
- Capability-gated v1/v2 keyring client selection for Snap account providers ([#9377](https://github.com/MetaMask/core/pull/9377))
- Providers resolve a Snap's capabilities via `SnapAccountService:getCapabilities` and route account creation and discovery through the v1 or v2 keyring client accordingly (a Snap that declares BIP-44 capabilities is treated as v2).
- Account discovery for v2 Snaps that declare `bip44.discover` flows through `createAccounts({ bip44:discover })`; v1 Snaps keep using the `discoverAccounts` client method.

### Changed

- **BREAKING:** Remove `batched` from `SnapAccountProviderConfig['createAccounts']` ([#9377](https://github.com/MetaMask/core/pull/9377))
- Batching is now derived from the Snap's capabilities (v2 Snaps that declare `bip44` use the `createAccounts` flow, since they expose no singular `createAccount`) instead of static config.
- Bump `@metamask/eth-snap-keyring` from `^22.3.0` to `^22.4.0` ([#9377](https://github.com/MetaMask/core/pull/9377))
- Bump `@metamask/keyring-api` from `^23.3.0` to `^23.4.0` ([#9377](https://github.com/MetaMask/core/pull/9377))
- Bump `@metamask/keyring-snap-client` from `^9.0.2` to `^9.1.0` ([#9377](https://github.com/MetaMask/core/pull/9377))
- Adds `MultichainAccountGroup.isProviderAligned(provider)` to check alignment per provider ([#9269](https://github.com/MetaMask/core/pull/9269))
- Wallet alignment now only creates the missing `(provider, group index)` pairs instead of re-creating the whole range for every provider, avoiding redundant `createAccounts` calls (and their traces) ([#9269](https://github.com/MetaMask/core/pull/9269))
- Bump `@metamask/accounts-controller` from `^39.0.3` to `^39.0.4` ([#9349](https://github.com/MetaMask/core/pull/9349))

Expand Down
6 changes: 3 additions & 3 deletions packages/multichain-account-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@
"@ethereumjs/util": "^9.1.0",
"@metamask/accounts-controller": "^39.0.4",
"@metamask/base-controller": "^9.1.0",
"@metamask/eth-snap-keyring": "^22.3.0",
"@metamask/eth-snap-keyring": "^22.4.0",
"@metamask/key-tree": "^10.1.1",
"@metamask/keyring-api": "^23.3.0",
"@metamask/keyring-api": "^23.4.0",
"@metamask/keyring-controller": "^27.1.0",
"@metamask/keyring-internal-api": "^11.0.1",
"@metamask/keyring-snap-client": "^9.0.2",
"@metamask/keyring-snap-client": "^9.1.0",
"@metamask/keyring-utils": "^3.3.1",
"@metamask/messenger": "^1.2.0",
"@metamask/snap-account-service": "^1.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { isBip44Account } from '@metamask/account-api';
import { AccountCreationType, BtcAccountType } from '@metamask/keyring-api';
import {
AccountCreationType,
BtcAccountType,
BtcScope,
} from '@metamask/keyring-api';
import type { KeyringCapabilities } from '@metamask/keyring-api/v2';
import type { KeyringMetadata } from '@metamask/keyring-controller';
import type { InternalAccount } from '@metamask/keyring-internal-api';
import { SnapControllerState } from '@metamask/snaps-controllers';
Expand Down Expand Up @@ -35,6 +40,19 @@ function asConfig(
) as SnapAccountProviderConfig;
}

/**
* v2 capabilities as declared by a fully v2-compliant Bitcoin Snap manifest.
* Drives the batched `createAccounts` flow and the v2 discovery path.
*/
const BTC_V2_CAPABILITIES: KeyringCapabilities = {
scopes: [BtcScope.Mainnet],
bip44: {
deriveIndex: true,
deriveIndexRange: true,
discover: true,
},
};

class MockBtcKeyring {
readonly type = 'MockBtcKeyring';

Expand Down Expand Up @@ -147,16 +165,19 @@ class MockBtcAccountProvider extends BtcAccountProvider {
* @param options.messenger - An optional messenger instance to use. Defaults to a new Messenger.
* @param options.accounts - List of accounts to use.
* @param options.config - Provider config.
* @param options.capabilities - The Snap keyring capabilities to expose via `SnapAccountService:getCapabilities`.
* @returns An object containing the controller instance and the messenger.
*/
function setup({
messenger = getRootMessenger(),
accounts = [],
config,
capabilities = { scopes: [] },
}: {
messenger?: RootMessenger;
accounts?: InternalAccount[];
config?: SnapAccountProviderConfig;
capabilities?: KeyringCapabilities;
} = {}): {
provider: AccountProviderWrapper;
messenger: RootMessenger;
Expand All @@ -182,6 +203,11 @@ function setup({
() => ({ isReady: true }) as SnapControllerState,
);

messenger.registerActionHandler(
'SnapAccountService:getCapabilities',
async () => capabilities,
);

messenger.registerActionHandler(
'AccountsController:listMultichainAccounts',
() => accounts,
Expand Down Expand Up @@ -300,8 +326,8 @@ describe('BtcAccountProvider', () => {
const accounts = [MOCK_BTC_P2WPKH_ACCOUNT_1];
const { provider, mocks } = setup({
accounts,
// Force v1 by not providing the config at all, so it relies on the default value.
config: asConfig({ createAccounts: { batched: undefined } }),
// No capabilities provided → defaults to an empty capability set, so
// the provider falls back to the v1 (non-batched) flow.
});

await provider.createAccounts({
Expand Down Expand Up @@ -464,7 +490,7 @@ describe('BtcAccountProvider', () => {
const accounts = [MOCK_BTC_P2WPKH_ACCOUNT_1];
const { provider, mocks } = setup({
accounts,
config: asConfig({ createAccounts: { batched: true } }),
capabilities: BTC_V2_CAPABILITIES,
});

const newGroupIndex = accounts.length; // Group-index are 0-based.
Expand All @@ -487,7 +513,7 @@ describe('BtcAccountProvider', () => {
const accounts = [MOCK_BTC_P2WPKH_ACCOUNT_1];
const { provider } = setup({
accounts,
config: asConfig({ createAccounts: { batched: true } }),
capabilities: BTC_V2_CAPABILITIES,
});

const newAccounts = await provider.createAccounts({
Expand All @@ -503,7 +529,7 @@ describe('BtcAccountProvider', () => {
const accounts = [MOCK_BTC_P2WPKH_ACCOUNT_1];
const { provider, mocks } = setup({
accounts,
config: asConfig({ createAccounts: { batched: true } }),
capabilities: BTC_V2_CAPABILITIES,
});

const from = 1;
Expand All @@ -528,7 +554,7 @@ describe('BtcAccountProvider', () => {
it('creates accounts with range starting from 0', async () => {
const { provider, mocks } = setup({
accounts: [],
config: asConfig({ createAccounts: { batched: true } }),
capabilities: BTC_V2_CAPABILITIES,
});

const newAccounts = await provider.createAccounts({
Expand All @@ -545,7 +571,7 @@ describe('BtcAccountProvider', () => {
it('creates a single account when range from equals to', async () => {
const { provider, mocks } = setup({
accounts: [],
config: asConfig({ createAccounts: { batched: true } }),
capabilities: BTC_V2_CAPABILITIES,
});

const newAccounts = await provider.createAccounts({
Expand All @@ -566,7 +592,7 @@ describe('BtcAccountProvider', () => {
it('throws if the account creation process takes too long', async () => {
const { provider, mocks } = setup({
accounts: [],
config: asConfig({ createAccounts: { batched: true } }),
capabilities: BTC_V2_CAPABILITIES,
});

mocks.keyring.createAccounts.mockImplementation(
Expand Down
Loading