feat: Auto grant EVM permissions to preinstalled Snaps#3410
feat: Auto grant EVM permissions to preinstalled Snaps#3410FrederikBolding merged 8 commits intomainfrom
Conversation
b0c1713 to
b7bf665
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3410 +/- ##
=======================================
Coverage 98.23% 98.24%
=======================================
Files 406 408 +2
Lines 11456 11513 +57
Branches 1778 1791 +13
=======================================
+ Hits 11254 11311 +57
Misses 202 202 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
b7bf665 to
52984e6
Compare
|
is this a permanent thing? This may be a bad suggestion, but could we do the following:
I imagine there are unwanted side effects of doing the above though |
| 'endowment:caip25': { | ||
| caveats: [ | ||
| { | ||
| type: 'authorizedScopes', |
There was a problem hiding this comment.
[nit] we could add @metamask/chain-agnostic-permission package as devDependency and use Caip25CaveatType and Caip25EndowmentPermissionName consts here
There was a problem hiding this comment.
I intentionally skipped out on adding it as a dependency to keep our dependency tree small. Otherwise it often makes releasing painful. I think in this case it doesn't matter too much for just these two strings.
52984e6 to
2f7ca4e
Compare
I would strongly prefer not modifying the origin of the requests. But yeah, I would see this as a permanent thing, we want preinstalled Snaps to be able to use our APIs without having to connect. |
I also prefer what @FrederikBolding has here to your suggestion Jiexi. I think modifying the origin of the request is a very dangerous pattern to introduce at all. |
Co-authored-by: Alex Donesky <adonesky@gmail.com>
ce9ca02 to
fd9189f
Compare
Co-authored-by: Maarten Zuidhoorn <maarten@zuidhoorn.com>
For preinstalled Snaps that use
endowment:ethereum-provider, we want to automatically grant permissions to EVM accounts so that the Snap can propose signatures without connecting first. This PR adds a middleware that automatically grants the required permissions when all accounts are not permitted. Otherwise it is a no-op.