core
core copied to clipboard
[tokens-controller] Expose `getState` action and `stateChange` event
With Token Detection Controller and Token Balances Controller, calling "TokensController:getState" action and subscribing "TokensController:stateChange" event, the Tokens Controller needs to be updated to extend Base Controller v2, to start to expose this action and this event and this action.
Where they are currently being used Token Detection Controller: https://github.com/MetaMask/core/blob/8769bd80eb9a131f9fb75ae5f85491eedfc19e62/packages/assets-controllers/src/TokenDetectionController.ts#L522 Token Balances Controller: https://github.com/MetaMask/core/blob/4433150274d74a1858d4fc83ecd2361e53f12f3c/packages/assets-controllers/src/TokenBalancesController.ts#L143
I don't think we need to update it to BaseControllerV2 necessarily, we just need to add the missing action and event
Ah okok! I thought that it was something that we wanted to do to to every controller that it was still extending v1, sorry my mistake!
Oh we definitely want to update everything to BaseControllerV2, but that might be a bit more challenging than just adding the missing action and event. Unsure in this case. We can solve this either way.
I agree that the BaseControllerV2 upgrade for TokensController should be tracked in its own ticket since it involves more tasks: https://github.com/MetaMask/core/issues/4075.
I edited the title to reflect this and narrow the scope of this ticket.