Uh oh!
There was an error while loading. Please reload this page.
[token-detection-controller] Add tests for API changes from merge with DetectTokensController - #3867
Conversation
4594d8e to
1bfdd2eCompare24f2d73 to
11da214Comparemcmire
commented
Feb 8, 2024
I'll wait until the parent PR is merged before giving final approval on this PR. |
5f9f474 to
09cac7fComparea89ad4a to
e945bb7Comparee945bb7 to
a527b1dCompare
mcmire
left a comment
There was a problem hiding this comment.
Aside from the nitpicks I had one question.
There was a problem hiding this comment.
Nit: false is a boolean, not a string:
| describe('when "disabled" is "false"',()=>{ | |
| describe('when "disabled" is false',()=>{ |
There was a problem hiding this comment.
Similar as previous nit:
| describe('when "disabled" is "true"',()=>{ | |
| describe('when "disabled" is true',()=>{ |
There was a problem hiding this comment.
I'm curious if adding a new option here could confuse people reading the tests into thinking that the controller takes this option. For other test files I've been purposely limiting options to just whatever options the controller takes for this reason. Should isKeyringUnlocked be a separate option in WithControllerOptions?
There was a problem hiding this comment.
I wasn't sure where to put isKeyringUnlocked, but I like the idea of keeping options limited to controller constructor.
Applied here: 95b34ac
…at controller initialization
…alse and network is not mainnet
commit a89ad4ab0d9eeb4fc23ec56c193cd3d4b411fe9f Merge: 5bb296bd8 a3863017c Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Thu Feb 8 13:09:36 2024 -0500 Merge branch '231220-TokensController-v2-migration' into 230129-token-detection-controller-merge-tests commit a3863017c058ce071d36ce7ba09dc46dd3bef25d Merge: 5200f854f 582b370 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Thu Feb 8 13:09:06 2024 -0500 Merge branch '230113-consolidate-TokenDetectionController-DetectTokensController' into 231220-TokensController-v2-migration commit 582b370 Merge: 4a944d8065fd91 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Thu Feb 8 13:08:19 2024 -0500 Merge branch 'main' into 230113-consolidate-TokenDetectionController-DetectTokensController commit 5200f854f933a809d59f32299ac9a34a7416c685 Merge: 68999bed4 4a944d8 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Wed Feb 7 13:54:44 2024 -0500 Merge branch '230113-consolidate-TokenDetectionController-DetectTokensController' into 231220-TokensController-v2-migration commit 4a944d8 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Wed Feb 7 13:44:59 2024 -0500 Apply suggestions to CHANGELOG Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com> commit 5bb296bd80d045b96fadabc607f0085314786c2c Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Tue Feb 6 18:43:56 2024 -0500 test: Add test case for `trackMetaMetricsEvent` call commit f203b9e11adbb7be4ddef0a5f5d8906d0a0b0a68 Merge: 1bfdd2e37 68999bed4 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Tue Feb 6 18:00:51 2024 -0500 Merge branch '231220-TokensController-v2-migration' into 230129-token-detection-controller-merge-tests commit 68999bed480b67becf9c90d37e5ff76d7021a46c Merge: 11da214f5 e01f993 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Tue Feb 6 17:58:58 2024 -0500 Merge branch '230113-consolidate-TokenDetectionController-DetectTokensController' into 231220-TokensController-v2-migration commit e01f993 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Tue Feb 6 17:56:39 2024 -0500 test: adjust coverage thresholds commit 11da214f5cf173d15b3a657353f89b6ae96071d5 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Tue Feb 6 17:54:53 2024 -0500 test: adjust coverage thresholds commit 01cf7967c948244a6a95d16b72c3511dd3ecae5e Merge: d501062c5 88eb7ca Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Tue Feb 6 17:53:49 2024 -0500 Merge branch '230113-consolidate-TokenDetectionController-DetectTokensController' into 231220-TokensController-v2-migration commit d501062c585dc3716c45b541369e0f3e63f10853 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Tue Feb 6 16:50:02 2024 -0500 [token-detection-controller] Fix typing for `STATIC_MAINNET_TOKEN_LIST` commit 8556d7af546cf9f0aa19c107f7160fd73bdde487 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Tue Feb 6 16:49:37 2024 -0500 [token-detection-controller] Fix `detectTokens` to remove redundant `TokensController:getState` calls for `ignoredTokens` commit 88eb7ca Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Tue Feb 6 15:31:40 2024 -0500 Replace `detectTokens` with `#restartTokenDetection` in `networkDidChange` listener commit 91be385 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Tue Feb 6 09:19:18 2024 -0500 Include `#stopPolling()` call in `KeyringController:lock` listener commit 9a4ae93 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Wed Jan 31 10:28:32 2024 -0500 In changelog, move new actions/events under "Added" heading commit 312e450 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Mon Jan 29 13:31:43 2024 -0500 In networkDidChange event listener, detect tokens if `networkClientId` is changed instead of `chainId`, and avoid resetting polling interval commit 04df278 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Jan 26 16:24:46 2024 -0500 Changelog linter fix commit 907b4df Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Jan 26 11:02:38 2024 -0500 test: remove unnecessary action handler unregisters commit f1af71a Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Jan 26 10:51:50 2024 -0500 Use `networkClientId` instead of `chainId` in `#restartTokenDetection` commit 7c25f3c Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Jan 26 10:49:10 2024 -0500 Extract `findCaseInsensitiveMatch` helper function commit 2db0081 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Mon Jan 22 10:08:17 2024 -0500 Update packages/assets-controllers/CHANGELOG.md Update packages/assets-controllers/CHANGELOG.md commit 968c0c0 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Mon Jan 22 10:05:04 2024 -0500 [assets-controllers] Bump `@metamask/kerying-api` to ^3.0.0 and remove yarn resolutions entry for `@metamask/providers` commit 2be2e24 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Sun Jan 21 20:14:09 2024 -0500 Add CHANGELOG entries commit 1173eb9 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Jan 19 21:39:47 2024 -0500 test: adjust for removal of `getPreferencesState` callback commit c90de3e Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Jan 19 21:38:58 2024 -0500 test: add callbacks for all allowed actions, events as `WithControllerCallback` arguments commit ad11ac7 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Jan 19 21:36:59 2024 -0500 test: adjust action,event allowlist in `buildTokenDetectionControllerMessenger` commit 4b303b4 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Jan 19 21:32:46 2024 -0500 Minor refactors to event listeners for consistency commit beacf9b Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Jan 19 21:31:23 2024 -0500 Replace preferences controller callbacks in constructor with `getState` action and `stateChange` event commit b5bd0e8 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Jan 19 21:29:42 2024 -0500 Remove unused `NetworkControllerStateChange` event - **BREAKING**: use `NetworkControllerNetworkDidChangeEvent` instead commit 3fbdffa Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Jan 19 21:25:37 2024 -0500 Add `@metamask/keyring-api` as devDep (for `InternalAccount` type in tests) commit a44ccf7 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Thu Jan 18 20:31:40 2024 -0500 Add yarn resolutions entry to resolve conflicting `@metamask/providers` versions used by `@metamask/accounts-controller` commit 7016835 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Wed Jan 17 17:04:04 2024 -0500 Define `#registerEventListeners` constructor helper private method commit adc8dca Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Wed Jan 17 16:09:45 2024 -0500 Make `#isUnlocked` property non-optional commit 78e9fde Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Tue Jan 16 19:56:10 2024 -0500 test: adjust coverage thresholds commit 3fd2138 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Tue Jan 16 19:39:20 2024 -0500 test: Fix incorrect mock for `KeyringController:getState` commit 5df6b81 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Jan 12 14:33:07 2024 -0500 test: add actions, events, callbacks to test messenger commit 33818aa Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Thu Jan 11 18:53:02 2024 -0500 Exclude `detectedTokens` already stored in tokens-controller state from `tokensToDetect` commit 129c82e Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Thu Jan 11 18:46:43 2024 -0500 Use legacy token list from contract-metadata repo to perform auto-detection if active network is mainnet and token detection is disabled in preferences commit 0f46fdc Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Thu Jan 11 11:35:16 2024 -0500 Add `#trackMetaMetricsEvent` tracker property and call commit 2485341 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Thu Jan 11 11:28:33 2024 -0500 Define `#registerKeyringListeners`, `isActive` methods commit 8e204e6 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Thu Jan 11 10:56:20 2024 -0500 Subscribe to `AccountsController:selectedAccountChange` event commit ea96025 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Thu Jan 11 10:54:47 2024 -0500 Define and apply `#restartTokenDetection` method commit 2d31cce Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Thu Jan 11 10:48:41 2024 -0500 [assets-controllers] Install `{accounts,keyring}-controller` as deps and peerDeps commit 1bfdd2e37060f382cf08fac3d8fcd1786f8e0a79 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Tue Feb 6 16:20:58 2024 -0500 test: Add test case for `detectTokens` where token detection is disabled on mainnet commit d90f412bd419c859abecc3937c65476b8eecdc00 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Tue Feb 6 12:48:01 2024 -0500 test: Add test case for `detectTokens` where `useTokenDetection` is false and network is not mainnet commit c06c22eb8a580234d9a56d669fbf7cd2aebc5980 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Tue Feb 6 10:11:29 2024 -0500 test: Rename `mockAddDetectedTokens` to `callActionSpy` commit 15657f3211c968d6aada1420fb50610043e7dfdb Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Tue Feb 6 09:21:28 2024 -0500 test: Add tests for `AccountsController:selectedAccountChange` event commit 55ddb5dc5f28e362c5a023d8666e60bb97b7f0a8 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Tue Feb 6 09:19:55 2024 -0500 test: Add tests for keyring-controller lock/unlock events commit 24561c54b61e6e97eaa8fae9c6bbec0395e4b334 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Mon Feb 5 23:19:38 2024 -0500 test: Add tests for when disabled is false and keyring is locked commit efca509da8fb3dfd52aab08a733be9828b2d31e7 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Mon Feb 5 23:18:10 2024 -0500 test: Add `WithController` option for setting keyring unlocked state at controller initialization commit bb5b9d2808c44cab103da8c698ebd0357624f110 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Mon Feb 5 13:24:32 2024 -0500 test: remove unnecessary type casts commit 24f2d739869c13288db8d0c3038dd0ffe03b90e1 Merge: 6fde161 754b46f6d Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Tue Feb 6 16:28:54 2024 -0500 Merge branch '230113-consolidate-TokenDetectionController-DetectTokensController' into 231220-TokensController-v2-migration commit 754b46f6da9ac0b97a1834c01f25357ce1a6bb36 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Tue Feb 6 15:31:40 2024 -0500 Replace `detectTokens` with `#restartTokenDetection` in `networkDidChange` listener commit 8f21fc8ae5cf7a262180b38e2741f0e79e4c307c Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Tue Feb 6 12:44:20 2024 -0500 Fix `detectTokens` to remove redundant `TokensController:getState` calls for `ignoredTokens` commit f47a4ce03a6ce902717ae3a604fee20b52af93fa Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Tue Feb 6 12:43:00 2024 -0500 Improve typing for `STATIC_MAINNET_TOKEN_LIST` commit 6571a15e06f89fb2129e612149c83bc6b9fbbf80 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Tue Feb 6 09:19:18 2024 -0500 Include `#stopPolling()` call in `KeyringController:lock` listener commit 6fde161 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Mon Feb 5 10:05:23 2024 -0500 [token-detection-controller] test: remove unnecessary `as unknown as` cast commit e504d2e Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Feb 2 16:45:08 2024 -0500 Update packages/assets-controllers/CHANGELOG.md Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com> commit 129fda6 Merge: 1d7a5805efcc1e Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Wed Jan 31 10:30:13 2024 -0500 Merge branch '230113-consolidate-TokenDetectionController-DetectTokensController' into 231220-TokensController-v2-migration commit 5efcc1e Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Wed Jan 31 10:28:32 2024 -0500 In changelog, move new actions/events under "Added" heading commit 1d7a580 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Mon Jan 29 15:25:17 2024 -0500 test: adjust coverage thresholds commit f149b29 Merge: 1b7d9a5ed74732 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Mon Jan 29 13:38:56 2024 -0500 Merge branch '230113-consolidate-TokenDetectionController-DetectTokensController' into 231220-TokensController-v2-migration commit ed74732 Merge: aed885a8c09b16 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Mon Jan 29 13:31:47 2024 -0500 Merge branch 'main' into 230113-consolidate-TokenDetectionController-DetectTokensController commit aed885a Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Mon Jan 29 13:31:43 2024 -0500 In networkDidChange event listener, detect tokens if `networkClientId` is changed instead of `chainId`, and avoid resetting polling interval commit 1b7d9a5 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Mon Jan 29 12:03:39 2024 -0500 test: rename `registerListeners` to `promiseForApprovals` commit 41f4f1d Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Mon Jan 29 12:03:19 2024 -0500 test: move `addRequestHandler` initialization to individual test commit 1c86179 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Mon Jan 29 12:02:35 2024 -0500 test: initialize `getNetworkClientByIdHandler` in `beforeEach` commit a66fd26 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Mon Jan 29 12:01:48 2024 -0500 test: remove unnecessary action handler unregisters commit 25fe76d Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Jan 26 18:20:23 2024 -0500 Remove `BaseState` from `TokensState` commit c8f9a71 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Jan 26 16:59:59 2024 -0500 Linter fix commit d4a65de Merge: 2575c72ca19f99 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Jan 26 16:59:13 2024 -0500 Merge branch '230113-consolidate-TokenDetectionController-DetectTokensController' into 231220-TokensController-v2-migration commit ca19f99 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Jan 26 16:24:46 2024 -0500 Changelog linter fix commit b49a545 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Jan 26 11:02:38 2024 -0500 test: remove unnecessary action handler unregisters commit 571c3b2 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Jan 26 10:51:50 2024 -0500 Use `networkClientId` instead of `chainId` in `#restartTokenDetection` commit 8eff112 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Jan 26 10:49:10 2024 -0500 Extract `findCaseInsensitiveMatch` helper function commit 6df8aa4 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Mon Jan 22 10:08:17 2024 -0500 Update packages/assets-controllers/CHANGELOG.md Update packages/assets-controllers/CHANGELOG.md commit d77bce0 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Mon Jan 22 10:05:04 2024 -0500 [assets-controllers] Bump `@metamask/kerying-api` to ^3.0.0 and remove yarn resolutions entry for `@metamask/providers` commit c434e8f Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Sun Jan 21 20:14:09 2024 -0500 Add CHANGELOG entries commit 392140e Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Jan 19 21:39:47 2024 -0500 test: adjust for removal of `getPreferencesState` callback commit 169554f Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Jan 19 21:38:58 2024 -0500 test: add callbacks for all allowed actions, events as `WithControllerCallback` arguments commit fc9b631 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Jan 19 21:36:59 2024 -0500 test: adjust action,event allowlist in `buildTokenDetectionControllerMessenger` commit 99d35f3 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Jan 19 21:32:46 2024 -0500 Minor refactors to event listeners for consistency commit 3d74e54 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Jan 19 21:31:23 2024 -0500 Replace preferences controller callbacks in constructor with `getState` action and `stateChange` event commit b92cd73 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Jan 19 21:29:42 2024 -0500 Remove unused `NetworkControllerStateChange` event - **BREAKING**: use `NetworkControllerNetworkDidChangeEvent` instead commit e947207 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Jan 19 21:25:37 2024 -0500 Add `@metamask/keyring-api` as devDep (for `InternalAccount` type in tests) commit f436032 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Thu Jan 18 20:31:40 2024 -0500 Add yarn resolutions entry to resolve conflicting `@metamask/providers` versions used by `@metamask/accounts-controller` commit d19f5d6 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Wed Jan 17 17:04:04 2024 -0500 Define `#registerEventListeners` constructor helper private method commit 1270aca Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Wed Jan 17 16:09:45 2024 -0500 Make `#isUnlocked` property non-optional commit f6c2ef0 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Tue Jan 16 19:56:10 2024 -0500 test: adjust coverage thresholds commit 41fee27 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Tue Jan 16 19:39:20 2024 -0500 test: Fix incorrect mock for `KeyringController:getState` commit a590dcc Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Jan 12 14:33:07 2024 -0500 test: add actions, events, callbacks to test messenger commit 6ba98de Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Thu Jan 11 18:53:02 2024 -0500 Exclude `detectedTokens` already stored in tokens-controller state from `tokensToDetect` commit 32465fd Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Thu Jan 11 18:46:43 2024 -0500 Use legacy token list from contract-metadata repo to perform auto-detection if active network is mainnet and token detection is disabled in preferences commit 2673a3b Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Thu Jan 11 11:35:16 2024 -0500 Add `#trackMetaMetricsEvent` tracker property and call commit 0ded3cb Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Thu Jan 11 11:28:33 2024 -0500 Define `#registerKeyringListeners`, `isActive` methods commit f7718fd Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Thu Jan 11 10:56:20 2024 -0500 Subscribe to `AccountsController:selectedAccountChange` event commit 78e82e7 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Thu Jan 11 10:54:47 2024 -0500 Define and apply `#restartTokenDetection` method commit 2d08c2d Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Thu Jan 11 10:48:41 2024 -0500 [assets-controllers] Install `{accounts,keyring}-controller` as deps and peerDeps commit 2575c72 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Wed Jan 24 12:04:03 2024 -0500 [assets-controllers] test: adjust coverage thresholds commit 9c61747 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Sun Jan 21 16:42:21 2024 -0500 Add changelog entries commit 0d50480 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Sun Jan 21 16:40:58 2024 -0500 [token-list-controller,token-rates-controller] Enumerate package-level exports commit 669bb4f Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Sun Jan 21 16:08:39 2024 -0500 [token-balances-controller] test: Use `PreferencesController:getState` action, `TokensController:stateChange` event commit 12971a5 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Sun Jan 21 16:00:35 2024 -0500 [token-balances-controller] Replace tokens-controller, preferences-controller callbacks with messenger actions/events. - `getSelectedAddress` replaced with `PreferencesController:getState` action - `onTokensStateChange` replaced with `TokensController:stateChange` event commit d1a303a Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Sun Jan 21 15:57:51 2024 -0500 [token-balances-controller] Rename and export `getDefaultTokenBalancesState` commit 1b0cf68 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Sun Jan 21 15:56:15 2024 -0500 [token-detection-controller] test: Mock `TokensController:getState`, `TokensController:addDetectedTokens` messenger actions commit 83e87ad Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Sun Jan 21 15:54:00 2024 -0500 [token-detection-controller] Replace tokens-controller callbacks with `getState`, `addDetectedTokens` messenger actions commit bf87104 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Sun Jan 21 15:52:38 2024 -0500 test: Use `PreferencesController:stateChange` event instead of `onPreferencesStateChange` callback commit f230718 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Sun Jan 21 15:51:25 2024 -0500 Expose `addDetectedTokens` action commit 5aed7e0 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Sun Jan 21 15:48:31 2024 -0500 Replace `onPreferencesStateChange` callback with messenger event commit 5b8fb07 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Thu Jan 18 15:33:43 2024 -0500 test: Adjust tests to updates in tokens-controller commit dccfe62 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Thu Jan 18 11:56:47 2024 -0500 Add `TokensControllerGetStateAction`, `TokensControllerActions` types commit 48551b9 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Thu Jan 18 11:56:28 2024 -0500 Fix typing for `TokensState` commit 4d65ee6 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Tue Dec 19 14:42:48 2023 -0800 [token-detection-controller] test: Restore publishes for `networkDidChange` event, mock polygon network client commit 56813f4 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Tue Dec 19 12:36:28 2023 -0800 Remove unnecessary `?` operator commit 1405a53 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Tue Dec 19 12:36:04 2023 -0800 Use type assertion to mock `getNetworkClientById` return value commit e6c9663 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Tue Dec 19 05:28:34 2023 -0800 test: Mock `NetworkController:getNetworkClientById` action handler commit 8039cb8 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Tue Dec 19 05:27:52 2023 -0800 test: Mock `TokenListController:stateChange` event commit 77a8531 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Mon Dec 18 17:19:43 2023 -0800 [token-balances-controller] Adjust tests to updates in tokens-controller commit 2d58e1e Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Mon Dec 18 16:30:07 2023 -0800 Replace callbacks `onNetworkDidChange`, `onTokenListStateChange`, `getNetworkClientById` with messenger actions/events commit 8231533 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Mon Jan 22 10:08:17 2024 -0500 Update packages/assets-controllers/CHANGELOG.md Update packages/assets-controllers/CHANGELOG.md commit 396d010 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Mon Jan 22 10:05:04 2024 -0500 [assets-controllers] Bump `@metamask/kerying-api` to ^3.0.0 and remove yarn resolutions entry for `@metamask/providers` commit 4097960 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Sun Jan 21 20:14:09 2024 -0500 Add CHANGELOG entries commit 524b1b9 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Jan 19 21:39:47 2024 -0500 test: adjust for removal of `getPreferencesState` callback commit c08cadd Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Jan 19 21:38:58 2024 -0500 test: add callbacks for all allowed actions, events as `WithControllerCallback` arguments commit 324aa97 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Jan 19 21:36:59 2024 -0500 test: adjust action,event allowlist in `buildTokenDetectionControllerMessenger` commit 412bb68 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Jan 19 21:32:46 2024 -0500 Minor refactors to event listeners for consistency commit f1dd425 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Jan 19 21:31:23 2024 -0500 Replace preferences controller callbacks in constructor with `getState` action and `stateChange` event commit 7ec7246 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Jan 19 21:29:42 2024 -0500 Remove unused `NetworkControllerStateChange` event - **BREAKING**: use `NetworkControllerNetworkDidChangeEvent` instead commit f0ba761 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Jan 19 21:25:37 2024 -0500 Add `@metamask/keyring-api` as devDep (for `InternalAccount` type in tests) commit 9354e69 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Thu Jan 18 20:31:40 2024 -0500 Add yarn resolutions entry to resolve conflicting `@metamask/providers` versions used by `@metamask/accounts-controller` commit c6ba49a Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Wed Jan 17 17:04:04 2024 -0500 Define `#registerEventListeners` constructor helper private method commit e217169 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Wed Jan 17 16:09:45 2024 -0500 Make `#isUnlocked` property non-optional commit 68533dd Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Tue Jan 16 19:56:10 2024 -0500 test: adjust coverage thresholds commit 2acc5a1 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Tue Jan 16 19:39:20 2024 -0500 test: Fix incorrect mock for `KeyringController:getState` commit 284c976 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Fri Jan 12 14:33:07 2024 -0500 test: add actions, events, callbacks to test messenger commit d3448d0 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Thu Jan 11 18:53:02 2024 -0500 Exclude `detectedTokens` already stored in tokens-controller state from `tokensToDetect` commit 1e9e2a3 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Thu Jan 11 18:46:43 2024 -0500 Use legacy token list from contract-metadata repo to perform auto-detection if active network is mainnet and token detection is disabled in preferences commit 48d733a Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Thu Jan 11 11:35:16 2024 -0500 Add `#trackMetaMetricsEvent` tracker property and call commit 3eb9a64 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Thu Jan 11 11:28:33 2024 -0500 Define `#registerKeyringListeners`, `isActive` methods commit feb1ff9 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Thu Jan 11 10:56:20 2024 -0500 Subscribe to `AccountsController:selectedAccountChange` event commit 3b987d1 Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Thu Jan 11 10:54:47 2024 -0500 Define and apply `#restartTokenDetection` method commit 26e461f Author: Jongsun Suh <jongsun.suh@icloud.com> Date: Thu Jan 11 10:48:41 2024 -0500 [assets-controllers] Install `{accounts,keyring}-controller` as deps and peerDeps
…troller constructor options
a527b1d to
95b34acCompare
Explanation
DetectTokensControllerfrom extension #3775.isUnlockedstate is false.KeyringController:unlock,KeyringController:lockeventsAccountsController:selectedAccountChangeevent@metamask/contract-metadatastatic token list if on mainnet anduseTokenDetectionis false.trackMetaMetricsEventfor every detected token.References
DetectTokensControllerinto coreTokenDetectionController#3626DetectTokensControllerfrom extension #3775TokensControllerto fully utilize controller-messenger pattern #3690Changelog
N/A
Checklist