-
-
Notifications
You must be signed in to change notification settings - Fork 263
chore: create new assets controller package #7587
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
base: main
Are you sure you want to change the base?
Conversation
| /** | ||
| * The metadata for the state of the {@link AssetsController}. | ||
| */ | ||
| const assetsControllerMetadata: StateMetadata<AssetsControllerState> = {}; |
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.
Can we use satisfies instead of a type assertion here? See SamplePetnamesController in the sample-controllers package:
core/packages/sample-controllers/src/sample-petnames-controller.ts
Lines 42 to 49 in 5db273f
| const samplePetnamesControllerMetadata = { | |
| namesByChainIdAndAddress: { | |
| includeInDebugSnapshot: false, | |
| includeInStateLogs: true, | |
| persist: true, | |
| usedInUi: true, | |
| }, | |
| } satisfies StateMetadata<SamplePetnamesControllerState>; |
| const assetsControllerMetadata: StateMetadata<AssetsControllerState> = {}; | |
| const assetsControllerMetadata = {} satisfies StateMetadata<AssetsControllerState>; |
| } from './AssetsController'; | ||
| export { | ||
| AssetsController, | ||
| controllerName, |
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.
Generally we do not export names of controllers, controllerName is an internal variable only. If there are multiple controllers in a package then there would be multiple controllerName exports. Would you mind removing this?
| controllerName, |
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.
Two questions:
-
What do you think about copying and pasting one of the controllers in the
sample-controllerspackage? This way we can keep the general look and feel for a controller consistent across all packages. -
I see that we are creating a new package called
assets-controller, when we already have a package calledassets-controllers(with an "s"). I'm a bit worried this will be a constant source of confusion, and so perhaps we shouldn't make a new package yet? Or — are there any near-term plans to split apartassets-controllers?
Explanation
This PR introduces a new
@metamask/assets-controllerpackage as a placeholder for future consolidation of asset tracking functionality.Current state:
Asset tracking functionality (account balances, token balances, asset detection) is currently spread across multiple controllers in the
@metamask/assets-controllerspackage.Solution:
This PR creates an empty
@metamask/assets-controllerpackage as a foundation for future work to consolidate asset tracking into a single, unified controller. The package currently exports nothing and serves as a placeholder with TODOs indicating the intended scope:No functional changes are included in this PR.
References
Checklist
Note
Introduces a new monorepo package
@metamask/assets-controlleras a scaffold for future asset tracking consolidation.AssetsController(BaseController-based) with empty state,getStateaction, and stateChange event typing; exports viasrc/index.tsAssetsController.test.ts) validating default state, action wiring, and event subscriptionpackage.json, tsconfigs, Jest config, Typedoc, README, LICENSEREADME(package list + graph),.github/CODEOWNERS,teams.json, roottsconfig*, andyarn.lockWritten by Cursor Bugbot for commit a2cdfae. This will update automatically on new commits. Configure here.