-
-
Notifications
You must be signed in to change notification settings - Fork 262
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 |
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
rwaDataon tokens and ensures it’s requested from backend APIs and surfaced throughout controllers and consumers.includeRwaData=truetotokens,token,tokens/search, andv3/tokens/trendingURLs; simplifiesgetTokenSearchURL/searchTokenssignature; defaultsincludeRwaDatafor trending; adds Linea filtering (include iflineaTeamor ≥3 aggregators); improves header handling inqueryApirwaDatatoTokenListControllerTokenListToken,TokenRatesControllerToken, selectors’ asset items, and bridgevalidatorsschemarwaDatawhen detecting/adding/importing tokens inTokenDetectionControllerandTokensController; minor return-type annotations inTokenListControllerincludeRwaData=true; add Linea filtering and trending includeRwaData tests; adjust fixtures accordinglyWritten by Cursor Bugbot for commit fb56e97. This will update automatically on new commits. Configure here.