Compare commits

..

No commits in common. "b6b419ec06396a647099035e85010aad3071ef6b" and "a473dfdad52a9d592c7f873dd3c00ea484649fd1" have entirely different histories.

1 changed files with 10 additions and 16 deletions

View File

@ -24,8 +24,6 @@ addHandler("presentSeed", handlePresentSeed);
addHandler("ready", handleReady); addHandler("ready", handleReady);
[ [
"eth_accounts",
"eth_requestAccounts",
"eth_getBalance", "eth_getBalance",
"eth_chainId", "eth_chainId",
"eth_blockNumber", "eth_blockNumber",
@ -43,12 +41,10 @@ addHandler("ready", handleReady);
"eth_getLogs", "eth_getLogs",
"net_version", "net_version",
].forEach((rpcMethod) => { ].forEach((rpcMethod) => {
addHandler(rpcMethod, async (aq: ActiveQuery) => { addHandler(rpcMethod, (aq: ActiveQuery) => {
aq.callerInput = { aq.callerInput = aq.callerInput || {};
params: aq.callerInput || {}, aq.callerInput.method = rpcMethod;
method: rpcMethod, handleRpcMethod(aq);
};
aq.respond(await handleRpcMethod(aq));
}); });
}); });
@ -60,10 +56,6 @@ async function handlePresentSeed() {
async function handleRpcMethod(aq: ActiveQuery) { async function handleRpcMethod(aq: ActiveQuery) {
await moduleReady; await moduleReady;
switch (aq.callerInput?.method) { switch (aq.callerInput?.method) {
case "eth_accounts":
case "eth_requestAccounts": {
return [];
}
case "eth_getBalance": { case "eth_getBalance": {
return client.get_balance( return client.get_balance(
aq.callerInput?.params[0], aq.callerInput?.params[0],
@ -182,7 +174,9 @@ async function setup() {
const method = data.get("method"); const method = data.get("method");
let params = data.get("params"); let params = data.get("params");
params = JSON.parse(params); if (params === "null") {
params = null;
}
let query; let query;
let ret: RPCResponse; let ret: RPCResponse;
@ -212,7 +206,7 @@ async function setup() {
await client.sync(); await client.sync();
} }
async function handleReady(aq: ActiveQuery) { async function handleReady(aq:ActiveQuery){
await moduleReady; await moduleReady;
aq.respond(); aq.respond();