Skip to content

Conversation

@MoMannn
Copy link
Contributor

@MoMannn MoMannn commented Jan 12, 2026

Explanation

What is the current state of things and why does it need to change?

The @metamask/eth-json-rpc-middleware package currently supports two EIP-7715 methods:

  • wallet_requestExecutionPermissions — for requesting new execution permissions
  • wallet_revokeExecutionPermission — for revoking existing execution permissions

However, the EIP-7715 specification also defines two additional "discoverability" methods that allow dApps to query the wallet about its execution permission capabilities. Without these methods, dApps have no way to:

  1. Discover which permission types the wallet supports and on which chains
  2. Retrieve the list of currently granted (non-revoked) permissions for the user

What is the solution your changes offer and how does it work?

This PR adds support for the two missing EIP-7715 discoverability methods:

  • wallet_getSupportedExecutionPermissions — Returns an object keyed by permission type (e.g., native-token-allowance, erc20-token-allowance) with their supported chain IDs and rule types. This allows dApps to understand what the wallet can handle before making permission requests.

  • wallet_getGrantedExecutionPermissions — Returns an array of all currently active (non-revoked) execution permissions. Each permission includes chain ID, addresses, permission details, context, dependencies, and delegation manager information.

The implementation follows the established patterns in this package:

  • Each method has a dedicated handler file with a factory function (createWallet*Handler)
  • Hook-based architecture allows consumers to provide their own processing logic
  • Superstruct schemas are defined for result types, enabling runtime validation
  • Types and structs are exported from the package index for consumer use

Are there any changes whose purpose might not obvious to those unfamiliar with the domain?

The handlers don't perform parameter validation since these methods don't accept parameters (they're pure query methods). This is intentional and differs from wallet_requestExecutionPermissions and wallet_revokeExecutionPermission which validate their params using Superstruct schemas.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Implements EIP-7715 discoverability methods and integrates them into the wallet middleware.

  • New handlers: createWalletGetSupportedExecutionPermissionsHandler and createWalletGetGrantedExecutionPermissionsHandler using hook-based processing and NoParamsStruct validation
  • Exports new types and structs from index.ts (SupportedExecutionPermissionConfig*, GrantedExecutionPermission*, results)
  • Adds EmptyArrayStruct/NoParamsStruct in utils/structs for "no params" validation
  • Wires methods into createWalletMiddleware via optional processGet* hooks
  • Unit tests for both methods: hook invocation, result passthrough, missing-hook error, and params validation
  • Changelog updated to note new RPC support

Written by Cursor Bugbot for commit 8e94f86. This will update automatically on new commits. Configure here.

@MoMannn MoMannn requested a review from mj-kiwi January 13, 2026 09:42
mj-kiwi
mj-kiwi previously approved these changes Jan 13, 2026
Copy link

@mj-kiwi mj-kiwi left a comment

Choose a reason for hiding this comment

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

Let's go

@github-project-automation github-project-automation bot moved this to Needs dev review in PR review queue Jan 13, 2026
@MoMannn MoMannn moved this from Needs dev review to Has approvals, needs CODEOWNER in PR review queue Jan 13, 2026
Copy link
Member

@V00D00-child V00D00-child left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Has approvals, needs CODEOWNER

Development

Successfully merging this pull request may close these issues.

4 participants