feat: support 7715 discoverability methods #7603
Open
+649
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Explanation
What is the current state of things and why does it need to change?
The
@metamask/eth-json-rpc-middlewarepackage currently supports two EIP-7715 methods:wallet_requestExecutionPermissions— for requesting new execution permissionswallet_revokeExecutionPermission— for revoking existing execution permissionsHowever, 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:
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:
createWallet*Handler)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_requestExecutionPermissionsandwallet_revokeExecutionPermissionwhich validate their params using Superstruct schemas.References
Checklist
Note
Adds EIP-7715 discoverability support enabling dApps to query supported and granted execution permissions.
wallet_getSupportedExecutionPermissionsandwallet_getGrantedExecutionPermissionswith hook-based processing (methods/*)createWalletMiddlewareto expose both RPC methodssrc/index.tsindex.test.tssnapshotCHANGELOG.mdwith new RPC methodsWritten by Cursor Bugbot for commit 1dc77d1. This will update automatically on new commits. Configure here.