Skip to content

feat: improve xchain swaps slippage settings with decimals and warnings #29617

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

Merged
merged 7 commits into from
Jan 13, 2025

Conversation

ghgoodreau
Copy link
Contributor

@ghgoodreau ghgoodreau commented Jan 9, 2025

Description

The slippage settings for xchain transactions was not allowing users to input a decimal (i.e. 0.5%), only whole numbers (0, 1, so on...). It also did not display a warning for low slippage settings. This addresses both by allowing the user to input decimal numbers, and displaying a warning when the custom slippage is set to <0.5% in the settings modal.

Open in GitHub Codespaces

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/MMS-1830

Manual testing steps

  1. Go to the xchain swaps transaction preparation page.
  2. Edit slippage settings.
  3. Notice decimals are now allowed, and a warning is displayed with low slippage.

Screenshots/Recordings

Before

Screenshot 2025-01-09 at 4 49 04 PM

After

Screenshot 2025-01-09 at 2 29 30 PM Screenshot 2025-01-09 at 2 29 22 PM

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

github-actions bot commented Jan 9, 2025

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.

@ghgoodreau ghgoodreau added the team-swaps DEPRECATED: Use team-swaps-and-bridge label Jan 9, 2025
@metamaskbot
Copy link
Collaborator

Builds ready [25483db]
Page Load Metrics (1627 ± 64 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint24520521571332159
domContentLoaded13802038159813163
load13892047162713264
domInteractive2494382110
backgroundConnect876292211
firstReactRender1570402311
getState590202110
initialActions01000
loadScripts10041640119712761
setupStore65212136
uiStartup16102276184015776
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 291 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@ghgoodreau ghgoodreau marked this pull request as ready for review January 10, 2025 16:04
@ghgoodreau ghgoodreau requested a review from a team as a code owner January 10, 2025 16:04
@metamaskbot
Copy link
Collaborator

Builds ready [a557648]
Page Load Metrics (1724 ± 46 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint33219331650317152
domContentLoaded1543190217049847
load1609193617249646
domInteractive26319596531
backgroundConnect87122157
firstReactRender1676342210
getState65521199
initialActions01000
loadScripts1085144512668440
setupStore66217188
uiStartup18452193196811153
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 291 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

Copy link
Contributor

@infiniteflower infiniteflower left a comment

Choose a reason for hiding this comment

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

Worked for decimal separator as a period.

Does this work for languages where the decimal separator is a comma?

EDIT: nvm, seems like MM keeps commas for tokens like ETH, and percentage values

EDIT2: eh sometimes ETH is comma separated, sometimes not

@metamaskbot
Copy link
Collaborator

Builds ready [3b07d96]
Page Load Metrics (1763 ± 74 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint72720571706262126
domContentLoaded15181989172613665
load15232054176315374
domInteractive22121473015
backgroundConnect9119402914
firstReactRender167227168
getState485252411
initialActions01000
loadScripts10761575129113063
setupStore65818199
uiStartup17292400202017785
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 43 Bytes (0.00%)
  • ui: 359 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [d6d1448]
Page Load Metrics (1995 ± 95 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint23824641745627301
domContentLoaded16972428197218991
load17292466199519795
domInteractive239047199
backgroundConnect106327167
firstReactRender1882432110
getState669332311
initialActions01000
loadScripts12591867148715675
setupStore75614126
uiStartup191727872292217104
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 359 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@ghgoodreau ghgoodreau requested a review from micaelae January 10, 2025 20:54
@ghgoodreau ghgoodreau enabled auto-merge January 13, 2025 17:54
@ghgoodreau ghgoodreau added this pull request to the merge queue Jan 13, 2025
@metamaskbot
Copy link
Collaborator

Builds ready [1957917]
Page Load Metrics (1605 ± 40 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1505177416187636
domContentLoaded1463176115837536
load1487182016058440
domInteractive24131342311
backgroundConnect116523157
firstReactRender1595362613
getState474202110
initialActions00000
loadScripts1086135811896631
setupStore67216199
uiStartup17162364186714168
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 359 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 13, 2025
@ghgoodreau ghgoodreau added this pull request to the merge queue Jan 13, 2025
Merged via the queue into main with commit de10c46 Jan 13, 2025
79 checks passed
@ghgoodreau ghgoodreau deleted the MMS-1830-slippage-improvements-xchain branch January 13, 2025 19:50
@github-actions github-actions bot locked and limited conversation to collaborators Jan 13, 2025
@metamaskbot metamaskbot added the release-12.11.0 Issue or pull request that will be included in release 12.11.0 label Jan 13, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.11.0 Issue or pull request that will be included in release 12.11.0 team-swaps DEPRECATED: Use team-swaps-and-bridge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants