Uh oh!
There was an error while loading. Please reload this page.
fix: update tokens controllers to use selectedAccountId instead of selectedAddress - #4219
Conversation
montelaidev
commented
Apr 26, 2024
@metamaskbot publish-preview |
78ef3b5 to
6c0595dComparemontelaidev
commented
Apr 29, 2024
@metamaskbot publish-preview |
1 similar comment
montelaidev
commented
Apr 29, 2024
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
montelaidev
commented
Apr 30, 2024
cb17e99 to
1e319a0Compare| */ | ||
| constructor({ | ||
| selectedAddress, | ||
| selectedAccountId, |
There was a problem hiding this comment.
Similar comment as here — what are your thoughts on using the messenger to get the current value of this later on in the constructor rather than having the controller take this as an argument?
| onPreferencesStateChange, | ||
| selectedAccountId, | ||
| getInternalAccount, | ||
| onSelectedAccountChange, |
There was a problem hiding this comment.
Similar comment as above, but in addition, instead of continuing with the callback pattern is it possible to listen to the AccountsController:selectedAccountChange event instead?
| constructor({ | ||
| chainId: initialChainId, | ||
| selectedAddress, | ||
| selectedAccountId, |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…ns-controllers-to-use-internal-accounts
…ns-controllers-to-use-internal-accounts
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| const selectedAccount = this.messagingSystem.call( | ||
| 'AccountsController:getAccount', | ||
| this.#selectedAccountId, | ||
| ); |
There was a problem hiding this comment.
| constselectedAccount=this.messagingSystem.call( | |
| 'AccountsController:getAccount', | |
| this.#selectedAccountId, | |
| ); | |
| constselectedAddress=this.#getSelectedAddress(); |
And use selectedAddress afterward
There was a problem hiding this comment.
WDYT about this suggestion ⬆️?
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| const selectedAccount = this.messagingSystem.call( | ||
| 'AccountsController:getAccount', | ||
| this.#selectedAccountId, | ||
| ); |
There was a problem hiding this comment.
WDYT about this suggestion ⬆️?
…ns-controllers-to-use-internal-accounts
montelaidev
commented
Jun 18, 2024
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
ccharly
left a comment
There was a problem hiding this comment.
Good job :) this was a big one! :)
montelaidev
commented
Jun 20, 2024
@metamaskbot publish-preview |
…lectedAddress (#4219) ## Explanation This PR updates the `selectedAccount` to `selectedAccountId` in the token controllers ## References FixesMetaMask/accounts-planning#381 ## Changelog ### `@metamask/assets-controllers` - **BREAKING**: `TokenBalancesController` update `PreferencesConrtollerGetStateAction` to `AccountsControllerGetSelectedAccountAction` - **BREAKING**: `TokenDetectionController` change `selectedAddress` to `selectedAccountId` - **ADDED**: `TokenDetectionController` add `getAccountAction` - **BREAKING**: `TokenRatesController` change `selectedAddress` to `selectedAccountId` - **BREAKING**: `onPreferencesStateChange` arg removed and `getInternalAccount` and `onSelectedAccountChange` added in `TokenRatesController` - **ADDED**: `getAccountAction` added in`TokensController` - **BREAKING**: Changed `selectedAddress` to `selectedAccountId` and `PreferencesControllerStateChangeEvent` to `AccountsControllerSelectedEvmAccountChangeEvent` in the `TokensController` - **ADDED**: `getAccountAction` added in`TokensController` ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've highlighted breaking changes using the "BREAKING" category above as appropriate
Explanation
This PR updates the
selectedAccounttoselectedAccountIdin the token controllersReferences
Fixeshttps://github.com/MetaMask/accounts-planning/issues/381
Changelog
@metamask/assets-controllersTokenBalancesControllermessenger must allow the actionAccountsController:getSelectedAccountand removePreferencesController:getState.TokenDetectionControllermessenger must allow the actionAccountsController:getAccount.TokenDetectionControllermessenger must allow the eventAccountsController:selectedEvmAccountChangeand removeAccountsController:selectedAccountChange.TokenDetectionControllerremovesselectedAddressconstructor argument.TokenRatesControllermessenger must allow the actionAccountsController:getAccount,AccountsController:getSelectedAccountand removePreferencesController:getState.TokenRatesControllermessenger must allow the eventAccountsController:selectedEvmAccountChangeand removePreferencesController:stateChange.TokensControllermessenger must allow the actionAccountsController:getAccount,AccountsController:getSelectedAccount.TokensControllermessenger must allow the eventAccountsController:selectedEvmAccountChange.TokensControllerremovesselectedAddressconstructor argument.Checklist