-
-
Notifications
You must be signed in to change notification settings - Fork 267
feat: align with 7715 specification #7603
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
Conversation
…pport-7715-discoverability-methods
packages/eth-json-rpc-middleware/src/methods/wallet-get-granted-execution-permissions.ts
Show resolved
Hide resolved
packages/eth-json-rpc-middleware/src/methods/wallet-get-granted-execution-permissions.ts
Outdated
Show resolved
Hide resolved
mj-kiwi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's go
V00D00-child
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
mcmire
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
|
|
||
| const { params } = request; | ||
|
|
||
| validateParams(params, GetGrantedExecutionPermissionsParamsStruct); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can probably just forgo validation in this case?
|
|
||
| ### Added | ||
|
|
||
| - Support for `wallet_getSupportedExecutionPermissions` and `wallet_getGrantedExecutionPermissions` RPC methods ([#7603](https://github.com/MetaMask/core/pull/7603)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PermissionDependency is also exported now
|
|
||
| const REQUEST_MOCK = { | ||
| params: [], | ||
| } as unknown as JsonRpcRequest; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit. if we add, id, jsonrpc, and method, we can drop the typecast here and the several below. Seems like the trouble might be worth it
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)EIP-7715 spec alignment for
wallet_requestExecutionPermissionsThe request/response schema has been updated to align with the latest EIP-7715 specification:
address+signer: { type, data: { address } }structure with flatfrom(optional) andto(required) fieldsisAdjustmentAllowedfrom rules: This property is only relevant at the permission level, not individual rulesdependencies(array of{ factory, factoryData }) anddelegationManagerto the responsePermissionDependencytype export for consumersGrantedExecutionPermissionStructto useHexChecksumAddressStructfor address fieldsAre 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
Implements EIP-7715 discoverability methods and integrates them into the wallet middleware.
createWalletGetSupportedExecutionPermissionsHandlerandcreateWalletGetGrantedExecutionPermissionsHandlerusing hook-based processing andNoParamsStructvalidationindex.ts(SupportedExecutionPermissionConfig*,GrantedExecutionPermission*, results)EmptyArrayStruct/NoParamsStructinutils/structsfor "no params" validationcreateWalletMiddlewarevia optionalprocessGet*hooksWritten by Cursor Bugbot for commit 8e94f86. This will update automatically on new commits. Configure here.