-
-
Notifications
You must be signed in to change notification settings - Fork 266
feat: fake the rwaData returned from backend to make sure it work for mobile frontend. #7548
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
|
@metamaskbot publish-preview |
|
@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. |
|
@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. |
|
@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/assets-controllers/src/TokenListController.ts": { | ||
| "@typescript-eslint/explicit-function-return-type": { | ||
| "count": 6 |
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.
This change will fix the lint complaining about --prune-suppressions paratmeter, but when we put that parameter to run yarn lint it still complain. the only way is to change the count here to pass the error, if your guys know some better way to fix this issue, i am happy to change it back here.
| minMarketCap, | ||
| maxMarketCap, | ||
| excludeLabels, | ||
| includeRwaData, |
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.
API parameter documented but silently ignored
Medium Severity
The getTrendingTokens function's type definition still includes includeRwaData?: boolean at line 281, and the CHANGELOG documents this as an optional parameter. However, includeRwaData is no longer destructured from the function parameters (lines 263-271), meaning any value passed by callers is silently ignored. The parameter is now hardcoded to 'true' at line 109. Callers expecting to control RWA data inclusion will experience unexpected behavior.
Additional Locations (1)
| ): Promise<{ count: number; data: TokenSearchItem[] }> { | ||
| const tokenSearchURL = getTokenSearchURL({ | ||
| { limit = 10, includeMarketData = false } = {}, | ||
| ): Promise<{ count: number; data: unknown[] }> { |
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.
Return type loses type safety with unknown[]
Medium Severity
The searchTokens function return type was changed from Promise<{ count: number; data: TokenSearchItem[] }> to Promise<{ count: number; data: unknown[] }>. This is a type regression that removes type safety for callers. Code that consumes the search results will lose access to typed properties like assetId, name, symbol, decimals, and rwaData without explicit type assertions.
| return result.filter( | ||
| (elm) => | ||
| Boolean(elm.aggregators.includes('lineaTeam')) || | ||
| elm.aggregators.length >= 3, |
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.
Inconsistent rwaData type definitions cause mismatch
Medium Severity
The TokenRwaData type in token-service.ts defines all properties as optional (including nested market and nextPause objects), while the inline rwaData types in TokenListToken and Token define nested properties as required. When API data with missing fields is assigned to these stricter types, accessing the supposedly-required nested properties could cause runtime errors.
Additional Locations (2)
|
Due to AssetPicker feature will change the format of rwaData, discussed with team, i convert this PR back to draft. |
| end: string(), | ||
| }), | ||
| }), | ||
| ), |
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.
Type mismatch causes validation failures for partial rwaData
Medium Severity
The TokenRwaData type in token-service.ts defines all inner fields as optional (market?, ticker?, instrumentType?, nextPause? with optional nested fields). However, the rwaData type added to TokenListToken, Token, and the bridge validator all require these inner fields to be present when rwaData exists. If the backend returns partial rwaData (e.g., only ticker without market), it would match TokenRwaData but fail validation and cause runtime errors when accessing missing required properties like rwaData.market.nextOpen.
Additional Locations (2)
|
@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. |
|
@metamaskbot publish-preview |
Updated the Token type definition in TokenRatesController to make the fields related to rwaData optional. This change enhances flexibility in handling token data structures.
|
@metamaskbot publish-preview |
| conversionRate: number; | ||
| } | ||
| | undefined; | ||
| rwaData?: TokenRwaData; |
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.
rwaData not propagated from Token to Asset in selector
Medium Severity
The PR adds rwaData to the Asset type (line 88) and the Token type now includes rwaData, but the selectAllEvmAssets selector constructs asset objects without copying token.rwaData. This causes rwaData to be lost when tokens are converted to assets, making the field always undefined on selected assets even when the underlying token has valid rwaData. The asset construction at lines 307-330 needs to include rwaData: token.rwaData (or conditionally spread it).
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
|
@metamaskbot publish-preview |
This is draft PR to fake the backend returned to provide rwaData metadata to mobile frontend.
Explanation
CHANGELOG entry: fetch the rwaData from token API endpoints and then pass to frontend to render.
References
Checklist
Note
Introduces end-to-end support for Real-World Asset (RWA) metadata in token flows.
rwaDatatoTokenand propagates it inTokenDetectionController,TokensController(add/import/detected),TokenListControlleritems, and token selectorstoken-serviceto requestincludeRwaData=truefor metadata, search, and trending endpoints; refactors search URL builder, defaults RWA inclusion for trending, and adjusts fetch headers handling; tightens Linea token filtering and adds testsincludeRwaDataquery params and validate behavior; adds RWA schema to bridge validatorsTokenListControllermethodsWritten by Cursor Bugbot for commit 8a4f4ea. This will update automatically on new commits. Configure here.