Commit 3901bb0
feat: new bridge asset picker and token list endpoints (#37685)
<!--
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**
Refactors bridge asset selection to use assetId instead of address,
simplifies state management, and introduces a new asset picker component
with improved token fetching
### Data/State changes
- Replace address references with assetId (simplifies slippage defaults
and asset deduplication)
- Read network allowlist from chainRanking LD config
- Combine setFromChain and setFromToken actions; asset picker manages
local selectedNetwork state, so network only changes when setFromToken
changes
- Refactor useMultichainBalances into selectors for type safety and to
simplify balance and metadata lookups
### Components
- Replace AssetPicker with a new implementation using the search and
popular getToken endpoints for token lists
<!--
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?
-->
[](https://codespaces.new/MetaMask/metamask-extension/pull/37685?quickstart=1)
## **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: feat: implement new bridge asset picker and read token
data from new popular and search api endpoints
## **Related issues**
Fixes:
## **Manual testing steps**
1. Go to this page...
2.
3.
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
### **After**
<!-- [screenshots/recordings] -->
## **Pre-merge author checklist**
- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/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-extension/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]
> Modernizes bridge asset discovery and state.
>
> - Introduces new bridge asset picker using `getTokens/popular` and
`getTokens/search`; consolidates `setFromChain` into `setFromToken` and
updates network switching logic
> - Migrates bridge to CAIP `assetId`/`chainId` throughout (balances,
prices, token pairs, images); adds `BRIDGE_ONLY_CHAINS`, CAIP explorer
URL map, and network image mapping
> - Updates Security Alerts API utilities to accept CAIP ids and convert
to service chain names
> - Broad test refresh: new selector unit tests, extensive e2e updates
(ETH/L2, Tron, Solana, Bitcoin), new fixtures/mocks/seed data; adjusts
expectations for quotes/metrics
> - i18n cleanup: remove unverified-token strings; add
`bridgeTokenNotFound`; minor copy fixes
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
5508ef7. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: hunty <[email protected]>
Co-authored-by: MetaMask Bot <[email protected]>1 parent ee7c5bb commit 3901bb0
File tree
103 files changed
+7829
-3419
lines changed- app
- _locales
- de
- el
- en_GB
- en
- es
- fr
- ga
- hi
- id
- ja
- ko
- pt
- ru
- tl
- tr
- vi
- zh_CN
- scripts/controller-init
- test
- data/bridge
- e2e
- benchmarks
- page-objects/pages
- bridge
- swap
- seeder/network-states
- tests
- bridge
- metrics
- tron
- mocks
- jest
- ui
- ducks/bridge
- hooks
- bridge
- __snapshots__
- pages/bridge
- __snapshots__
- hooks
- layout
- prepare
- __snapshots__
- components
- __snapshots__
- bridge-asset-picker
- __snapshots__
- quotes
- __snapshots__
- utils
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
103 files changed
+7829
-3419
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments