Skip to content

Commit 5dac77e

Browse files
authored
Merge branch 'main' into feature/token-balances-integration
2 parents 5f3688c + 1198ad7 commit 5dac77e

File tree

16 files changed

+116
-1007
lines changed

16 files changed

+116
-1007
lines changed

eslint-warning-thresholds.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
},
2828
"packages/assets-controllers/src/NftDetectionController.test.ts": {
2929
"import-x/namespace": 6,
30-
"import-x/order": 4
30+
"import-x/order": 3
3131
},
3232
"packages/assets-controllers/src/NftDetectionController.ts": {
3333
"jsdoc/check-tag-names": 34,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@metamask/core-monorepo",
3-
"version": "611.0.0",
3+
"version": "613.0.0",
44
"private": true,
55
"description": "Monorepo for packages shared between MetaMask clients",
66
"repository": {

packages/account-tree-controller/CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Fixed
1111

12+
- Fix wallet metadata cleanup when wallets are completely removed ([#6813](https://github.com/MetaMask/core/pull/6813))
13+
14+
## [1.4.2]
15+
16+
### Fixed
17+
1218
- Ensure `isLegacyAccountSyncingDisabled` is always set in `UserStorageSyncedWallet` after one successful full sync ([#6805](https://github.com/MetaMask/core/pull/6805))
1319
- This was not set in some rare edge case scenarios, and created situations were legacy syncs would always be re-triggered during full syncs.
1420
- We now verify this field is correctly set, and also catch empty objects for `UserStorageSyncedWallet`.
@@ -359,7 +365,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
359365
- Initial release ([#5847](https://github.com/MetaMask/core/pull/5847))
360366
- Grouping accounts into 3 main categories: Entropy source, Snap ID, keyring types.
361367

362-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/account-tree-controller@1.4.1...HEAD
368+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/account-tree-controller@1.4.2...HEAD
369+
[1.4.2]: https://github.com/MetaMask/core/compare/@metamask/account-tree-controller@1.4.1...@metamask/account-tree-controller@1.4.2
363370
[1.4.1]: https://github.com/MetaMask/core/compare/@metamask/account-tree-controller@1.4.0...@metamask/account-tree-controller@1.4.1
364371
[1.4.0]: https://github.com/MetaMask/core/compare/@metamask/account-tree-controller@1.3.0...@metamask/account-tree-controller@1.4.0
365372
[1.3.0]: https://github.com/MetaMask/core/compare/@metamask/account-tree-controller@1.2.0...@metamask/account-tree-controller@1.3.0

packages/account-tree-controller/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@metamask/account-tree-controller",
3-
"version": "1.4.1",
3+
"version": "1.4.2",
44
"description": "Controller to group account together based on some pre-defined rules",
55
"keywords": [
66
"MetaMask",

packages/account-tree-controller/src/AccountTreeController.test.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,6 +1262,40 @@ describe('AccountTreeController', () => {
12621262
} as AccountTreeControllerState);
12631263
});
12641264

1265+
it('prunes custom wallet metadata when wallet is removed', () => {
1266+
const mockHdAccount1: Bip44Account<InternalAccount> = MOCK_HD_ACCOUNT_1;
1267+
1268+
const { controller, messenger } = setup({
1269+
accounts: [mockHdAccount1],
1270+
keyrings: [MOCK_HD_KEYRING_1],
1271+
});
1272+
1273+
controller.init();
1274+
1275+
const walletId = toMultichainAccountWalletId(
1276+
MOCK_HD_KEYRING_1.metadata.id,
1277+
);
1278+
1279+
// Set custom wallet name
1280+
controller.setAccountWalletName(walletId, 'My Custom Wallet');
1281+
1282+
// Verify custom metadata was set
1283+
expect(controller.state.accountWalletsMetadata[walletId]).toStrictEqual({
1284+
name: {
1285+
value: 'My Custom Wallet',
1286+
lastUpdatedAt: expect.any(Number),
1287+
},
1288+
});
1289+
1290+
// Remove the account, which should prune the wallet and its metadata
1291+
messenger.publish('AccountsController:accountRemoved', mockHdAccount1.id);
1292+
1293+
// Verify both wallet and its metadata are completely removed
1294+
expect(controller.state.accountTree.wallets[walletId]).toBeUndefined();
1295+
expect(controller.state.accountWalletsMetadata[walletId]).toBeUndefined();
1296+
expect(controller.state.accountWalletsMetadata).toStrictEqual({});
1297+
});
1298+
12651299
it('does not remove account if init has not been called', () => {
12661300
const { controller, messenger } = setup({
12671301
accounts: [MOCK_HD_ACCOUNT_1],

packages/account-tree-controller/src/AccountTreeController.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,8 @@ export class AccountTreeController extends BaseController<
891891

892892
if (Object.keys(wallets[walletId].groups).length === 0) {
893893
delete wallets[walletId];
894+
// Clean up metadata for the pruned wallet
895+
delete state.accountWalletsMetadata[walletId];
894896
}
895897
return state;
896898
}

packages/assets-controllers/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2929
- When WebSocket is connected, polling automatically adjusts to 5 minutes as a backup
3030
- Update `TokenBalancesController` README documentation to mention real-time balance updates via WebSocket and intelligent polling management ([#6784](https://github.com/MetaMask/core/pull/6784))
3131
- `TokenDetectionController` code cleanup: remove unused private properties and ESLint disable comments ([#6784](https://github.com/MetaMask/core/pull/6784))
32+
- **Performance Optimization:** Remove collection API calls from NFT detection process ([#6762](https://github.com/MetaMask/core/pull/6762))
33+
- Reduce NFT detection API calls by 83% (from 6 calls to 1 call per 100 tokens) by eliminating collection endpoint requests
34+
- Remove unused collection metadata fields: `contractDeployedAt`, `creator`, and `topBid`
3235

3336
## [79.0.1]
3437

packages/assets-controllers/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"devDependencies": {
8181
"@babel/runtime": "^7.23.9",
8282
"@metamask/account-api": "^0.12.0",
83-
"@metamask/account-tree-controller": "^1.4.1",
83+
"@metamask/account-tree-controller": "^1.4.2",
8484
"@metamask/accounts-controller": "^33.1.1",
8585
"@metamask/approval-controller": "^7.2.0",
8686
"@metamask/auto-changelog": "^3.4.4",
@@ -92,7 +92,7 @@
9292
"@metamask/multichain-account-service": "^1.6.1",
9393
"@metamask/network-controller": "^24.2.1",
9494
"@metamask/permission-controller": "^11.1.0",
95-
"@metamask/phishing-controller": "^14.1.1",
95+
"@metamask/phishing-controller": "^14.1.2",
9696
"@metamask/preferences-controller": "^20.0.2",
9797
"@metamask/providers": "^22.1.0",
9898
"@metamask/snaps-controllers": "^14.0.1",

0 commit comments

Comments
 (0)