Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
a89a2c7
feat(multichain-account-service): add bip44:derive-index-range support
ccharly Feb 10, 2026
8c4cf2b
test: add test for createMultichainAccountGroups
ccharly Feb 10, 2026
38ba35e
test: add missing tests
ccharly Feb 10, 2026
77c1cef
chore: cosmetic
ccharly Feb 10, 2026
580f869
chore: lint
ccharly Feb 10, 2026
9abe68a
refactor: implement proper batching for EvmAccountProvider
ccharly Feb 10, 2026
061a705
chore: lint
ccharly Feb 10, 2026
0aa470e
chore: update changelog
ccharly Feb 10, 2026
553962c
chore: cosmetic
ccharly Feb 11, 2026
608c680
refactor: re-write logic to use range account creations for non-EVM too
ccharly Feb 11, 2026
0903012
fix: fix error messages + test expecting empty groups
ccharly Feb 11, 2026
25e5973
refactor: jsdocs + better naming
ccharly Feb 11, 2026
669dbd4
Merge branch 'main' into cc/feat/snap-keyring-createAccounts
ccharly Feb 11, 2026
a887c95
test: try to fix async test
ccharly Feb 11, 2026
cb0e654
ci: debug
ccharly Feb 11, 2026
0703cb8
fix: prevent from pushing same group twice (race condition)
ccharly Feb 11, 2026
0d0b36e
Revert "ci: debug"
ccharly Feb 11, 2026
76b3005
fix: fix message format
ccharly Feb 11, 2026
6e9d62f
refactor: refactor #setState
ccharly Feb 11, 2026
d224943
fix: prevent double publish
ccharly Feb 11, 2026
8edbf7c
Merge branch 'main' into cc/feat/snap-keyring-createAccounts
ccharly Feb 11, 2026
fea34b4
fix: add global catch for background operation
ccharly Feb 11, 2026
8b3a0f6
test: add missing coverage
ccharly Feb 11, 2026
0e5dac3
chore: lint
ccharly Feb 11, 2026
97f2b71
Merge branch 'main' into cc/feat/snap-keyring-createAccounts
ccharly Mar 4, 2026
f8377b3
chore: add comments
ccharly Mar 4, 2026
cafc5ce
fix: use allSettled in non-background mode to avoid orphan executions
ccharly Mar 4, 2026
6430c11
fix: fix potential gap when creating multiple groups
ccharly Mar 4, 2026
8c978cc
chore: cosmetic
ccharly Mar 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
8 changes: 0 additions & 8 deletions eslint-suppressions.json
Original file line number Diff line number Diff line change
Expand Up @@ -1086,14 +1086,6 @@
"count": 7
}
},
"packages/multichain-account-service/src/utils.ts": {
"@typescript-eslint/explicit-function-return-type": {
"count": 1
},
"id-denylist": {
"count": 1
}
},
"packages/multichain-api-middleware/src/handlers/types.ts": {
"@typescript-eslint/naming-convention": {
"count": 2
Expand Down
9 changes: 9 additions & 0 deletions packages/multichain-account-service/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Add new `createMultichainAccountGroups` support to create multiple groups in batch ([#7801](https://github.com/MetaMask/core/pull/7801))

### Changed

- Optimize `EvmAccountProvider.createAccounts` for range operations ([#7801](https://github.com/MetaMask/core/pull/7801))
- Batch account creation with single a `withKeyring` call for entire range instead of one call per account.
- Batch account creation with single `keyring.addAccounts` call.
- Fetch all accounts in single `AccountsController:getAccounts` call instead of multiple `getAccount` calls.
- Significantly reduces lock acquisitions and API calls for batch operations.
- Bump `@metamask/accounts-controller` from `^36.0.0` to `^36.0.1` ([#7996](https://github.com/MetaMask/core/pull/7996))

## [7.0.0]
Expand Down
24 changes: 11 additions & 13 deletions packages/multichain-account-service/src/MultichainAccountGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import type { MultichainAccountWallet } from './MultichainAccountWallet';
import type { Bip44AccountProvider } from './providers';
import { isAccountProviderWrapper } from './providers';
import type { MultichainAccountServiceMessenger } from './types';
import { createSentryError } from './utils';
import { createSentryError, toErrorMessage } from './utils';

export type GroupState =
ServiceState[StateKeys['entropySource']][StateKeys['groupIndex']];
Expand Down Expand Up @@ -108,15 +108,6 @@ export class MultichainAccountGroup<
}
}
}

if (this.#initialized) {
this.#messenger.publish(
'MultichainAccountService:multichainAccountGroupUpdated',
this,
);
} else {
this.#initialized = true;
}
}

/**
Expand All @@ -128,6 +119,8 @@ export class MultichainAccountGroup<
this.#log('Initializing group state...');
this.#setState(groupState);
this.#log('Finished initializing group state...');

this.#initialized = true;
}

/**
Expand All @@ -139,6 +132,13 @@ export class MultichainAccountGroup<
this.#log('Updating group state...');
this.#setState(groupState);
this.#log('Finished updating group state...');

if (this.#initialized) {
this.#messenger.publish(
'MultichainAccountService:multichainAccountGroupUpdated',
this,
);
}
}

/**
Expand Down Expand Up @@ -298,9 +298,7 @@ export class MultichainAccountGroup<
return accounts;
} catch (error) {
// istanbul ignore next
this.#log(
`${WARNING_PREFIX} ${error instanceof Error ? error.message : String(error)}`,
);
this.#log(`${WARNING_PREFIX} ${toErrorMessage(error)}`);
const sentryError = createSentryError(
`Unable to align accounts with provider "${provider.getName()}"`,
error as Error,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,19 @@ export type MultichainAccountServiceCreateMultichainAccountGroupAction = {
handler: MultichainAccountService['createMultichainAccountGroup'];
};

/**
* Creates multiple multichain account groups up to maxGroupIndex.
*
* @param params - Parameters for creating account groups.
* @param params.entropySource - The entropy source ID.
* @param params.maxGroupIndex - Maximum group index to create (0 to maxGroupIndex inclusive).
* @returns Array of created multichain account groups.
*/
export type MultichainAccountServiceCreateMultichainAccountGroupsAction = {
type: `MultichainAccountService:createMultichainAccountGroups`;
handler: MultichainAccountService['createMultichainAccountGroups'];
};

/**
* Set basic functionality state and trigger alignment if enabled.
* When basic functionality is disabled, snap-based providers are disabled.
Expand Down Expand Up @@ -186,6 +199,7 @@ export type MultichainAccountServiceMethodActions =
| MultichainAccountServiceGetMultichainAccountGroupsAction
| MultichainAccountServiceCreateNextMultichainAccountGroupAction
| MultichainAccountServiceCreateMultichainAccountGroupAction
| MultichainAccountServiceCreateMultichainAccountGroupsAction
| MultichainAccountServiceSetBasicFunctionalityAction
| MultichainAccountServiceAlignWalletsAction
| MultichainAccountServiceAlignWalletAction;
Loading
Loading