-
-
Couldn't load subscription status.
- Fork 251
feat(account-tree-controller): add callbacks for hidden and pinned data #6910
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
Conversation
|
@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. |
packages/account-tree-controller/src/AccountTreeController.test.ts
Outdated
Show resolved
Hide resolved
packages/account-tree-controller/src/AccountTreeController.test.ts
Outdated
Show resolved
Hide resolved
packages/account-tree-controller/src/AccountTreeController.test.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Charly Chevalier <charly.chevalier@consensys.net>
|
@metamaskbot publish-preview |
packages/account-tree-controller/src/AccountTreeController.test.ts
Outdated
Show resolved
Hide resolved
|
|
||
| if (this.#accountOrderCallbacks?.isPinnedAccount) { | ||
| isPinned = group.accounts.some((account) => | ||
| this.#accountOrderCallbacks?.isPinnedAccount?.(account), |
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: But that should be defined inside this if already
| this.#accountOrderCallbacks?.isPinnedAccount?.(account), | |
| this.#accountOrderCallbacks.isPinnedAccount(account), |
|
|
||
| if (this.#accountOrderCallbacks?.isHiddenAccount) { | ||
| isHidden = group.accounts.some((account) => | ||
| this.#accountOrderCallbacks?.isHiddenAccount?.(account), |
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 here:
| this.#accountOrderCallbacks?.isHiddenAccount?.(account), | |
| this.#accountOrderCallbacks.isHiddenAccount(account), |
| }, | ||
| }); | ||
| }); | ||
|
|
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: we could have add a test when both callbacks are provided, but coverage-wise we should be good for those.
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, left some nits, but we can take care of that later on. The logic is good anyway!
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
…r/multichain-transactions-controller * origin/main: (35 commits) feat: `JsonRpcEngineV2` (#6176) Release 641.0.0 (#6940) feat: Add transaction emulation actions (#6935) Release/640.0.0 (#6934) fix(core-backend): control randomness to fix flaky test (#6936) chore: Add `@metamask-previews/*` to NPM age gate exceptions (#6937) Release/639.0.0 (#6931) feat: make getCryptoApproveTransactionParams synchronous (#6930) feat: add new actions to `KeyringController` (#6928) feat: add `getAccounts` to `AccountsController` (#6927) chore: remove `Monad Mainnet` single call balance contract and add into account v4 (#6929) Release/638.0.0 (#6923) fix: Downgrade `multiformats` to `^9.9.0` to avoid ESM-only dependency (#6920) Release/637.0.0 (#6919) feat(account-tree-controller): add callbacks for hidden and pinned data (#6910) Release 636.0.0 (#6918) fix(core-backend): reconnection logic (#6861) fix: Tx state listener and signature coverage (#6906) Release/635.0.0 (#6917) fix(base-controller): add TypeScript declaration file for legacy module resolution (#6915) ...
Explanation
This PR adds a migration mechanism for pinned and hidden state from State 0 into the AccountTreeController.
References
Fixes: https://consensyssoftware.atlassian.net/browse/MUL-1174?atlOrigin=eyJpIjoiYTEwNTBkNDBmYjg4NDAzNzkzMDdjMWVlMDIxMWY4YjQiLCJwIjoiaiJ9
Checklist
Note
Adds optional callbacks to migrate per-account hidden/pinned into group metadata during init, persists defaults when absent, and updates tests and changelog.
config.accountOrderCallbackswithisHiddenAccountandisPinnedAccountto derive grouphidden/pinnedwhen no persisted metadata exists.hidden/pinnedare persisted toaccountGroupsMetadatawithlastUpdatedAt: 0; persisted values take precedence over callbacks.groupId(notgroup.id) when applying names/states.pinned/hiddenentries inaccountGroupsMetadataand group metadata.types.tsto includeaccountOrderCallbacksinAccountTreeControllerConfig.98.34.Written by Cursor Bugbot for commit aa4bb59. This will update automatically on new commits. Configure here.