*Refactor addHandler
This commit is contained in:
parent
b39af76606
commit
3873bd47a2
10
src/index.ts
10
src/index.ts
|
@ -43,10 +43,12 @@ addHandler("ready", handleReady);
|
|||
"eth_getLogs",
|
||||
"net_version",
|
||||
].forEach((rpcMethod) => {
|
||||
addHandler(rpcMethod, (aq: ActiveQuery) => {
|
||||
aq.callerInput = aq.callerInput || {};
|
||||
aq.callerInput.method = rpcMethod;
|
||||
handleRpcMethod(aq);
|
||||
addHandler(rpcMethod, async (aq: ActiveQuery) => {
|
||||
aq.callerInput = {
|
||||
params: aq.callerInput || {},
|
||||
method: rpcMethod,
|
||||
};
|
||||
aq.respond(await handleRpcMethod(aq));
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue