Skip to content

Add ERC-7715 execution permission methods#311

Open
adonesky1 wants to merge 4 commits into
mainfrom
add-erc7715-execution-permission-methods
Open

Add ERC-7715 execution permission methods#311
adonesky1 wants to merge 4 commits into
mainfrom
add-erc7715-execution-permission-methods

Conversation

@adonesky1
Copy link
Copy Markdown
Contributor

@adonesky1 adonesky1 commented May 29, 2026

Summary

Adds OpenRPC definitions for three ERC-7715 execution permission methods and their supporting schemas:

  • wallet_requestExecutionPermissions
  • wallet_getGrantedExecutionPermissions
  • wallet_getSupportedExecutionPermissions

New components/schemas: ExecutionPermission, ExecutionPermissionRule, ExecutionPermissionRequest, ExecutionPermissionResponse.

Note

wallet_revokeExecutionPermission is intentionally not included. While @metamask/eth-json-rpc-middleware defines a handler for it, the wallet does not currently wire it up — createMetamaskMiddleware passes only the request/getGranted/getSupported hooks (no processRevokeExecutionPermission), and neither metamask-extension nor metamask-mobile provides that hook. Documenting it here would make it authorizable over the Multichain API while actual calls throw methodNotSupported ("no middleware configured"). It will be added once the client wiring lands.

Motivation

These methods are already implemented in the wallet (handled by the permissions kernel Snap) and work over the EIP-1193 provider (window.ethereum). However, they are absent from the OpenRPC document, which is the source of truth for KnownRpcMethods.eip155 in @metamask/chain-agnostic-permission:

const Eip155Methods = MetaMaskOpenRPCDocument.methods
  .map(({ name }) => name)
  .filter(...) // WalletEip155Methods / KnownWalletRpcMethods / Eip1193OnlyMethods

Because the methods are not in this list, the Multichain API's wallet_invokeMethod handler rejects them:

// @metamask/multichain-api-middleware wallet-invokeMethod
if (!scopeObject?.methods?.includes(wrappedRequest.method)) {
  return end(providerErrors.unauthorized());
}

So any dapp invoking ERC-7715 over the Multichain API (e.g. via MetaMask Connect, which routes all EVM requests through wallet_invokeMethod) fails with UnauthorizedProviderError: The requested account and/or method has not been authorized by the user, even though the same call succeeds over EIP-1193.

Adding these methods to the OpenRPC document makes them authorizable within an eip155 CAIP-25 session scope. No additional wiring is required on the wallet side: once authorized, the request already flows through the shared metamaskMiddleware to the execution-permission handler.

Schema notes

The request/response schemas mirror the wire contract in @metamask/7715-permission-types and the transform applied by @metamask/smart-accounts-kit:

  • ExecutionPermissionRequest wire fields are chainId, from (optional), to, permission, and rules. There is no top-level expiry/signer/address; time bounds are expressed as an expiry rule ({ type: 'expiry', data: { timestamp } }), which is how the kit serializes a developer-supplied expiry.
  • isAdjustmentAllowed (on ExecutionPermission) and to (on ExecutionPermissionRequest) are required.
  • ExecutionPermissionResponse requires context, dependencies, and delegationManager (needed to redeem the permission); each dependency entry requires both factory and factoryData.

Changes

  • openrpc.yaml: 3 methods + 4 schemas (tagged MetaMask / Experimental / Multichain).
  • CHANGELOG.md: [Unreleased] entry.

Test plan

  • yarn build regenerates dist/build/openrpc.json without errors.
  • All three methods appear in the built openrpc.json.
  • yarn test passes (parseOpenRPCDocument validates the document and dereferences all $refs, including the new schemas/tags/errors).
  • Verified the three methods are included in the derived KnownRpcMethods.eip155 set after the filters applied by @metamask/chain-agnostic-permission.

Downstream

After release, bump @metamask/api-specs in @metamask/chain-agnostic-permission (MetaMask/core), then bump @metamask/chain-agnostic-permission in metamask-extension and metamask-mobile.


Note

Low Risk
Spec-only changes in api-specs; they expand the documented authorization surface for delegation permissions but do not alter wallet runtime in this repo.

Overview
Documents ERC-7715 execution-permission JSON-RPC in openrpc.yaml so they can be treated as known eip155 methods (e.g. for Multichain wallet_invokeMethod authorization after downstream bumps).

Adds three methods tagged MetaMask / Experimental / Multichain: wallet_requestExecutionPermissions (batch grant with InvalidParams, user reject, unauthorized errors), wallet_getGrantedExecutionPermissions, and wallet_getSupportedExecutionPermissions (capability map keyed by permission type with chainIds and ruleTypes). Each includes wire-shaped examples (e.g. native-token-periodic with an expiry rule).

Introduces schemas ExecutionPermission, ExecutionPermissionRule, ExecutionPermissionRequest, and ExecutionPermissionResponse (request fields chainId, optional from, to, permission, rules; response adds context, delegationManager, and dependencies with factory / factoryData). wallet_revokeExecutionPermission is intentionally omitted until clients wire it.

CHANGELOG.md records the addition under [Unreleased].

Reviewed by Cursor Bugbot for commit 72cca9f. Bugbot is set up for automated code reviews on this repo. Configure here.

Add OpenRPC definitions for the ERC-7715 execution permission methods and
their supporting schemas:

- wallet_requestExecutionPermissions
- wallet_getGrantedExecutionPermissions
- wallet_getSupportedExecutionPermissions
- wallet_revokeExecutionPermission

These methods are already implemented in the wallet (via the permissions
kernel Snap) and reachable over the EIP-1193 provider, but they are absent
from the OpenRPC document. As a result they are not included in
`KnownRpcMethods.eip155` (which `@metamask/chain-agnostic-permission` derives
from this document), so they cannot be authorized in a CAIP-25 session and
fail with an "unauthorized" error when invoked via the Multichain API
(`wallet_invokeMethod`) — e.g. when used through MetaMask Connect. Adding them
here makes them authorizable over the Multichain API, matching the existing
EIP-1193 behaviour.
@adonesky1 adonesky1 requested review from a team as code owners May 29, 2026 15:33
Comment thread openrpc.yaml
The schema defined both `address` and `from` with identical descriptions.
ERC-7715 only specifies `from`, so drop `address` and clarify the `from`
description to match the spec.
Comment thread openrpc.yaml Outdated
- Remove wallet_revokeExecutionPermission (not wired in extension/mobile;
  handler throws methodNotSupported with no processRevokeExecutionPermission hook)
- Drop unsupported top-level request fields (signer, expiry); expiry is an
  expiry rule on the wire, not a top-level field
- Require isAdjustmentAllowed on ExecutionPermission and to on
  ExecutionPermissionRequest (both required by 7715-permission-types)
- Require context/dependencies/delegationManager on the response and
  factory/factoryData on dependency entries (needed to redeem permissions)
- Demonstrate the expiry rule in the request/response examples
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 1e8b942. Configure here.

Comment thread openrpc.yaml
chainIds:
- '0xaa36a7'
ruleTypes:
- expiry
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing wallet_revokeExecutionPermission method from OpenRPC spec

High Severity

The PR description explicitly lists four ERC-7715 methods to add, but wallet_revokeExecutionPermission is missing from both openrpc.yaml and CHANGELOG.md. Only three methods were actually added. Since the whole purpose of this PR is to make these methods authorizable via the Multichain API's wallet_invokeMethod, omitting the revoke method means dapps using MetaMask Connect will still get UnauthorizedProviderError when trying to revoke execution permissions.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 1e8b942. Configure here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

intentional — wallet_revokeExecutionPermission isn't wired in the wallet. createMetamaskMiddleware only passes the request/getGranted/getSupported hooks, and neither extension nor mobile provides processRevokeExecutionPermission, so the handler throws methodNotSupported. documenting it would make it authorizable over multichain while calls still fail. updated the PR description to drop it; will add when the client wiring lands.

Add `rules` to ExecutionPermissionRequest.required (the permissions-kernel
Snap requires it; pass `[]` for no constraints) and bump the example expiry
timestamps to a future date so copied examples don't request an already-expired
permission.
Comment thread openrpc.yaml
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