-
-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[token-detection-controller] Add tests for API changes from merge with DetectTokensController
#3867
[token-detection-controller] Add tests for API changes from merge with DetectTokensController
#3867
Conversation
4594d8e
to
1bfdd2e
Compare
24f2d73
to
11da214
Compare
I'll wait until the parent PR is merged before giving final approval on this PR. |
5f9f474
to
09cac7f
Compare
a89ad4a
to
e945bb7
Compare
e945bb7
to
a527b1d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from the nitpicks I had one question.
clock.restore(); | ||
}); | ||
|
||
describe('when "disabled" is "false"', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed throughout test file: ad3593d
}); | ||
}); | ||
|
||
describe('when "disabled" is "true"', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar as previous nit:
describe('when "disabled" is "true"', () => { | |
describe('when "disabled" is true', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above: ad3593d
options?: Partial<ConstructorParameters<typeof TokenDetectionController>[0]>; | ||
options?: Partial< | ||
ConstructorParameters<typeof TokenDetectionController>[0] | ||
> & { isKeyringUnlocked?: boolean }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 a89ad4a Merge: 5bb296b a386301 Author: Jongsun Suh <[email protected]> Date: Thu Feb 8 13:09:36 2024 -0500 Merge branch '231220-TokensController-v2-migration' into 230129-token-detection-controller-merge-tests commit a386301 Merge: 5200f85 582b370 Author: Jongsun Suh <[email protected]> Date: Thu Feb 8 13:09:06 2024 -0500 Merge branch '230113-consolidate-TokenDetectionController-DetectTokensController' into 231220-TokensController-v2-migration commit 582b370 Merge: 4a944d8 065fd91 Author: Jongsun Suh <[email protected]> Date: Thu Feb 8 13:08:19 2024 -0500 Merge branch 'main' into 230113-consolidate-TokenDetectionController-DetectTokensController commit 5200f85 Merge: 68999be 4a944d8 Author: Jongsun Suh <[email protected]> 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 <[email protected]> Date: Wed Feb 7 13:44:59 2024 -0500 Apply suggestions to CHANGELOG Co-authored-by: Elliot Winkler <[email protected]> commit 5bb296b Author: Jongsun Suh <[email protected]> Date: Tue Feb 6 18:43:56 2024 -0500 test: Add test case for `trackMetaMetricsEvent` call commit f203b9e Merge: 1bfdd2e 68999be Author: Jongsun Suh <[email protected]> Date: Tue Feb 6 18:00:51 2024 -0500 Merge branch '231220-TokensController-v2-migration' into 230129-token-detection-controller-merge-tests commit 68999be Merge: 11da214 e01f993 Author: Jongsun Suh <[email protected]> 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 <[email protected]> Date: Tue Feb 6 17:56:39 2024 -0500 test: adjust coverage thresholds commit 11da214 Author: Jongsun Suh <[email protected]> Date: Tue Feb 6 17:54:53 2024 -0500 test: adjust coverage thresholds commit 01cf796 Merge: d501062 88eb7ca Author: Jongsun Suh <[email protected]> Date: Tue Feb 6 17:53:49 2024 -0500 Merge branch '230113-consolidate-TokenDetectionController-DetectTokensController' into 231220-TokensController-v2-migration commit d501062 Author: Jongsun Suh <[email protected]> Date: Tue Feb 6 16:50:02 2024 -0500 [token-detection-controller] Fix typing for `STATIC_MAINNET_TOKEN_LIST` commit 8556d7a Author: Jongsun Suh <[email protected]> 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 <[email protected]> Date: Tue Feb 6 15:31:40 2024 -0500 Replace `detectTokens` with `#restartTokenDetection` in `networkDidChange` listener commit 91be385 Author: Jongsun Suh <[email protected]> Date: Tue Feb 6 09:19:18 2024 -0500 Include `#stopPolling()` call in `KeyringController:lock` listener commit 9a4ae93 Author: Jongsun Suh <[email protected]> Date: Wed Jan 31 10:28:32 2024 -0500 In changelog, move new actions/events under "Added" heading commit 312e450 Author: Jongsun Suh <[email protected]> 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 <[email protected]> Date: Fri Jan 26 16:24:46 2024 -0500 Changelog linter fix commit 907b4df Author: Jongsun Suh <[email protected]> Date: Fri Jan 26 11:02:38 2024 -0500 test: remove unnecessary action handler unregisters commit f1af71a Author: Jongsun Suh <[email protected]> Date: Fri Jan 26 10:51:50 2024 -0500 Use `networkClientId` instead of `chainId` in `#restartTokenDetection` commit 7c25f3c Author: Jongsun Suh <[email protected]> Date: Fri Jan 26 10:49:10 2024 -0500 Extract `findCaseInsensitiveMatch` helper function commit 2db0081 Author: Jongsun Suh <[email protected]> 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 <[email protected]> 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 <[email protected]> Date: Sun Jan 21 20:14:09 2024 -0500 Add CHANGELOG entries commit 1173eb9 Author: Jongsun Suh <[email protected]> Date: Fri Jan 19 21:39:47 2024 -0500 test: adjust for removal of `getPreferencesState` callback commit c90de3e Author: Jongsun Suh <[email protected]> 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 <[email protected]> Date: Fri Jan 19 21:36:59 2024 -0500 test: adjust action,event allowlist in `buildTokenDetectionControllerMessenger` commit 4b303b4 Author: Jongsun Suh <[email protected]> Date: Fri Jan 19 21:32:46 2024 -0500 Minor refactors to event listeners for consistency commit beacf9b Author: Jongsun Suh <[email protected]> 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 <[email protected]> Date: Fri Jan 19 21:29:42 2024 -0500 Remove unused `NetworkControllerStateChange` event - **BREAKING**: use `NetworkControllerNetworkDidChangeEvent` instead commit 3fbdffa Author: Jongsun Suh <[email protected]> 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 <[email protected]> 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 <[email protected]> Date: Wed Jan 17 17:04:04 2024 -0500 Define `#registerEventListeners` constructor helper private method commit adc8dca Author: Jongsun Suh <[email protected]> Date: Wed Jan 17 16:09:45 2024 -0500 Make `#isUnlocked` property non-optional commit 78e9fde Author: Jongsun Suh <[email protected]> Date: Tue Jan 16 19:56:10 2024 -0500 test: adjust coverage thresholds commit 3fd2138 Author: Jongsun Suh <[email protected]> Date: Tue Jan 16 19:39:20 2024 -0500 test: Fix incorrect mock for `KeyringController:getState` commit 5df6b81 Author: Jongsun Suh <[email protected]> Date: Fri Jan 12 14:33:07 2024 -0500 test: add actions, events, callbacks to test messenger commit 33818aa Author: Jongsun Suh <[email protected]> Date: Thu Jan 11 18:53:02 2024 -0500 Exclude `detectedTokens` already stored in tokens-controller state from `tokensToDetect` commit 129c82e Author: Jongsun Suh <[email protected]> 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 <[email protected]> Date: Thu Jan 11 11:35:16 2024 -0500 Add `#trackMetaMetricsEvent` tracker property and call commit 2485341 Author: Jongsun Suh <[email protected]> Date: Thu Jan 11 11:28:33 2024 -0500 Define `#registerKeyringListeners`, `isActive` methods commit 8e204e6 Author: Jongsun Suh <[email protected]> Date: Thu Jan 11 10:56:20 2024 -0500 Subscribe to `AccountsController:selectedAccountChange` event commit ea96025 Author: Jongsun Suh <[email protected]> Date: Thu Jan 11 10:54:47 2024 -0500 Define and apply `#restartTokenDetection` method commit 2d31cce Author: Jongsun Suh <[email protected]> Date: Thu Jan 11 10:48:41 2024 -0500 [assets-controllers] Install `{accounts,keyring}-controller` as deps and peerDeps commit 1bfdd2e Author: Jongsun Suh <[email protected]> Date: Tue Feb 6 16:20:58 2024 -0500 test: Add test case for `detectTokens` where token detection is disabled on mainnet commit d90f412 Author: Jongsun Suh <[email protected]> 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 c06c22e Author: Jongsun Suh <[email protected]> Date: Tue Feb 6 10:11:29 2024 -0500 test: Rename `mockAddDetectedTokens` to `callActionSpy` commit 15657f3 Author: Jongsun Suh <[email protected]> Date: Tue Feb 6 09:21:28 2024 -0500 test: Add tests for `AccountsController:selectedAccountChange` event commit 55ddb5d Author: Jongsun Suh <[email protected]> Date: Tue Feb 6 09:19:55 2024 -0500 test: Add tests for keyring-controller lock/unlock events commit 24561c5 Author: Jongsun Suh <[email protected]> Date: Mon Feb 5 23:19:38 2024 -0500 test: Add tests for when disabled is false and keyring is locked commit efca509 Author: Jongsun Suh <[email protected]> Date: Mon Feb 5 23:18:10 2024 -0500 test: Add `WithController` option for setting keyring unlocked state at controller initialization commit bb5b9d2 Author: Jongsun Suh <[email protected]> Date: Mon Feb 5 13:24:32 2024 -0500 test: remove unnecessary type casts commit 24f2d73 Merge: 6fde161 754b46f Author: Jongsun Suh <[email protected]> Date: Tue Feb 6 16:28:54 2024 -0500 Merge branch '230113-consolidate-TokenDetectionController-DetectTokensController' into 231220-TokensController-v2-migration commit 754b46f Author: Jongsun Suh <[email protected]> Date: Tue Feb 6 15:31:40 2024 -0500 Replace `detectTokens` with `#restartTokenDetection` in `networkDidChange` listener commit 8f21fc8 Author: Jongsun Suh <[email protected]> Date: Tue Feb 6 12:44:20 2024 -0500 Fix `detectTokens` to remove redundant `TokensController:getState` calls for `ignoredTokens` commit f47a4ce Author: Jongsun Suh <[email protected]> Date: Tue Feb 6 12:43:00 2024 -0500 Improve typing for `STATIC_MAINNET_TOKEN_LIST` commit 6571a15 Author: Jongsun Suh <[email protected]> Date: Tue Feb 6 09:19:18 2024 -0500 Include `#stopPolling()` call in `KeyringController:lock` listener commit 6fde161 Author: Jongsun Suh <[email protected]> Date: Mon Feb 5 10:05:23 2024 -0500 [token-detection-controller] test: remove unnecessary `as unknown as` cast commit e504d2e Author: Jongsun Suh <[email protected]> Date: Fri Feb 2 16:45:08 2024 -0500 Update packages/assets-controllers/CHANGELOG.md Co-authored-by: Elliot Winkler <[email protected]> commit 129fda6 Merge: 1d7a580 5efcc1e Author: Jongsun Suh <[email protected]> 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 <[email protected]> Date: Wed Jan 31 10:28:32 2024 -0500 In changelog, move new actions/events under "Added" heading commit 1d7a580 Author: Jongsun Suh <[email protected]> Date: Mon Jan 29 15:25:17 2024 -0500 test: adjust coverage thresholds commit f149b29 Merge: 1b7d9a5 ed74732 Author: Jongsun Suh <[email protected]> Date: Mon Jan 29 13:38:56 2024 -0500 Merge branch '230113-consolidate-TokenDetectionController-DetectTokensController' into 231220-TokensController-v2-migration commit ed74732 Merge: aed885a 8c09b16 Author: Jongsun Suh <[email protected]> Date: Mon Jan 29 13:31:47 2024 -0500 Merge branch 'main' into 230113-consolidate-TokenDetectionController-DetectTokensController commit aed885a Author: Jongsun Suh <[email protected]> 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 <[email protected]> Date: Mon Jan 29 12:03:39 2024 -0500 test: rename `registerListeners` to `promiseForApprovals` commit 41f4f1d Author: Jongsun Suh <[email protected]> Date: Mon Jan 29 12:03:19 2024 -0500 test: move `addRequestHandler` initialization to individual test commit 1c86179 Author: Jongsun Suh <[email protected]> Date: Mon Jan 29 12:02:35 2024 -0500 test: initialize `getNetworkClientByIdHandler` in `beforeEach` commit a66fd26 Author: Jongsun Suh <[email protected]> Date: Mon Jan 29 12:01:48 2024 -0500 test: remove unnecessary action handler unregisters commit 25fe76d Author: Jongsun Suh <[email protected]> Date: Fri Jan 26 18:20:23 2024 -0500 Remove `BaseState` from `TokensState` commit c8f9a71 Author: Jongsun Suh <[email protected]> Date: Fri Jan 26 16:59:59 2024 -0500 Linter fix commit d4a65de Merge: 2575c72 ca19f99 Author: Jongsun Suh <[email protected]> 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 <[email protected]> Date: Fri Jan 26 16:24:46 2024 -0500 Changelog linter fix commit b49a545 Author: Jongsun Suh <[email protected]> Date: Fri Jan 26 11:02:38 2024 -0500 test: remove unnecessary action handler unregisters commit 571c3b2 Author: Jongsun Suh <[email protected]> Date: Fri Jan 26 10:51:50 2024 -0500 Use `networkClientId` instead of `chainId` in `#restartTokenDetection` commit 8eff112 Author: Jongsun Suh <[email protected]> Date: Fri Jan 26 10:49:10 2024 -0500 Extract `findCaseInsensitiveMatch` helper function commit 6df8aa4 Author: Jongsun Suh <[email protected]> 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 <[email protected]> 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 <[email protected]> Date: Sun Jan 21 20:14:09 2024 -0500 Add CHANGELOG entries commit 392140e Author: Jongsun Suh <[email protected]> Date: Fri Jan 19 21:39:47 2024 -0500 test: adjust for removal of `getPreferencesState` callback commit 169554f Author: Jongsun Suh <[email protected]> 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 <[email protected]> Date: Fri Jan 19 21:36:59 2024 -0500 test: adjust action,event allowlist in `buildTokenDetectionControllerMessenger` commit 99d35f3 Author: Jongsun Suh <[email protected]> Date: Fri Jan 19 21:32:46 2024 -0500 Minor refactors to event listeners for consistency commit 3d74e54 Author: Jongsun Suh <[email protected]> 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 <[email protected]> Date: Fri Jan 19 21:29:42 2024 -0500 Remove unused `NetworkControllerStateChange` event - **BREAKING**: use `NetworkControllerNetworkDidChangeEvent` instead commit e947207 Author: Jongsun Suh <[email protected]> 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 <[email protected]> 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 <[email protected]> Date: Wed Jan 17 17:04:04 2024 -0500 Define `#registerEventListeners` constructor helper private method commit 1270aca Author: Jongsun Suh <[email protected]> Date: Wed Jan 17 16:09:45 2024 -0500 Make `#isUnlocked` property non-optional commit f6c2ef0 Author: Jongsun Suh <[email protected]> Date: Tue Jan 16 19:56:10 2024 -0500 test: adjust coverage thresholds commit 41fee27 Author: Jongsun Suh <[email protected]> Date: Tue Jan 16 19:39:20 2024 -0500 test: Fix incorrect mock for `KeyringController:getState` commit a590dcc Author: Jongsun Suh <[email protected]> Date: Fri Jan 12 14:33:07 2024 -0500 test: add actions, events, callbacks to test messenger commit 6ba98de Author: Jongsun Suh <[email protected]> Date: Thu Jan 11 18:53:02 2024 -0500 Exclude `detectedTokens` already stored in tokens-controller state from `tokensToDetect` commit 32465fd Author: Jongsun Suh <[email protected]> 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 <[email protected]> Date: Thu Jan 11 11:35:16 2024 -0500 Add `#trackMetaMetricsEvent` tracker property and call commit 0ded3cb Author: Jongsun Suh <[email protected]> Date: Thu Jan 11 11:28:33 2024 -0500 Define `#registerKeyringListeners`, `isActive` methods commit f7718fd Author: Jongsun Suh <[email protected]> Date: Thu Jan 11 10:56:20 2024 -0500 Subscribe to `AccountsController:selectedAccountChange` event commit 78e82e7 Author: Jongsun Suh <[email protected]> Date: Thu Jan 11 10:54:47 2024 -0500 Define and apply `#restartTokenDetection` method commit 2d08c2d Author: Jongsun Suh <[email protected]> Date: Thu Jan 11 10:48:41 2024 -0500 [assets-controllers] Install `{accounts,keyring}-controller` as deps and peerDeps commit 2575c72 Author: Jongsun Suh <[email protected]> Date: Wed Jan 24 12:04:03 2024 -0500 [assets-controllers] test: adjust coverage thresholds commit 9c61747 Author: Jongsun Suh <[email protected]> Date: Sun Jan 21 16:42:21 2024 -0500 Add changelog entries commit 0d50480 Author: Jongsun Suh <[email protected]> Date: Sun Jan 21 16:40:58 2024 -0500 [token-list-controller,token-rates-controller] Enumerate package-level exports commit 669bb4f Author: Jongsun Suh <[email protected]> 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 <[email protected]> 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 <[email protected]> Date: Sun Jan 21 15:57:51 2024 -0500 [token-balances-controller] Rename and export `getDefaultTokenBalancesState` commit 1b0cf68 Author: Jongsun Suh <[email protected]> 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 <[email protected]> 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 <[email protected]> Date: Sun Jan 21 15:52:38 2024 -0500 test: Use `PreferencesController:stateChange` event instead of `onPreferencesStateChange` callback commit f230718 Author: Jongsun Suh <[email protected]> Date: Sun Jan 21 15:51:25 2024 -0500 Expose `addDetectedTokens` action commit 5aed7e0 Author: Jongsun Suh <[email protected]> Date: Sun Jan 21 15:48:31 2024 -0500 Replace `onPreferencesStateChange` callback with messenger event commit 5b8fb07 Author: Jongsun Suh <[email protected]> Date: Thu Jan 18 15:33:43 2024 -0500 test: Adjust tests to updates in tokens-controller commit dccfe62 Author: Jongsun Suh <[email protected]> Date: Thu Jan 18 11:56:47 2024 -0500 Add `TokensControllerGetStateAction`, `TokensControllerActions` types commit 48551b9 Author: Jongsun Suh <[email protected]> Date: Thu Jan 18 11:56:28 2024 -0500 Fix typing for `TokensState` commit 4d65ee6 Author: Jongsun Suh <[email protected]> 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 <[email protected]> Date: Tue Dec 19 12:36:28 2023 -0800 Remove unnecessary `?` operator commit 1405a53 Author: Jongsun Suh <[email protected]> Date: Tue Dec 19 12:36:04 2023 -0800 Use type assertion to mock `getNetworkClientById` return value commit e6c9663 Author: Jongsun Suh <[email protected]> Date: Tue Dec 19 05:28:34 2023 -0800 test: Mock `NetworkController:getNetworkClientById` action handler commit 8039cb8 Author: Jongsun Suh <[email protected]> Date: Tue Dec 19 05:27:52 2023 -0800 test: Mock `TokenListController:stateChange` event commit 77a8531 Author: Jongsun Suh <[email protected]> Date: Mon Dec 18 17:19:43 2023 -0800 [token-balances-controller] Adjust tests to updates in tokens-controller commit 2d58e1e Author: Jongsun Suh <[email protected]> Date: Mon Dec 18 16:30:07 2023 -0800 Replace callbacks `onNetworkDidChange`, `onTokenListStateChange`, `getNetworkClientById` with messenger actions/events commit 8231533 Author: Jongsun Suh <[email protected]> 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 <[email protected]> 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 <[email protected]> Date: Sun Jan 21 20:14:09 2024 -0500 Add CHANGELOG entries commit 524b1b9 Author: Jongsun Suh <[email protected]> Date: Fri Jan 19 21:39:47 2024 -0500 test: adjust for removal of `getPreferencesState` callback commit c08cadd Author: Jongsun Suh <[email protected]> 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 <[email protected]> Date: Fri Jan 19 21:36:59 2024 -0500 test: adjust action,event allowlist in `buildTokenDetectionControllerMessenger` commit 412bb68 Author: Jongsun Suh <[email protected]> Date: Fri Jan 19 21:32:46 2024 -0500 Minor refactors to event listeners for consistency commit f1dd425 Author: Jongsun Suh <[email protected]> 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 <[email protected]> Date: Fri Jan 19 21:29:42 2024 -0500 Remove unused `NetworkControllerStateChange` event - **BREAKING**: use `NetworkControllerNetworkDidChangeEvent` instead commit f0ba761 Author: Jongsun Suh <[email protected]> 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 <[email protected]> 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 <[email protected]> Date: Wed Jan 17 17:04:04 2024 -0500 Define `#registerEventListeners` constructor helper private method commit e217169 Author: Jongsun Suh <[email protected]> Date: Wed Jan 17 16:09:45 2024 -0500 Make `#isUnlocked` property non-optional commit 68533dd Author: Jongsun Suh <[email protected]> Date: Tue Jan 16 19:56:10 2024 -0500 test: adjust coverage thresholds commit 2acc5a1 Author: Jongsun Suh <[email protected]> Date: Tue Jan 16 19:39:20 2024 -0500 test: Fix incorrect mock for `KeyringController:getState` commit 284c976 Author: Jongsun Suh <[email protected]> Date: Fri Jan 12 14:33:07 2024 -0500 test: add actions, events, callbacks to test messenger commit d3448d0 Author: Jongsun Suh <[email protected]> Date: Thu Jan 11 18:53:02 2024 -0500 Exclude `detectedTokens` already stored in tokens-controller state from `tokensToDetect` commit 1e9e2a3 Author: Jongsun Suh <[email protected]> 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 <[email protected]> Date: Thu Jan 11 11:35:16 2024 -0500 Add `#trackMetaMetricsEvent` tracker property and call commit 3eb9a64 Author: Jongsun Suh <[email protected]> Date: Thu Jan 11 11:28:33 2024 -0500 Define `#registerKeyringListeners`, `isActive` methods commit feb1ff9 Author: Jongsun Suh <[email protected]> Date: Thu Jan 11 10:56:20 2024 -0500 Subscribe to `AccountsController:selectedAccountChange` event commit 3b987d1 Author: Jongsun Suh <[email protected]> Date: Thu Jan 11 10:54:47 2024 -0500 Define and apply `#restartTokenDetection` method commit 26e461f Author: Jongsun Suh <[email protected]> Date: Thu Jan 11 10:48:41 2024 -0500 [assets-controllers] Install `{accounts,keyring}-controller` as deps and peerDeps
…troller constructor options
a527b1d
to
95b34ac
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Explanation
DetectTokensController
from extension #3775.isUnlocked
state is false.KeyringController:unlock
,KeyringController:lock
eventsAccountsController:selectedAccountChange
event@metamask/contract-metadata
static token list if on mainnet anduseTokenDetection
is false.trackMetaMetricsEvent
for every detected token.References
DetectTokensController
into coreTokenDetectionController
#3626DetectTokensController
from extension #3775TokensController
to fully utilize controller-messenger pattern #3690Changelog
N/A
Checklist