-
-
Notifications
You must be signed in to change notification settings - Fork 256
feat: support returning market data from token search API #7226
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
Merged
+55
−15
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 tasks
Prithpal-Sooriya
approved these changes
Nov 26, 2025
sahar-fehri
approved these changes
Nov 26, 2025
github-merge-queue bot
pushed a commit
to MetaMask/metamask-mobile
that referenced
this pull request
Nov 28, 2025
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->
## **Description**
Right now the results from trending returns the following data:
```
{
"assetId":"eip155:1/erc20:0xdac17f958d2ee523a2206206994597c13d831ec7",
"decimals":6,
"name":"Tether USD",
"symbol":"USDT"
}
```
This impacts the UI in the following way:
<img height="700" alt="image"
src="https://github.com/user-attachments/assets/19dd0865-55cc-4a45-9fe7-89476060dc47"
/>
As you can see the items returned from the search API do not have:
- volume
- market-cap
- price
- price change (24h)
I have modified:
- The search API
[here](consensys-vertical-apps/va-mmcx-token-api#194)
to return marketData optionally.
- Core [here](MetaMask/core#7226) to adopt this
new `includeMarketData` parameter
<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->
## **Changelog**
<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`
If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`
(This helps the Release Engineer do their job more quickly and
accurately)
-->
CHANGELOG entry: get marketData on trending search request
## **Related issues**
Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-1834
## **Manual testing steps**
```gherkin
Feature: my feature name
Scenario: user [verb for user action]
Given [describe expected initial app state]
When user [verb for user action]
Then [describe expected outcome]
```
## **Screenshots/Recordings**
### **Before**
<img height="700" alt="image"
src="https://github.com/user-attachments/assets/19dd0865-55cc-4a45-9fe7-89476060dc47"
/>
### **After**
<img height="700" alt="image"
src="https://github.com/user-attachments/assets/b79e4ce8-153a-49ab-9402-187b79b6f2b6"
/>
## **Pre-merge author checklist**
- [ ] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
## **Pre-merge reviewer checklist**
- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Integrates market data from token search into trending results, adds
robust typing and stale-request handling in hooks, and updates tests and
section config accordingly.
>
> - **Trending/Search Hooks**:
> - **`useSearchRequest`**: Adds typed `SearchResult` with market data
fields; returns typed results; improves loading/error handling; prevents
stale overwrites via request IDs; skips calls and clears results on
empty queries; stabilizes `chainIds` to avoid redundant fetches.
> - **`useTrendingSearch`**: Merges search results into trending tokens,
mapping market data and 24h price change (`pricePercentChange1d` ->
`priceChangePct.h24`); deduplicates by `assetId`; maintains sort and
loading behavior.
> - **Tests**:
> - Expand unit tests for success/error states, manual retry, empty
query behavior, stale request protection, param-change triggering, and
stable `chainIds` reference; add helpers and correct typing.
> - **Sections Config**:
> - Updates `useSectionData` `refetch` type to allow `Promise<void> |
void`; simplifies `SectionData` to `data` and `isLoading`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
2bc3dea. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Explanation
Right now the results from trending returns the following data:
This impacts the UI in the following way:

As you can see the items returned from the search API do not have:
I have modified the search API here to return marketData optionally. This PR makes it possible for Mobile and Extension to fetch and use this data
Note
Adds an
includeMarketDataoption tosearchTokens(default false) and propagates it to the token search API; updates tests and changelog.src/token-service.ts):getTokenSearchURLandsearchTokensto supportincludeMarketData(defaults tofalse) and appendincludeMarketDatato the/tokens/searchquery.src/token-service.test.ts):includeMarketData=falsein requests.includeMarketData=true.CHANGELOG.mdto note optional market data support forsearchTokens.Written by Cursor Bugbot for commit 322c5dd. This will update automatically on new commits. Configure here.
References
Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-1834
Checklist