Added hashrate chart

This commit is contained in:
nymkappa
2022-02-19 22:09:35 +09:00
parent 5a6f9269b1
commit cc2890fd60
8 changed files with 284 additions and 12 deletions

View File

@@ -586,6 +586,18 @@ class Routes {
}
}
public async $getHistoricalHashrate(req: Request, res: Response) {
try {
const stats = await mining.$getHistoricalHashrates(req.params.interval ?? null);
res.header('Pragma', 'public');
res.header('Cache-control', 'public');
res.setHeader('Expires', new Date(Date.now() + 1000 * 300).toUTCString());
res.json(stats);
} catch (e) {
res.status(500).send(e instanceof Error ? e.message : e);
}
}
public async getBlock(req: Request, res: Response) {
try {
const result = await bitcoinApi.$getBlock(req.params.hash);