Commit 9dc36c2
authored
feat: support returning market data from token search API (#7226)
## Explanation
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. This PR makes it possible for Mobile
and Extension to fetch and use this data
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Adds an `includeMarketData` option to `searchTokens` (default false)
and propagates it to the token search API; updates tests and changelog.
>
> - **Token Service (`src/token-service.ts`)**:
> - Extend `getTokenSearchURL` and `searchTokens` to support
`includeMarketData` (defaults to `false`) and append `includeMarketData`
to the `/tokens/search` query.
> - **Tests (`src/token-service.test.ts`)**:
> - Update expectations to include `includeMarketData=false` in
requests.
> - Add test covering `includeMarketData=true`.
> - **Docs**:
> - Update `CHANGELOG.md` to note optional market data support for
`searchTokens`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
322c5dd. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:
* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?
* Are there any changes whose purpose might not obvious to those
unfamiliar with the domain?
* If your primary goal was to update one package but you found you had
to update another one along the way, why did you do so?
* If you had to upgrade a dependency, why did you do so?
-->
## References
Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-1834
<!--
Are there any issues that this pull request is tied to?
Are there other links that reviewers should consult to understand these
changes better?
Are there client or consumer pull requests to adopt any breaking
changes?
For example:
* Fixes #12345
* Related to #67890
-->
## 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](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/core/tree/main/docs/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them1 parent 61d1bb0 commit 9dc36c2
File tree
3 files changed
+55
-15
lines changed- packages/assets-controllers
- src
3 files changed
+55
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
499 | 499 | | |
500 | 500 | | |
501 | 501 | | |
502 | | - | |
| 502 | + | |
503 | 503 | | |
504 | 504 | | |
505 | 505 | | |
| |||
523 | 523 | | |
524 | 524 | | |
525 | 525 | | |
526 | | - | |
| 526 | + | |
527 | 527 | | |
528 | 528 | | |
529 | 529 | | |
| |||
549 | 549 | | |
550 | 550 | | |
551 | 551 | | |
552 | | - | |
| 552 | + | |
553 | 553 | | |
554 | 554 | | |
555 | 555 | | |
| |||
575 | 575 | | |
576 | 576 | | |
577 | 577 | | |
578 | | - | |
| 578 | + | |
579 | 579 | | |
580 | 580 | | |
581 | 581 | | |
| |||
595 | 595 | | |
596 | 596 | | |
597 | 597 | | |
598 | | - | |
| 598 | + | |
599 | 599 | | |
600 | 600 | | |
601 | 601 | | |
| |||
609 | 609 | | |
610 | 610 | | |
611 | 611 | | |
612 | | - | |
| 612 | + | |
613 | 613 | | |
614 | 614 | | |
615 | 615 | | |
| |||
623 | 623 | | |
624 | 624 | | |
625 | 625 | | |
626 | | - | |
| 626 | + | |
627 | 627 | | |
628 | 628 | | |
629 | 629 | | |
| |||
643 | 643 | | |
644 | 644 | | |
645 | 645 | | |
646 | | - | |
| 646 | + | |
647 | 647 | | |
648 | 648 | | |
649 | 649 | | |
| |||
662 | 662 | | |
663 | 663 | | |
664 | 664 | | |
665 | | - | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
666 | 668 | | |
667 | 669 | | |
668 | 670 | | |
| |||
676 | 678 | | |
677 | 679 | | |
678 | 680 | | |
679 | | - | |
| 681 | + | |
680 | 682 | | |
681 | 683 | | |
682 | 684 | | |
| |||
709 | 711 | | |
710 | 712 | | |
711 | 713 | | |
712 | | - | |
| 714 | + | |
713 | 715 | | |
714 | 716 | | |
715 | 717 | | |
| |||
721 | 723 | | |
722 | 724 | | |
723 | 725 | | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
724 | 751 | | |
725 | 752 | | |
726 | 753 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
57 | 58 | | |
58 | 59 | | |
59 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
60 | 66 | | |
61 | 67 | | |
62 | 68 | | |
63 | 69 | | |
64 | | - | |
| 70 | + | |
65 | 71 | | |
66 | 72 | | |
67 | 73 | | |
| |||
144 | 150 | | |
145 | 151 | | |
146 | 152 | | |
| 153 | + | |
147 | 154 | | |
148 | 155 | | |
149 | 156 | | |
150 | 157 | | |
151 | 158 | | |
152 | | - | |
| 159 | + | |
153 | 160 | | |
154 | | - | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
155 | 167 | | |
156 | 168 | | |
157 | 169 | | |
| |||
0 commit comments