MetaMask / metamask-extension

:globe_with_meridians: :electric_plug: The MetaMask browser extension enables browsing Ethereum blockchain enabled websites
https://metamask.io
Other
12.06k stars 4.93k forks source link

[Bug]: Network is not switched when performing swap #28477

Closed sleepytanya closed 2 days ago

sleepytanya commented 3 days ago

Describe the bug

Network is not switched when performing swap.

  1. Non-native token When "All networks" is selected and the wallet is set to Polygon (any network other than the one we are going to swap on), choosing BNB USDC correctly displays the USDC balance in both the wallet view and the token details screen. However, on the swap screen and the asset picker screen, the balance appears as zero, accompanied by an incorrect token symbol. Consequently, swaps cannot be executed due to a "Not enough USDC" error. Switching the network to BNB then correctly reflects the USDC balance.

  2. Native token Choosing native token on another network displays native token for the currently selected network, in the assets picker only current network tokens are shown

Build https://drive.google.com/file/d/1jvpo5HO2M3XxOEIg-nKJFL_SRkINkMxT/view

Expected behavior

-

Screenshots/Recordings

Non-native token swap:

https://github.com/user-attachments/assets/58bf59c6-68cd-492c-8ebb-6fbb54e3bc5a

Native token swap:

https://github.com/user-attachments/assets/5cb144a6-3428-4b08-be34-ba462a091137

Steps to reproduce

  1. Start swap

Error messages or log output

No response

Detection stage

On the development branch

Version

dev build

Build type

None

Browser

Chrome

Operating system

MacOS

Hardware wallet

No response

Additional context

No response

Severity

No response

sleepytanya commented 2 days ago

Fixed in this build https://drive.google.com/file/d/1qhGX0lnrTX47M_7kbqBmhOXTd8HvmflL/view?usp=drive_link