*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",
|
"eth_getLogs",
|
||||||
"net_version",
|
"net_version",
|
||||||
].forEach((rpcMethod) => {
|
].forEach((rpcMethod) => {
|
||||||
addHandler(rpcMethod, (aq: ActiveQuery) => {
|
addHandler(rpcMethod, async (aq: ActiveQuery) => {
|
||||||
aq.callerInput = aq.callerInput || {};
|
aq.callerInput = {
|
||||||
aq.callerInput.method = rpcMethod;
|
params: aq.callerInput || {},
|
||||||
handleRpcMethod(aq);
|
method: rpcMethod,
|
||||||
|
};
|
||||||
|
aq.respond(await handleRpcMethod(aq));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue