feat: add rwa data to tokens in tokens controller#7804
Conversation
71c41ef to
b0f194e
Compare
9a7d42f to
7cf3066
Compare
bd29fa0 to
994090c
Compare
mcmire
left a comment
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
It's just codex that added this, good catch, will get rid of it :)
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 |
|
@oscarwroche Yup! So the process works like this:
|
|
@oscarwroche i'll publish a preview build , can you pls use it on the extension and check if everything is working as expected |
|
@metamaskbot publish-preview |
Co-authored-by: Sébastien Van Eyck <sebastien.vaneyck@gmail.com>
|
@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. |
Explanation
rwaDataonto tokens when metadata is updated.rwaDatathroughaddTokenso suggested assets can carry RWA data.rwaDatafrom the supplied argument instead of token metadata (which doesn't containrwaData)References
Checklist
Note
Medium Risk
Touches token state write paths (
addToken/watchAsset) and cache-to-state propagation, which can affect persisted token metadata and UI display ifrwaDatais set/cleared incorrectly, but scope is limited and covered by new tests.Overview
Adds optional
rwaDataplumbing toTokensControllertoken additions sowatchAsset/addTokencan persist RWA metadata, including allowingrwaData: undefinedto 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
rwaDataonto 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.