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: Add gas included swaps #13430

Merged
merged 10 commits into from
Feb 13, 2025
Merged

feat: Add gas included swaps #13430

merged 10 commits into from
Feb 13, 2025

Conversation

dan437
Copy link
Contributor

@dan437 dan437 commented Feb 11, 2025

Description

Users who don't have enough ETH to pay for gas fees while swapping will be able to swap now if the gas fee can be taken from one of the tokens they are swapping. Smart transactions must be enabled for this.

Related issues

Fixes:

Manual testing steps

Test case 1:

  1. Make sure you are on Ethereum mainnet and have Smart Transactions on in Advanced Settings
  2. Have e.g. 0 ETH and 100 USDC
  3. Fill in the swap form with 10 USDC -> ETH
  4. You will see gas included swaps UI

Test case 2:

  1. Make sure you are on Ethereum mainnet and have Smart Transactions on in Advanced Settings
  2. In Swaps you can now click on Use max for ETH
  3. Get quotes
  4. You will see gas included swaps UI

Screenshots/Recordings

User doesn't have enough ETH for gas fees (gas included swaps):
image

User has enough ETH for gas fees:
image

Before

After

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.

@dan437 dan437 added the team-confirmations Push issues to confirmations team label Feb 11, 2025
@dan437 dan437 requested review from a team as code owners February 11, 2025 15:35
@dan437 dan437 marked this pull request as draft February 11, 2025 15:35
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-transactions Transactions team label Feb 11, 2025
Copy link

socket-security bot commented Feb 11, 2025

Updated dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@metamask/swaps-controller@12.1.0 🔁 npm/@metamask/swaps-controller@12.0.0 None 0 304 kB metamaskbot

View full report↗︎

@dan437 dan437 force-pushed the gas-included-swaps branch from 24f293e to 2d94ae8 Compare February 12, 2025 10:47
@dan437 dan437 added Run Smoke E2E Triggers smoke e2e on Bitrise and removed team-confirmations Push issues to confirmations team labels Feb 12, 2025
Copy link
Contributor

github-actions bot commented Feb 12, 2025

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: 2d94ae8
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/e9eddaae-1173-46d0-84b8-078b947f4d7d

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

@dan437 dan437 removed the Run Smoke E2E Triggers smoke e2e on Bitrise label Feb 12, 2025
@dan437 dan437 marked this pull request as ready for review February 12, 2025 13:38
@dan437 dan437 added the Run Smoke E2E Triggers smoke e2e on Bitrise label Feb 12, 2025
Copy link
Contributor

github-actions bot commented Feb 12, 2025

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: 4888701
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/9ce9f1d0-33db-4fc1-a122-901ad0a727c6

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

@dan437 dan437 added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Feb 12, 2025
klejeune
klejeune previously approved these changes Feb 12, 2025
@codecov-commenter
Copy link

codecov-commenter commented Feb 13, 2025

Codecov Report

Attention: Patch coverage is 56.86275% with 22 lines in your changes missing coverage. Please review.

Project coverage is 61.82%. Comparing base (351a276) to head (e24eb98).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
app/components/UI/Swaps/QuotesView.js 43.33% 17 Missing ⚠️
app/core/Engine/Engine.ts 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13430      +/-   ##
==========================================
- Coverage   61.83%   61.82%   -0.01%     
==========================================
  Files        1975     1975              
  Lines       43847    43889      +42     
  Branches     5926     5929       +3     
==========================================
+ Hits        27111    27136      +25     
- Misses      14935    14952      +17     
  Partials     1801     1801              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dan437 dan437 added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Feb 13, 2025
Copy link
Contributor

github-actions bot commented Feb 13, 2025

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: d9e81cc
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/a7ba152d-0d14-4a5a-b53f-3d68c6b420f5

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

@dan437 dan437 added release-7.41.0 Issue or pull request that will be included in release 7.41.0 Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Feb 13, 2025
@dan437 dan437 added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Feb 13, 2025
Copy link
Contributor

github-actions bot commented Feb 13, 2025

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: 014d439
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/162cd6be-8e4e-41ef-bdec-43b7eac32571

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

@dan437 dan437 added No E2E Smoke Needed If the PR does not need E2E smoke test run skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. No QA Needed Apply this label when your PR does not need any QA effort. and removed Run Smoke E2E Triggers smoke e2e on Bitrise No E2E Smoke Needed If the PR does not need E2E smoke test run labels Feb 13, 2025
@dan437 dan437 disabled auto-merge February 13, 2025 19:58
@dan437 dan437 force-pushed the gas-included-swaps branch from 014d439 to e24eb98 Compare February 13, 2025 19:59
@dan437 dan437 enabled auto-merge February 13, 2025 20:01
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
50.8% Coverage on New Code (required ≥ 80%)
13.2% Duplication on New Code (required ≤ 10%)

See analysis details on SonarQube Cloud

@dan437 dan437 added this pull request to the merge queue Feb 13, 2025
Merged via the queue into main with commit 665035f Feb 13, 2025
38 of 39 checks passed
@dan437 dan437 deleted the gas-included-swaps branch February 13, 2025 20:29
@github-actions github-actions bot locked and limited conversation to collaborators Feb 13, 2025
@github-actions github-actions bot removed the needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) label Feb 13, 2025
@dan437
Copy link
Contributor Author

dan437 commented Feb 13, 2025

The PR has been merged in order to make it into a release candidate today. There is one known issue which will be resolved in a follow-up PR asap and then cherry picked.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
No E2E Smoke Needed If the PR does not need E2E smoke test run No QA Needed Apply this label when your PR does not need any QA effort. release-7.41.0 Issue or pull request that will be included in release 7.41.0 skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. team-transactions Transactions team
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

8 participants