Skip to content

feat: Adding alternateGasFees capability to wallet getCapabilities #16628

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 13 commits into from
Jun 30, 2025

Conversation

jpuri
Copy link
Contributor

@jpuri jpuri commented Jun 24, 2025

Description

Add capability for dapp to know if MM supports paying using other tokens also on a chain.

Related issues

Fixes: https://github.com/MetaMask/MetaMask-planning/issues/5234

Manual testing steps

  1. Go to. test dapp
  2. Click Get Capabilities button
  3. Check result

Screenshots/Recordings

Screenshot 2025-06-24 at 8 03 56 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.

@jpuri jpuri requested a review from a team as a code owner June 24, 2025 14:34
@jpuri jpuri added the team-confirmations Push issues to confirmations team label Jun 24, 2025
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.

@jpuri jpuri requested a review from Copilot June 24, 2025 14:34
Copilot

This comment was marked as outdated.

@jpuri jpuri requested a review from Copilot June 24, 2025 14:37
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for alternateGasFees in the wallet's getCapabilities functionality so that dapps can determine if MetaMask supports paying with alternative tokens on a chain.

  • Introduces a new relay utility (transaction-relay.ts) to assess relay support for chains.
  • Updates the EIP-5792 capabilities logic to merge atomic and alternateGasFees capabilities based on relay and smart transaction checks.
  • Adds comprehensive tests to verify the behavior of relay support and alternateGasFees in both the relay and capabilities modules.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
app/core/RPCMethods/transaction-relay.ts New relay support utility, including network fetch and URL building.
app/core/RPCMethods/transaction-relay.test.ts Tests to verify the relay support logic.
app/core/RPCMethods/eip5792.ts Updates to include alternateGasFees capability integrated into getCapabilities.
app/core/RPCMethods/eip5792.test.ts Test enhancements for alternateGasFees and atomic capability scenarios.
Comments suppressed due to low confidence (1)

app/core/RPCMethods/eip5792.ts:345

  • [nitpick] For consistency, consider renaming 'chainIdNormalised' to 'chainIdNormalized' in the reduce callback.
    (acc, chainIdNormalised) => {

@jpuri jpuri requested a review from a team as a code owner June 25, 2025 05:28
@jpuri jpuri added the Run Smoke E2E Requires smoke E2E testing label Jun 25, 2025
Copy link
Contributor

github-actions bot commented Jun 25, 2025

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 39568d1
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/9353390b-a35e-48ca-ba5b-01b872ab888b

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

@jpuri jpuri requested a review from ffmcgee725 June 27, 2025 04:19
Copy link

@jpuri jpuri added Run Smoke E2E Requires smoke E2E testing and removed Run Smoke E2E Requires smoke E2E testing labels Jun 30, 2025
Copy link
Contributor

github-actions bot commented Jun 30, 2025

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 16d96c9
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/0aa5904d-d825-4212-beb8-0663c3b2e357

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

@jpuri jpuri added this pull request to the merge queue Jun 30, 2025
Merged via the queue into main with commit 4383893 Jun 30, 2025
50 of 56 checks passed
@jpuri jpuri deleted the gasless_capability branch June 30, 2025 10:56
@github-actions github-actions bot locked and limited conversation to collaborators Jun 30, 2025
@metamaskbot metamaskbot added the release-7.51.0 Issue or pull request that will be included in release 7.51.0 label Jun 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-7.51.0 Issue or pull request that will be included in release 7.51.0 Run Smoke E2E Requires smoke E2E testing team-confirmations Push issues to confirmations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants