1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-23 03:36:18 +02:00
metamask-extension/app/scripts/lib/rpc-method-middleware/handlers
Erik Marks 05fae3fa1e
Add RPC method handler hook selection (#12664)
Adds a property, `hookNames`, to each RPC method handler export in `app/scripts/lib/rpc-method-middleware` and a function, `selectHooks`, to select from them.

`createMethodMiddleware` receives a giant `opts` object that includes a bunch of different methods from `MetaMaskController` and its subcontrollers. Each method implementation only requires a subset of these methods to do its work. Because they need some kind of name, we call these methods "hooks". With this change, whenever an RPC method is called, `selectHooks` will be called to ensure that each method only receives the hooks that it needs in order to do its job.

This implementation is based on [work in `snaps-skunkworks`](https://github.com/MetaMask/snaps-skunkworks/blob/a3e1248/packages/rpc-methods/src/utils.ts#L17-L34) that will be merged in the near future.
2021-11-15 15:11:51 -08:00
..
add-ethereum-chain.js Add RPC method handler hook selection (#12664) 2021-11-15 15:11:51 -08:00
get-provider-state.js Add RPC method handler hook selection (#12664) 2021-11-15 15:11:51 -08:00
index.js rough in switchEthereumChain (#10905) 2021-05-10 14:14:21 -05:00
log-web3-shim-usage.js Add RPC method handler hook selection (#12664) 2021-11-15 15:11:51 -08:00
switch-ethereum-chain.js Add RPC method handler hook selection (#12664) 2021-11-15 15:11:51 -08:00
watch-asset.js Add RPC method handler hook selection (#12664) 2021-11-15 15:11:51 -08:00