Skip to content

Commit a9996d2

Browse files
authored
Merge branch 'main' into release/724.0.0
2 parents d61b2c1 + 30c8a38 commit a9996d2

33 files changed

+512
-456
lines changed

eslint-suppressions.json

Lines changed: 0 additions & 193 deletions
Original file line numberDiff line numberDiff line change
@@ -1560,33 +1560,6 @@
15601560
"count": 3
15611561
}
15621562
},
1563-
"packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.test.ts": {
1564-
"@typescript-eslint/explicit-function-return-type": {
1565-
"count": 23
1566-
},
1567-
"id-length": {
1568-
"count": 7
1569-
}
1570-
},
1571-
"packages/notification-services-controller/src/NotificationServicesController/NotificationServicesController.ts": {
1572-
"@typescript-eslint/explicit-function-return-type": {
1573-
"count": 31
1574-
},
1575-
"@typescript-eslint/no-misused-promises": {
1576-
"count": 1
1577-
},
1578-
"id-denylist": {
1579-
"count": 5
1580-
},
1581-
"id-length": {
1582-
"count": 8
1583-
}
1584-
},
1585-
"packages/notification-services-controller/src/NotificationServicesController/__fixtures__/mockServices.ts": {
1586-
"@typescript-eslint/explicit-function-return-type": {
1587-
"count": 6
1588-
}
1589-
},
15901563
"packages/notification-services-controller/src/NotificationServicesController/constants/notification-schema.ts": {
15911564
"@typescript-eslint/naming-convention": {
15921565
"count": 18
@@ -1602,30 +1575,6 @@
16021575
"count": 1
16031576
}
16041577
},
1605-
"packages/notification-services-controller/src/NotificationServicesController/services/feature-announcements.ts": {
1606-
"@typescript-eslint/explicit-function-return-type": {
1607-
"count": 2
1608-
},
1609-
"@typescript-eslint/naming-convention": {
1610-
"count": 2
1611-
},
1612-
"@typescript-eslint/prefer-nullish-coalescing": {
1613-
"count": 2
1614-
},
1615-
"id-length": {
1616-
"count": 3
1617-
}
1618-
},
1619-
"packages/notification-services-controller/src/NotificationServicesController/services/notification-config-cache.ts": {
1620-
"@typescript-eslint/naming-convention": {
1621-
"count": 1
1622-
}
1623-
},
1624-
"packages/notification-services-controller/src/NotificationServicesController/services/perp-notifications.test.ts": {
1625-
"@typescript-eslint/explicit-function-return-type": {
1626-
"count": 1
1627-
}
1628-
},
16291578
"packages/notification-services-controller/src/NotificationServicesController/services/perp-notifications.ts": {
16301579
"@typescript-eslint/explicit-function-return-type": {
16311580
"count": 1
@@ -1689,27 +1638,6 @@
16891638
"count": 9
16901639
}
16911640
},
1692-
"packages/notification-services-controller/src/NotificationServicesPushController/web/push-utils.test.ts": {
1693-
"@typescript-eslint/explicit-function-return-type": {
1694-
"count": 10
1695-
},
1696-
"no-restricted-globals": {
1697-
"count": 3
1698-
}
1699-
},
1700-
"packages/notification-services-controller/src/NotificationServicesPushController/web/push-utils.ts": {
1701-
"@typescript-eslint/explicit-function-return-type": {
1702-
"count": 7
1703-
},
1704-
"require-atomic-updates": {
1705-
"count": 1
1706-
}
1707-
},
1708-
"packages/notification-services-controller/src/shared/is-onchain-notification.ts": {
1709-
"id-length": {
1710-
"count": 1
1711-
}
1712-
},
17131641
"packages/phishing-controller/src/BulkTokenScan.test.ts": {
17141642
"@typescript-eslint/explicit-function-return-type": {
17151643
"count": 2
@@ -2317,126 +2245,5 @@
23172245
"@typescript-eslint/naming-convention": {
23182246
"count": 1
23192247
}
2320-
},
2321-
"scripts/create-package/cli.test.ts": {
2322-
"@typescript-eslint/explicit-function-return-type": {
2323-
"count": 2
2324-
}
2325-
},
2326-
"scripts/create-package/cli.ts": {
2327-
"@typescript-eslint/explicit-function-return-type": {
2328-
"count": 1
2329-
}
2330-
},
2331-
"scripts/create-package/fs-utils.ts": {
2332-
"@typescript-eslint/explicit-function-return-type": {
2333-
"count": 2
2334-
}
2335-
},
2336-
"scripts/create-package/index.test.ts": {
2337-
"import-x/no-unassigned-import": {
2338-
"count": 1
2339-
}
2340-
},
2341-
"scripts/create-package/utils.test.ts": {
2342-
"import-x/no-named-as-default-member": {
2343-
"count": 2
2344-
}
2345-
},
2346-
"scripts/create-package/utils.ts": {
2347-
"@typescript-eslint/explicit-function-return-type": {
2348-
"count": 1
2349-
}
2350-
},
2351-
"scripts/generate-method-action-types.ts": {
2352-
"@typescript-eslint/explicit-function-return-type": {
2353-
"count": 2
2354-
},
2355-
"n/no-sync": {
2356-
"count": 1
2357-
},
2358-
"no-negated-condition": {
2359-
"count": 1
2360-
}
2361-
},
2362-
"scripts/generate-preview-build-message.ts": {
2363-
"@typescript-eslint/explicit-function-return-type": {
2364-
"count": 1
2365-
}
2366-
},
2367-
"scripts/lint-teams-json.ts": {
2368-
"@typescript-eslint/explicit-function-return-type": {
2369-
"count": 1
2370-
}
2371-
},
2372-
"scripts/update-readme-content.ts": {
2373-
"@typescript-eslint/explicit-function-return-type": {
2374-
"count": 2
2375-
}
2376-
},
2377-
"tests/fake-block-tracker.ts": {
2378-
"@typescript-eslint/explicit-function-return-type": {
2379-
"count": 3
2380-
},
2381-
"no-empty-function": {
2382-
"count": 1
2383-
}
2384-
},
2385-
"tests/fake-provider.ts": {
2386-
"@typescript-eslint/explicit-function-return-type": {
2387-
"count": 5
2388-
},
2389-
"@typescript-eslint/prefer-promise-reject-errors": {
2390-
"count": 1
2391-
}
2392-
},
2393-
"tests/helpers.ts": {
2394-
"@typescript-eslint/explicit-function-return-type": {
2395-
"count": 1
2396-
},
2397-
"@typescript-eslint/naming-convention": {
2398-
"count": 1
2399-
},
2400-
"no-param-reassign": {
2401-
"count": 1
2402-
}
2403-
},
2404-
"tests/mock-network.ts": {
2405-
"@typescript-eslint/explicit-function-return-type": {
2406-
"count": 1
2407-
}
2408-
},
2409-
"tests/setup.ts": {
2410-
"import-x/no-unassigned-import": {
2411-
"count": 1
2412-
}
2413-
},
2414-
"tests/setupAfterEnv/index.ts": {
2415-
"import-x/no-unassigned-import": {
2416-
"count": 2
2417-
}
2418-
},
2419-
"tests/setupAfterEnv/matchers.ts": {
2420-
"@typescript-eslint/explicit-function-return-type": {
2421-
"count": 4
2422-
},
2423-
"id-length": {
2424-
"count": 2
2425-
}
2426-
},
2427-
"tests/setupAfterEnv/nock.ts": {
2428-
"import-x/no-named-as-default-member": {
2429-
"count": 3
2430-
}
2431-
},
2432-
"types/global.d.ts": {
2433-
"@typescript-eslint/naming-convention": {
2434-
"count": 1
2435-
}
2436-
},
2437-
"yarn.config.cjs": {
2438-
"no-restricted-syntax": {
2439-
"count": 2
2440-
}
24412248
}
24422249
}

packages/assets-controllers/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
### Changed
1515

16+
- **BREAKING:** `AccountTrackerController` now requires `KeyringController:getState` action and `KeyringController:lock` event in addition to existing allowed actions and events ([#7492](https://github.com/MetaMask/core/pull/7492))
17+
- Added `#isLocked` property to track keyring lock state, initialized from `KeyringController:getState`
18+
- Added `isActive` getter that returns `true` when keyring is unlocked and user is onboarded
19+
- Balance updates are now skipped when controller is not active (locked or not onboarded)
20+
- `KeyringController:unlock` event now only updates lock state without triggering immediate refresh
21+
- `KeyringController:lock` event sets controller to inactive state
22+
- `AccountTrackerController` now only refreshes balances for the newly added network on `NetworkController:networkAdded` event instead of all networks ([#7492](https://github.com/MetaMask/core/pull/7492))
1623
- Bump `@metamask/transaction-controller` from `^62.5.0` to `^62.7.0` ([#7494](https://github.com/MetaMask/core/pull/7494))
1724

1825
## [94.1.0]

packages/assets-controllers/src/AccountTrackerController.test.ts

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -388,10 +388,14 @@ describe('AccountTrackerController', () => {
388388
stakedBalances: {},
389389
});
390390

391-
messenger.publish(
392-
'NetworkController:networkAdded',
393-
{} as NetworkConfiguration,
394-
);
391+
messenger.publish('NetworkController:networkAdded', {
392+
chainId: '0x1',
393+
blockExplorerUrls: [],
394+
name: 'Mainnet',
395+
nativeCurrency: 'ETH',
396+
defaultRpcEndpointIndex: 0,
397+
rpcEndpoints: [{ networkClientId: 'mainnet' }],
398+
} as unknown as NetworkConfiguration);
395399

396400
await clock.tickAsync(1);
397401

@@ -402,29 +406,23 @@ describe('AccountTrackerController', () => {
402406
);
403407
});
404408

405-
it('refreshes addresses when keyring is unlocked', async () => {
409+
it('sets isActive to true when keyring is unlocked', async () => {
406410
await withController(
407411
{
408412
selectedAccount: ACCOUNT_1,
409413
listAccounts: [ACCOUNT_1],
410414
},
411415
async ({ controller, messenger }) => {
412-
mockedGetTokenBalancesForMultipleAddresses.mockResolvedValueOnce({
413-
tokenBalances: {
414-
'0x0000000000000000000000000000000000000000': {
415-
[ADDRESS_1]: new BN('abcdef', 16),
416-
},
417-
},
418-
stakedBalances: {},
419-
});
416+
// Verify controller is active initially (unlocked by default in tests)
417+
expect(controller.isActive).toBe(true);
420418

421-
messenger.publish('KeyringController:unlock');
422-
423-
await clock.tickAsync(1);
419+
// Lock the keyring
420+
messenger.publish('KeyringController:lock');
421+
expect(controller.isActive).toBe(false);
424422

425-
expect(
426-
controller.state.accountsByChainId['0x1'][CHECKSUM_ADDRESS_1].balance,
427-
).toBe('0xabcdef');
423+
// Unlock the keyring
424+
messenger.publish('KeyringController:unlock');
425+
expect(controller.isActive).toBe(true);
428426
},
429427
);
430428
});
@@ -2033,6 +2031,11 @@ async function withController<ReturnValue>(
20332031
mockNetworkState,
20342032
);
20352033

2034+
messenger.registerActionHandler(
2035+
'KeyringController:getState',
2036+
jest.fn().mockReturnValue({ isUnlocked: true }),
2037+
);
2038+
20362039
const accountTrackerMessenger = new Messenger<
20372040
'AccountTrackerController',
20382041
AllAccountTrackerControllerActions,
@@ -2050,12 +2053,14 @@ async function withController<ReturnValue>(
20502053
'PreferencesController:getState',
20512054
'AccountsController:getSelectedAccount',
20522055
'AccountsController:listAccounts',
2056+
'KeyringController:getState',
20532057
],
20542058
events: [
20552059
'AccountsController:selectedEvmAccountChange',
20562060
'TransactionController:unapprovedTransactionAdded',
20572061
'TransactionController:transactionConfirmed',
20582062
'NetworkController:networkAdded',
2063+
'KeyringController:lock',
20592064
'KeyringController:unlock',
20602065
],
20612066
});

0 commit comments

Comments
 (0)