Skip to content

feat: add rwa data to tokens in tokens controller#7804

Merged
oscarwroche merged 11 commits intomainfrom
feat/sync-rwa-data-tokens-controller
Feb 5, 2026
Merged

feat: add rwa data to tokens in tokens controller#7804
oscarwroche merged 11 commits intomainfrom
feat/sync-rwa-data-tokens-controller

Conversation

@oscarwroche
Copy link
Contributor

@oscarwroche oscarwroche commented Feb 2, 2026

Explanation

  • Propagate cached rwaData onto tokens when metadata is updated.
  • Thread optional rwaData through addToken so suggested assets can carry RWA data.
  • Set token rwaData from the supplied argument instead of token metadata (which doesn't contain rwaData)

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

Medium Risk
Touches token state write paths (addToken/watchAsset) and cache-to-state propagation, which can affect persisted token metadata and UI display if rwaData is set/cleared incorrectly, but scope is limited and covered by new tests.

Overview
Adds optional rwaData plumbing to TokensController token additions so watchAsset/addToken can persist RWA metadata, including allowing rwaData: undefined to clear previously-stored RWA data on re-add.

Also updates the TokenListController cache sync logic to key lookups by lowercased token address and to propagate cached rwaData onto existing tokens, with tests covering overwrite/clear behavior and cache-driven updates; changelog is updated accordingly.

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

@oscarwroche oscarwroche requested a review from a team as a code owner February 2, 2026 10:00
@oscarwroche oscarwroche force-pushed the feat/sync-rwa-data-tokens-controller branch 2 times, most recently from 71c41ef to b0f194e Compare February 2, 2026 10:07
@oscarwroche oscarwroche force-pushed the feat/sync-rwa-data-tokens-controller branch 2 times, most recently from 9a7d42f to 7cf3066 Compare February 2, 2026 10:28
@oscarwroche oscarwroche requested a review from a team as a code owner February 2, 2026 10:28
@oscarwroche oscarwroche changed the title feat: add rwa data to tokens in tokens controller feat: add rwa data to tokens in tokens controller - cp-7.64.0 Feb 2, 2026
@oscarwroche oscarwroche force-pushed the feat/sync-rwa-data-tokens-controller branch from bd29fa0 to 994090c Compare February 2, 2026 12:02
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

@oscarwroche oscarwroche requested a review from salimtb February 2, 2026 13:15
Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

One suggestion. Would be good to get input from @MetaMask/metamask-assets as well.

BTW, cp-XXX in PR titles for this repo doesn't have any effect — this pattern is only applicable to extension and mobile.

// We rely on `window` to make requests
testEnvironment: '<rootDir>/jest.environment.js',

// Watchman isn't available in some environments (e.g. sandboxed CI/containers)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Should this be in its own PR? It doesn't seem to be related to the changes here and might get buried. It would also be good to understand what you were doing when you encountered the problem that this fixes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's just codex that added this, good catch, will get rid of it :)

@oscarwroche
Copy link
Contributor Author

One suggestion. Would be good to get input from @MetaMask/metamask-assets as well.

BTW, cp-XXX in PR titles for this repo doesn't have any effect — this pattern is only applicable to extension and mobile.

We would like to release a version of this package with these changes to cherry pick for last week's RC - do you know what the usual method for this would be ? @mcmire

@mcmire
Copy link
Contributor

mcmire commented Feb 2, 2026

@oscarwroche Yup! So the process works like this:

  1. (Optional) Because you're making changes to the @metamask/assets-controllers package, you can optionally create a preview build of this package and then install that preview build in the mobile app. A preview build is essentially a prerelease and allows you to test the changes that you're introducing in the mobile app before merging this PR. You can kick that off by posting a comment in this PR with @metamaskbot publish-previews. Read here for more: https://github.com/MetaMask/core/blob/main/docs/processes/testing-changes-in-other-projects.md#testing-changes-to-packages-with-preview-builds
  2. After merging this PR, you will need to make a new release of @metamask/assets-controllers. Here are instructions for doing that: https://github.com/MetaMask/core/blob/main/docs/processes/releasing.md
  3. Upgrade the mobile app to use the new version and you're good to go!

@salimtb
Copy link
Contributor

salimtb commented Feb 2, 2026

@oscarwroche i'll publish a preview build , can you pls use it on the extension and check if everything is working as expected

@salimtb
Copy link
Contributor

salimtb commented Feb 2, 2026

@metamaskbot publish-preview

@Akaryatrh Akaryatrh changed the title feat: add rwa data to tokens in tokens controller - cp-7.64.0 feat: add rwa data to tokens in tokens controller Feb 4, 2026
@Akaryatrh
Copy link
Contributor

@metamaskbot publish-preview

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

Preview builds have been published. See these instructions for more information about preview builds.

Expand for full list of packages and versions.
{
  "@metamask-previews/account-tree-controller": "4.0.0-preview-55087dcda",
  "@metamask-previews/accounts-controller": "35.0.2-preview-55087dcda",
  "@metamask-previews/address-book-controller": "7.0.1-preview-55087dcda",
  "@metamask-previews/ai-controllers": "0.0.0-preview-55087dcda",
  "@metamask-previews/analytics-controller": "1.0.0-preview-55087dcda",
  "@metamask-previews/analytics-data-regulation-controller": "0.0.0-preview-55087dcda",
  "@metamask-previews/announcement-controller": "8.0.0-preview-55087dcda",
  "@metamask-previews/app-metadata-controller": "2.0.0-preview-55087dcda",
  "@metamask-previews/approval-controller": "8.0.0-preview-55087dcda",
  "@metamask-previews/assets-controller": "0.2.0-preview-55087dcda",
  "@metamask-previews/assets-controllers": "99.2.0-preview-55087dcda",
  "@metamask-previews/base-controller": "9.0.0-preview-55087dcda",
  "@metamask-previews/bridge-controller": "65.3.0-preview-55087dcda",
  "@metamask-previews/bridge-status-controller": "65.0.1-preview-55087dcda",
  "@metamask-previews/build-utils": "3.0.4-preview-55087dcda",
  "@metamask-previews/chain-agnostic-permission": "1.4.0-preview-55087dcda",
  "@metamask-previews/claims-controller": "0.4.2-preview-55087dcda",
  "@metamask-previews/composable-controller": "12.0.0-preview-55087dcda",
  "@metamask-previews/connectivity-controller": "0.1.0-preview-55087dcda",
  "@metamask-previews/controller-utils": "11.18.0-preview-55087dcda",
  "@metamask-previews/core-backend": "5.1.0-preview-55087dcda",
  "@metamask-previews/delegation-controller": "2.0.0-preview-55087dcda",
  "@metamask-previews/earn-controller": "11.1.0-preview-55087dcda",
  "@metamask-previews/eip-5792-middleware": "2.1.0-preview-55087dcda",
  "@metamask-previews/eip-7702-internal-rpc-middleware": "0.1.0-preview-55087dcda",
  "@metamask-previews/eip1193-permission-middleware": "1.0.3-preview-55087dcda",
  "@metamask-previews/ens-controller": "19.0.2-preview-55087dcda",
  "@metamask-previews/error-reporting-service": "3.0.1-preview-55087dcda",
  "@metamask-previews/eth-block-tracker": "15.0.1-preview-55087dcda",
  "@metamask-previews/eth-json-rpc-middleware": "23.1.0-preview-55087dcda",
  "@metamask-previews/eth-json-rpc-provider": "6.0.0-preview-55087dcda",
  "@metamask-previews/foundryup": "1.0.1-preview-55087dcda",
  "@metamask-previews/gas-fee-controller": "26.0.2-preview-55087dcda",
  "@metamask-previews/gator-permissions-controller": "1.1.2-preview-55087dcda",
  "@metamask-previews/json-rpc-engine": "10.2.1-preview-55087dcda",
  "@metamask-previews/json-rpc-middleware-stream": "8.0.8-preview-55087dcda",
  "@metamask-previews/keyring-controller": "25.1.0-preview-55087dcda",
  "@metamask-previews/logging-controller": "7.0.1-preview-55087dcda",
  "@metamask-previews/message-manager": "14.1.0-preview-55087dcda",
  "@metamask-previews/messenger": "0.3.0-preview-55087dcda",
  "@metamask-previews/multichain-account-service": "5.1.0-preview-55087dcda",
  "@metamask-previews/multichain-api-middleware": "1.2.6-preview-55087dcda",
  "@metamask-previews/multichain-network-controller": "3.0.2-preview-55087dcda",
  "@metamask-previews/multichain-transactions-controller": "7.0.0-preview-55087dcda",
  "@metamask-previews/name-controller": "9.0.0-preview-55087dcda",
  "@metamask-previews/network-controller": "29.0.0-preview-55087dcda",
  "@metamask-previews/network-enablement-controller": "4.1.0-preview-55087dcda",
  "@metamask-previews/notification-services-controller": "21.0.0-preview-55087dcda",
  "@metamask-previews/permission-controller": "12.2.0-preview-55087dcda",
  "@metamask-previews/permission-log-controller": "5.0.0-preview-55087dcda",
  "@metamask-previews/perps-controller": "0.0.0-preview-55087dcda",
  "@metamask-previews/phishing-controller": "16.1.0-preview-55087dcda",
  "@metamask-previews/polling-controller": "16.0.2-preview-55087dcda",
  "@metamask-previews/preferences-controller": "22.1.0-preview-55087dcda",
  "@metamask-previews/profile-metrics-controller": "3.0.0-preview-55087dcda",
  "@metamask-previews/profile-sync-controller": "27.1.0-preview-55087dcda",
  "@metamask-previews/ramps-controller": "6.0.0-preview-55087dcda",
  "@metamask-previews/rate-limit-controller": "7.0.0-preview-55087dcda",
  "@metamask-previews/remote-feature-flag-controller": "4.0.0-preview-55087dcda",
  "@metamask-previews/sample-controllers": "4.0.2-preview-55087dcda",
  "@metamask-previews/seedless-onboarding-controller": "7.1.0-preview-55087dcda",
  "@metamask-previews/selected-network-controller": "26.0.2-preview-55087dcda",
  "@metamask-previews/shield-controller": "5.0.1-preview-55087dcda",
  "@metamask-previews/signature-controller": "39.0.1-preview-55087dcda",
  "@metamask-previews/storage-service": "1.0.0-preview-55087dcda",
  "@metamask-previews/subscription-controller": "5.4.2-preview-55087dcda",
  "@metamask-previews/transaction-controller": "62.14.0-preview-55087dcda",
  "@metamask-previews/transaction-pay-controller": "12.1.0-preview-55087dcda",
  "@metamask-previews/user-operation-controller": "41.0.2-preview-55087dcda"
}

@oscarwroche oscarwroche enabled auto-merge February 5, 2026 17:25
@oscarwroche oscarwroche added this pull request to the merge queue Feb 5, 2026
Merged via the queue into main with commit c9cbd07 Feb 5, 2026
302 checks passed
@oscarwroche oscarwroche deleted the feat/sync-rwa-data-tokens-controller branch February 5, 2026 17:27
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.

5 participants