feat: add RPC methods described in (revised) EIP-7715#396
Conversation
6eb865b to
4f8bc87
Compare
…ission to support EIP-7715
4f8bc87 to
f339980
Compare
…to 5792 and 7715 async middleware to match correct naming.
There was a problem hiding this comment.
functionally LGTM. I have some concerns regarding spec about if isAdjustmentAllowed should even be included as it ultimately is a proxy for something optional and if something is not strictly required for execution then IMO it should not be included in the request by the dapp
Please ping for re-approval if you feel that my nit above is fair
| res.result = await processRequestExecutionPermissions(params, req); | ||
| } |
There was a problem hiding this comment.
I believe you'll need to pass end in as a param as well for the JSON RPC Engine to handle this gracefully
| res.result = await processRequestExecutionPermissions(params, req); | |
| } | |
| res.result = await processRequestExecutionPermissions(params, req); | |
| return end() | |
| } |
There was a problem hiding this comment.
I guess they aren't doing this in the 5792 methods you used as a model. Need to figure out why that's ok 🤔
There was a problem hiding this comment.
From @metamask/json-rpc-engine - createAsyncMiddleware:
* Async middleware have no "end" function. Instead, they "end" if they return
* without calling "next". Rather than passing in explicit return handlers,
* async middleware can simply await "next", and perform operations on the
* response object when execution resumes.
The async middleware function accepts a next parameter, but no end parameter. 😅
… is configured for EIP-7715 methods.
8085971 to
52b0346
Compare
src/index.ts
Outdated
| RevokeExecutionPermissionsRequestParams, | ||
| RevokeExecutionPermissionsResult, |
There was a problem hiding this comment.
Should these two type names be singular to stay consistent with the singular form of wallet_revokeExecutionPermission?
There was a problem hiding this comment.
You are absolutely correct!
This is the release for version 17.1.0. ``` a10c7fb feat: add RPC methods described in (revised) EIP-7715 (#396) 45ed998 Run compatibility test only in main branch. (#397) ``` --------- Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: Jeff Smale <6363749+jeffsmale90@users.noreply.github.com> Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
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. [](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/smart-accounts-kit#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.
Adds methods
wallet_requestExecutionPermissionsandwallet_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:
wallet_requestExecutionPermissionsmethod metamask-extension#35193Note: workflows are failing due to existing problems, fixed by #397