test: improve RPC call debugging

This commit is contained in:
Franck Royer 2022-05-27 20:52:23 +10:00 committed by fryorcraken.eth
parent d65e99275b
commit 4a96472084
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
1 changed files with 2 additions and 1 deletions

View File

@ -356,6 +356,7 @@ export class Nwaku {
method: string,
params: Array<string | number | unknown>
): Promise<T> {
dbg("RPC Query: ", method, params);
const res = await fetch(this.rpcUrl, {
method: "POST",
body: JSON.stringify({
@ -366,8 +367,8 @@ export class Nwaku {
}),
headers: new Headers({ "Content-Type": "application/json" }),
});
dbg(`Response received for ${method} call: `, res, "params: ", params);
const json = await res.json();
dbg(`RPC Response: `, res, json);
return json.result;
}