Create difficulty chart component

This commit is contained in:
nymkappa
2022-02-16 21:20:28 +09:00
parent 977622a589
commit 09f8490601
11 changed files with 192 additions and 16 deletions

View File

@@ -575,6 +575,18 @@ class Routes {
}
}
public async $getHistoricalDifficulty(req: Request, res: Response) {
try {
const stats = await BlocksRepository.$getBlocksDifficulty(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);