-
-
Notifications
You must be signed in to change notification settings - Fork 95
feat: add RPC methods described in (revised) EIP-7715 #396
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
base: main
Are you sure you want to change the base?
Conversation
6eb865b
to
4f8bc87
Compare
…ission to support EIP-7715
4f8bc87
to
f339980
Compare
it('throws if no hook', async () => { | ||
await expect( | ||
walletRequestExecutionPermissions(request, response, {}), | ||
).rejects.toMatchInlineSnapshot( |
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: Curious, why are we using a snapshot in these tests rather than .toThrow(new Error(...))
?
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.
Yeah, that's a bit silly - I think it was due to the complex error messages. I've replaced it with the more succinct error reason.
…to 5792 and 7715 async middleware to match correct naming.
): Promise<void> { | ||
if (!processRequestExecutionPermissions) { | ||
throw rpcErrors.resourceNotFound( | ||
'wallet_requestExecutionPermissions - no middleware configured', |
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 are throwing methodNotSupported() in the 5792 methods. Thoughts on doing the same here?
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess they aren't doing this in the 5792 methods you used as a model. Need to figure out why that's ok 🤔
Adds methods
wallet_requestExecutionPermissions
andwallet_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_requestExecutionPermissions
method metamask-extension#35193Note: workflows are failing due to existing problems, fixed by #397