What is this about?
The core repo TokenDetectionController has been consolidated with the extension DetectTokensController as of MetaMask/core#1812.
Once these changes are released, the extension-side DetectTokensController will be replaced.
Breaking Changes to be introduced by TokenDetectionController
-
Extends StaticIntervalPollingController instead of StaticIntervalPollingControllerOnly
-
Constructor options:
- Removes
getCurrentSelectedAccount, getNetworkClientById callbacks as constructor options. Uses corresponding messenger actions instead.
- Removes
disableLegacyInterval class field and constructor option.
- Instead has
disabled option, which blocks all network requests.
-
Adds enable, disable public methods.
-
#restartTokenDetection is a private method.
#restartTokenDetection accepts options object { selectedAddress, networkClientId } instead of { selectedAddress, chainId }
#restartTokenDetection always resets polling interval to default regardless of whether legacy or new polling is being used.
- Removes the
getChainIdFromNetworkStore public method and replaces internally with #getCorrectChainIdAndNetworkClientId.
-
Uses NetworkController:getNetworkConfigurationByNetworkClientId action instead of NetworkController:getNetworkClientById action to get correct chainId.
- If
networkClientId is not supplied to the method, or it's supplied but getNetworkConfigurationByNetworkClientId returns undefined, finds chainId from providerConfig.
-
detectTokens replaces detectNewTokens
detectTokens accepts options object { accountAddress, networkClientId } instead of { selectedAddress, chainId, networkClientId }.
- Does not throw error if
getBalancesInSingleCall fails. Also does not exit early -- continues looping.
- Passes lists of full
Token types to TokensController:addDetectedTokens instead of objects containing only { address, decimals, symbol }.
#trackMetaMetricsEvents is a private method instead of protected.
-
Passes string literals instead of extension shared constants into _trackMetaMetricsEvent.
Scenario
No response
Design
No response
Technical Details
No response
Threat Modeling Framework
No response
Acceptance Criteria
No response
Stakeholder review needed before the work gets merged
References
What is this about?
The core repo
TokenDetectionControllerhas been consolidated with the extensionDetectTokensControlleras of MetaMask/core#1812.Once these changes are released, the extension-side
DetectTokensControllerwill be replaced.Breaking Changes to be introduced by
TokenDetectionControllerExtends
StaticIntervalPollingControllerinstead ofStaticIntervalPollingControllerOnlyConstructor options:
getCurrentSelectedAccount,getNetworkClientByIdcallbacks as constructor options. Uses corresponding messenger actions instead.disableLegacyIntervalclass field and constructor option.disabledoption, which blocks all network requests.Adds
enable,disablepublic methods.#restartTokenDetectionis a private method.#restartTokenDetectionaccepts options object{ selectedAddress, networkClientId }instead of{ selectedAddress, chainId }#restartTokenDetectionalways resets polling interval to default regardless of whether legacy or new polling is being used.getChainIdFromNetworkStorepublic method and replaces internally with#getCorrectChainIdAndNetworkClientId.Uses
NetworkController:getNetworkConfigurationByNetworkClientIdaction instead ofNetworkController:getNetworkClientByIdaction to get correct chainId.networkClientIdis not supplied to the method, or it's supplied butgetNetworkConfigurationByNetworkClientIdreturns undefined, findschainIdfromproviderConfig.detectTokensreplacesdetectNewTokensdetectTokensaccepts options object{ accountAddress, networkClientId }instead of{ selectedAddress, chainId, networkClientId }.getBalancesInSingleCallfails. Also does not exit early -- continues looping.Tokentypes toTokensController:addDetectedTokensinstead of objects containing only{ address, decimals, symbol }.#trackMetaMetricsEventsis a private method instead of protected.Passes string literals instead of extension shared constants into
_trackMetaMetricsEvent.Scenario
No response
Design
No response
Technical Details
No response
Threat Modeling Framework
No response
Acceptance Criteria
No response
Stakeholder review needed before the work gets merged
References
TokenDetectionControllerup-to-date and release new version ofassets-controllerscore#3916