Research Project: Need to intercept and change values of RPC requests


I’m working on a research project where we need a wallet extension capable of intercepting RPC request and modifying the data fields before sending the request on to be handled.

I see in the code that there’s middleware that can intercept the requests (createOriginMiddleware), but only once the response is available (too late for what we’re trying to do). Is there a way to use the middleware to intercept the requests, change the data fields, then send it on to get a response?