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

feat: mms-1876 swap pre populated #30929

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

GustavoRSSilva
Copy link
Contributor

@GustavoRSSilva GustavoRSSilva commented Mar 12, 2025

Description

Set a default token populated when going to the swap page

Open in GitHub Codespaces

Related issues

Fixes:

Manual testing steps

  1. Go to the swap page
  2. Check token populated

Screenshots/Recordings

Before

After

Screen.Recording.2025-03-12.at.11.44.16.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.

@GustavoRSSilva GustavoRSSilva requested a review from a team as a code owner March 12, 2025 11:46
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.

@metamaskbot metamaskbot added the team-swaps-and-bridge Team swaps and bridge label Mar 12, 2025
@metamaskbot
Copy link
Collaborator

Builds ready [8c6052c]
Page Load Metrics (2031 ± 149 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint166326001991247119
domContentLoaded16352403187617584
load166428922031311149
domInteractive257336136
backgroundConnect1159415016579
firstReactRender15153513919
getState64107210450
initialActions01000
loadScripts12041823142812962
setupStore8189354923
uiStartup184754102696961461
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 170 Bytes (0.00%)
  • common: 2.27 KiB (0.02%)

@@ -754,6 +755,15 @@ export default function PrepareSwapPage({
}
}, [showQuotesLoadingAnimation]);

// Set the default destination token for the swap
useEffect(() => {
if (!selectedToToken?.address && DEFAULT_TO_TOKEN_BY_NETWORK[chainId]) {
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a condition here to skip pre-populating the toToken if the default token === fromToken?

Repro steps:

  • From homepage, go to asset details page for the default token (i.e, USDC on ethereum)
  • Click Swap from there
  • See that the Swap page has USDC -> USDC filled in, which is an invalid route

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updating it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-swaps-and-bridge Team swaps and bridge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants