Skip to content

Commit

Permalink
Refactors main to make it more readable
Browse files Browse the repository at this point in the history
Signed-off-by: Konstantina Blazhukova <[email protected]>
  • Loading branch information
konstantinabl committed Sep 5, 2023
1 parent bf45c20 commit 03e7f40
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions scripts/check-ethereum-api-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ async function getFolderContent(path) {
return await getFileContent(dataEntry.path);
}));

return fileContents;
return {method: path.split('/')[1], content: fileContents};
}

function splitReqAndRes(content) {
Expand Down Expand Up @@ -284,10 +284,8 @@ async function main() {
const relaySupportedMethodNames = openRpcData.methods.map(method => method.name);
const ethSupportedMethods = await getEthereumExecApis(relaySupportedMethodNames);
const folders = ethSupportedMethods.map(each => each.path);
let fileContents = [];
for (const folder of folders) {
fileContents.push({method: folder.split('/')[1], content: await getFolderContent(folder)});
}

const fileContents = await Promise.all(folders.map(getFolderContent));

for (const file of fileContents) {
console.log("Executing for method ", file.method);
Expand Down

0 comments on commit 03e7f40

Please sign in to comment.