Conversation
This comment was marked as resolved.
This comment was marked as resolved.
TokenDetectionController from coreDetectTokensController with consolidated TokenDetectionController from core
6081fd9 to
9bf4d14
Compare
9bf4d14 to
da7270a
Compare
This comment was marked as resolved.
This comment was marked as resolved.
|
🚨 Potential security issues detected. Learn more about Socket for GitHub ↗︎ To accept the risk, merge this PR and you will not be notified again.
Ignoring: Next stepsWhat is new author?A new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package. Scrutinize new collaborator additions to packages because they now have the ability to publish code into your dependency tree. Packages should avoid frequent or unnecessary additions or changes to publishing rights. Take a deeper look at the dependencyTake a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev. Remove the packageIf you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency. Mark a package as acceptable riskTo ignore an alert, reply with a comment starting with
|
da7270a to
96e8576
Compare
DetectTokensController with consolidated TokenDetectionController from coreDetectTokensController with consolidated TokenDetectionController from core repo
This comment was marked as resolved.
This comment was marked as resolved.
5ce8858 to
4dc3ab4
Compare
c6a3a05 to
5d43932
Compare
…ccounts-controller`, `@metamask/keyring-controller`
…s` into `TokenDetectionController` and `detectTokens`
This comment was marked as duplicate.
This comment was marked as duplicate.
5c99b14 to
4f6a160
Compare
This comment has been minimized.
This comment has been minimized.
b669ccf to
b825ed4
Compare
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
|
I'm not super familiar with the controller messaging patterns to determine if they're all correct. But I don't see anything that looks wrong! 🚀 |
This comment was marked as duplicate.
This comment was marked as duplicate.
3957631 to
d038ff9
Compare
Builds ready [17dde59]
Page Load Metrics (1048 ± 461 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
Description
This commit replaces
DetectTokensControllerwith the core repo'sTokenDetectionController.This represents the final step of Shared Libraries' initiative to a) consolidate the core repo's
TokenDetectionController, the extension'sDetectTokensController, and relevant mobile patches to@metamask/assets-controllers, with the goal of b) migrating both extension and mobile to use the consolidated controller in core.This also represents a full conversion to TypeScript for
DetectTokensControllerand its unit tests.Related issues
DetectTokensControllerwith consolidatedTokenDetectionControllerfrom core repo #23127TokenDetectionControllerup-to-date and release new version ofassets-controllerscore#3916DetectTokensControllerupdates core#3923@metamask/assets-controllersv26)Manual testing steps
Changelog
metamask-extensionMetamaskControllerclass:preferencesControllerMessengerinstance which only allows thePreferencesController:getStateaction andPreferencesController:stateChangeevent.PreferencesController:stateChangeevent.PreferencesController:messengeras an optional constructor options object property.PreferencesController:getStateaction handler.toChecksumHexAddressfrom@metamask/controller-utilswith imports from the internalshared/modules/hexstring-utilsmodule.@metamask/assets-controllersto^26.0.0.@metamask/accounts-controllerto^11.0.0.@metamask/keyring-controllerto^13.0.0.@metamask/polling-controlleras a dependency.test-yarn-dedupeCI run.@metamask/controller-utilsto^8.0.4.TokenDetectionController(compared toDetectTokensController)BREAKING: Inherit from
StaticIntervalPollingControllerinstead ofStaticIntervalPollingControllerOnlyConstructor and class fields:
preferences,network,tokenList,tokensController,assetsContractController,getCurrentSelectedAccount,getNetworkClientByIdas constructor options, and add required optiongetBalancesInSingleCall.disableLegacyIntervalclass field and constructor option.#restartTokenDetectionalways resets polling interval to default regardless of whether legacy or new polling is being used.#disabledprivate class field, which blocks all network requests if set to true, and adddisabledas an optional constructor option, which defaults to 'true' if omitted.isOpenclass field, and replace by addingenable,disablepublic methods.selectedAddress. If omitted, its value is populated by calling theAccountsController:getSelectedAccountaction.Messenger:
PreferencesController:stateChange,AccountsController:selectedAccountChange,KeyringController:lock,KeyringController:unlockevents.AccountsController:getSelectedAccount,NetworkController:getNetworkClientById,NetworkController:getNetworkConfigurationByNetworkClientId,NetworkController:getState,KeyringController:getState,PreferencesController:getState,TokenListController:getState,TokensController:getState, andTokensController:addDetectedTokens.BREAKING:
detectTokensreplaces thedetectNewTokensmethod.selectedAddress,networkClientId, removing thechainIdoption.Tokentypes toTokensController:addDetectedTokensinstead of objects containing only{ address, decimals, symbol }.detectTokenswas limited to two batches, with the first batch being limited to 1000 tokens.getBalancesInSingleCallcallback fails, it does not throw an error or exit early, and the method continues processing the next batch of tokens.BREAKING:
#restartTokenDetectionis a private method instead of public.BREAKING: Replace the
getChainIdFromNetworkStoremethod with the private method#getCorrectChainIdAndNetworkClientId.BREAKING:
#trackMetaMetricsEventsis a private method instead of protected._trackMetaMetricsEvent.TokensControllerNetworkController:getNetworkClientByIdmessenger action.NetworkController:networkDidChange,PreferencesController:stateChange,TokenListController:stateChangeevents.NetworkController:stateChangeevent.Screenshots/Recordings
Pre-merge author checklist
Pre-merge reviewer checklist