Skip to content

Conversation

@salimtb
Copy link
Contributor

@salimtb salimtb commented Jan 8, 2026

Explanation

This PR introduces a new @metamask/assets-controller package 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-controllers package.

Solution:
This PR creates an empty @metamask/assets-controller package 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:

  • Account balance tracking
  • Token balance tracking
  • Asset detection

No functional changes are included in this PR.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Introduces a new monorepo package @metamask/assets-controller as a scaffold for future asset tracking consolidation.

  • Adds AssetsController (BaseController-based) with empty state, getState action, and stateChange event typing; exports via src/index.ts
  • Includes tests (AssetsController.test.ts) validating default state, action wiring, and event subscription
  • Adds package scaffolding: package.json, tsconfigs, Jest config, Typedoc, README, LICENSE
  • Wires package into repo: updates README (package list + graph), .github/CODEOWNERS, teams.json, root tsconfig*, and yarn.lock

Written by Cursor Bugbot for commit a2cdfae. This will update automatically on new commits. Configure here.

@salimtb salimtb marked this pull request as ready for review January 8, 2026 16:05
@salimtb salimtb requested a review from a team as a code owner January 8, 2026 16:05
/**
* The metadata for the state of the {@link AssetsController}.
*/
const assetsControllerMetadata: StateMetadata<AssetsControllerState> = {};
Copy link
Contributor

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:

const samplePetnamesControllerMetadata = {
namesByChainIdAndAddress: {
includeInDebugSnapshot: false,
includeInStateLogs: true,
persist: true,
usedInUi: true,
},
} satisfies StateMetadata<SamplePetnamesControllerState>;

Suggested change
const assetsControllerMetadata: StateMetadata<AssetsControllerState> = {};
const assetsControllerMetadata = {} satisfies StateMetadata<AssetsControllerState>;

} from './AssetsController';
export {
AssetsController,
controllerName,
Copy link
Contributor

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?

Suggested change
controllerName,

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two questions:

  1. What do you think about copying and pasting one of the controllers in the sample-controllers package? This way we can keep the general look and feel for a controller consistent across all packages.

  2. I see that we are creating a new package called assets-controller, when we already have a package called assets-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 apart assets-controllers?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants