MetaMask / snaps

Extend the functionality of MetaMask using Snaps
https://metamask.io/snaps/
Other
711 stars 546 forks source link

feat!: Extract wallet_invokeSnap implementation into own middleware #2398

Closed rekmarks closed 1 month ago

rekmarks commented 1 month ago

We are moving our permission middleware ahead of all RPC method implementations in the extension (https://github.com/MetaMask/metamask-extension/pull/24472) and mobile (https://github.com/MetaMask/metamask-mobile/pull/9521). This breaks the current implementation of wallet_invokeSnap, which assumes that it's called before the permission middleware (which calls the implementation of wallet_snap, which is a restricted method).

This PR splits wallet_invokeSnap into its own middleware function. Since the method only transforms requests, and is not actually a method implementation, it can be placed ahead of the permission middleware. Also removes some apparently unused exports.

rekmarks commented 1 month ago

We're not going to take this route.