Skip to content

Commit

Permalink
fix: add very minimal parser
Browse files Browse the repository at this point in the history
  • Loading branch information
sakulstra committed Nov 8, 2024
1 parent 1eff8a5 commit cf606f2
Show file tree
Hide file tree
Showing 2 changed files with 1,615 additions and 0 deletions.
39 changes: 39 additions & 0 deletions gas-parser.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import gas from './cache/gas.json';

let table = `<table>`;
gas.map((item) => {
let row = `
<tr>
<th colspan="4">Contract</th>
<th>gas</th>
<th>size</th>
</tr>
<tr>
<td colspan="4"><b>${item.contract}</b></td>
<td>${item.deployment.gas}</td>
<td>${item.deployment.size}</td>
</tr>
<tr>
<th>Method</th>
<th>min</th>
<th>mean</th>
<th>median</th>
<th>max</th>
<th>calls</th>
</tr>`;
Object.entries(item.functions).map(([method, values]) => {
row += `
<tr>
<td>${method}</td>
<td>${values.min}</td>
<td>${values.mean}</td>
<td>${values.median}</td>
<td>${values.max}</td>
<td>${values.calls}</td>
</tr>`;
});
table += row;
});
table += `</table>`;

console.log(table);
Loading

0 comments on commit cf606f2

Please sign in to comment.