Skip to content

Conversation

jeffsmale90
Copy link
Collaborator

@jeffsmale90 jeffsmale90 commented Aug 15, 2025

📝 Description

It is now possible to configure MetaMask extension to forward calls to wallet_requestExecutionPermissions calls to the wallet API to the permissions kernel snap. This change adds support for this, while continuing to maintain support for calling the snap directly.

The experimental EIP-7715 functionality in the Delegation Toolkit now calls wallet_requestExecutionPermissions on the wallet API directly. There is no longer support for calling the snap directly.

🔄 What Changed?

When configuring the erc7715ProviderActions, a caller may provide an Erc7715ProviderConfig that conforms to the following definition:

type Erc7715ProviderConfig = {
useWalletMethod: boolean;
snapIds:? {
kernelSnapId?: string;
providerSnapId?: string;
}
};

If useWalletMethod is true, any snap configuration is ignored, and the request is made directly to wallet_requestExecutionPermissions on the wallet's injected provider.

If useWalletMethod is false, the request is made to the kernel snap.

If no snap ids are specified, the default values npm:@metamask/permissions-kernel-snap and npm:@metamask/gator-permissions-snap are used.

Support for calling the snaps directly will likely be removed at some stage in the future.

When configuring the erc7715ProviderActions a caller no longer must provide snapId configuration:

~const client = createClient({
  transport: custom(window.ethereum)
}).extend(erc7715ProviderActions());~

This will route all requests to the experimental EIP-7715 methods to the wallet_requestExecutionPermissions on the injected ethereum API.

🧪 How to Test?

Install in the Snap-7715 site, and configure the Eip7715 client with { useWalletMethod: true } no configuration. Ensure that Flask is installed with MetaMask/metamask-extension#35193 installed. The site should function as normal.

⚠️ Breaking Changes

List any breaking changes:

  • No breaking changes
  • Breaking changes (describe below):

Changes the configuration parameters of Erc7715 actions constructor, to nest the snapIds into a child property.
No configuration parameters are required when configuring the Erc7715 actions.

📋 Checklist

Check off completed items:

  • Code follows the project's coding standards
  • Self-review completed
  • Documentation updated (if needed)
  • Tests added/updated
  • Changelog updated (if needed)
  • All CI checks pass

🔗 Related Issues

Link to related issues:
Closes #
Related to #

📚 Additional Notes

Any additional information, concerns, or context:

@jeffsmale90 jeffsmale90 force-pushed the feat/callWalletApiDirectly branch from 66cc787 to ee005ce Compare August 15, 2025 03:51
@jeffsmale90 jeffsmale90 force-pushed the feat/callWalletApiDirectly branch from ee005ce to a197a06 Compare August 18, 2025 23:41
@jeffsmale90 jeffsmale90 marked this pull request as ready for review August 19, 2025 07:29
@jeffsmale90 jeffsmale90 requested a review from a team as a code owner August 19, 2025 07:29
jeffsmale90 added a commit to MetaMask/eth-json-rpc-middleware that referenced this pull request Sep 3, 2025
Adds methods `wallet_requestExecutionPermissions` and
`wallet_revokeExecutionPermission`, as defined in this revision of the
EIP-7715 specification ethereum/ERCs#1098.

This supports Readable Permissions project, and is related to the
following PRs:
- MetaMask/delegation-toolkit#60
- MetaMask/metamask-extension#35193

Note: workflows are failing due to existing problems, fixed by
#397
github-merge-queue bot pushed a commit to MetaMask/metamask-extension that referenced this pull request Sep 9, 2025
Adds the method `wallet_requestExecutionPermissions` which is defined in
this proposed revision of the EIP-7715 specification
ethereum/ERCs#1098.

## **Description**

This method is proxied to `@metamask/permissions-kernel-snap`, which
implements the exact same method. This snap will be preinstalled in
Extension, before the feature is enabled for any users.

The feature is gated by
`process.env.EIP_7715_READABLE_PERMISSIONS_ENABLED` and requires
`process.env.PERMISSIONS_KERNEL_SNAP_ID` to be set. Presently
`EIP_7715_READABLE_PERMISSIONS_ENABLED` is set to false, and
`PERMISSIONS_KERNEL_SNAP_ID` is set to an empty string for all builds.

Requires MetaMask/eth-json-rpc-middleware#396
released in
https://github.com/MetaMask/eth-json-rpc-middleware/releases/tag/v17.1.0.
This change also adds support for `wallet_revokePermission`, which will
be implemented in a future PR, once the revocation UI is implemented.


[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/35193?quickstart=1)

## **Changelog**

CHANGELOG entry: As this is behind a local feature gate, there are no
public facing changes.

## **Manual testing steps**

Can be tested with
MetaMask/delegation-toolkit#60 which adds
support to the delegation-toolkit's experimental api to call the wallet
method directly, rather than via `wallet_invokeSnap`.

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **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.
@jeffsmale90 jeffsmale90 marked this pull request as draft September 10, 2025 05:35
@jeffsmale90 jeffsmale90 force-pushed the feat/callWalletApiDirectly branch from 32e8f21 to 66e2a31 Compare September 10, 2025 21:55
@jeffsmale90 jeffsmale90 marked this pull request as ready for review September 10, 2025 22:02
@jeffsmale90 jeffsmale90 force-pushed the feat/callWalletApiDirectly branch from 66e2a31 to a779abd Compare September 10, 2025 22:30
@jeffsmale90 jeffsmale90 force-pushed the feat/callWalletApiDirectly branch from a779abd to 53aa57e Compare September 10, 2025 22:48
@jeffsmale90 jeffsmale90 merged commit 38064ec into main Sep 11, 2025
34 of 41 checks passed
@jeffsmale90 jeffsmale90 deleted the feat/callWalletApiDirectly branch September 11, 2025 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants