From 3873bd47a22acbdc018e0946bc0fa43fe2d4e29d Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Mon, 27 Mar 2023 15:22:51 -0400 Subject: [PATCH] *Refactor addHandler --- src/index.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/index.ts b/src/index.ts index 92324c6..8299f59 100644 --- a/src/index.ts +++ b/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)); }); });