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.
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 ofwallet_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.