Skip to content
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

fix: PortfolioView swap native token bug #28639

Merged
merged 5 commits into from
Nov 25, 2024

Conversation

gambinish
Copy link
Contributor

@gambinish gambinish commented Nov 21, 2024

Description

When PORTFOLIO_VIEW feature flag is enabled, when swapping a native token from a different chain than the globally selected chain, the incorrect native token would be prepoulated in the fromToken in the swap UI.

For instance, if user is on Ethereum mainnet, navigated to POL, then attempted to swap, the globally selected network would change from Ethereum mainnet to Polygon mainnet (expected), but the swaps fromToken would still be POL (unexpected)

Changes in this PR fixes this, and prepoulates fromToken with the native token from the correct chain.

Open in GitHub Codespaces

Related issues

Fixes: #28534

Manual testing steps

  1. PORTFOLIO_VIEW=1 yarn webpack --watch
  2. Import wallet with at least two networks added
  3. When "All Networks" is toggled, attempt to swap a native token from another network. Ensure that the token prepopulated in the swap UI is the native token from the correct chain
  4. Ensure swap completes successfully.

Screenshots/Recordings

Screen.Recording.2024-11-21.at.2.41.16.PM.mov

Pre-merge author checklist

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.

Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@gambinish gambinish marked this pull request as ready for review November 21, 2024 23:11
@gambinish gambinish requested a review from a team as a code owner November 21, 2024 23:11
@metamaskbot
Copy link
Collaborator

Builds ready [77c0ad0]
Page Load Metrics (1855 ± 68 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint32822691790367176
domContentLoaded16562248182314067
load16662271185514268
domInteractive227740178
backgroundConnect993332411
firstReactRender483011316632
getState586212612
initialActions01000
loadScripts11871700133012158
setupStore671192210
uiStartup187625752151229110
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 23 Bytes (0.00%)
  • common: 32 Bytes (0.00%)

@gambinish gambinish added DO-NOT-MERGE Pull requests that should not be merged and removed DO-NOT-MERGE Pull requests that should not be merged labels Nov 22, 2024
@metamaskbot
Copy link
Collaborator

Builds ready [5da7495]
Page Load Metrics (2058 ± 80 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint17842325206116680
domContentLoaded17432256201015675
load17842322205816680
domInteractive279150189
backgroundConnect988462713
firstReactRender721541092211
getState468282010
initialActions01000
loadScripts12501720149414369
setupStore66013157
uiStartup19942544227117886
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 23 Bytes (0.00%)
  • common: 32 Bytes (0.00%)

@gambinish gambinish removed the DO-NOT-MERGE Pull requests that should not be merged label Nov 25, 2024
Copy link
Contributor

@Prithpal-Sooriya Prithpal-Sooriya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved as a second reviewer. Can someone with more domain knowledge double check it?

@metamaskbot
Copy link
Collaborator

Builds ready [591cc4b]
Page Load Metrics (1625 ± 51 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint14711968163510651
domContentLoaded1424189116069847
load14681972162510751
domInteractive217437178
backgroundConnect88120178
firstReactRender1689472713
getState441884
initialActions01000
loadScripts1047143011898239
setupStore679212512
uiStartup16812299192617483
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 22 Bytes (0.00%)
  • common: 32 Bytes (0.00%)

@gambinish gambinish added the portfolio-view Used for PRs and issues related to Q4 2024 portfolio view label Nov 25, 2024
@darkwing darkwing added this pull request to the merge queue Nov 25, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 25, 2024
@darkwing darkwing added this pull request to the merge queue Nov 25, 2024
Merged via the queue into develop with commit ff635d2 Nov 25, 2024
77 checks passed
@darkwing darkwing deleted the fix/portfolio-view--swap-native-token branch November 25, 2024 21:44
@github-actions github-actions bot locked and limited conversation to collaborators Nov 25, 2024
@metamaskbot metamaskbot added the release-12.9.0 Issue or pull request that will be included in release 12.9.0 label Nov 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
portfolio-view Used for PRs and issues related to Q4 2024 portfolio view release-12.9.0 Issue or pull request that will be included in release 12.9.0 team-assets
Projects
None yet
4 participants