Projected blocks API.

This commit is contained in:
Simon Lindh 2019-07-26 17:51:12 +03:00
parent 76f8af9048
commit 32623988ab
2 changed files with 14 additions and 0 deletions

View File

@ -251,6 +251,7 @@ class MempoolSpace {
.get(config.API_ENDPOINT + 'transactions/height/:id', routes.$getgetTransactionsForBlock)
.get(config.API_ENDPOINT + 'transactions/projected/:id', routes.getgetTransactionsForProjectedBlock)
.get(config.API_ENDPOINT + 'fees/recommended', routes.getRecommendedFees)
.get(config.API_ENDPOINT + 'fees/projected-blocks', routes.getProjectedBlocks)
.get(config.API_ENDPOINT + 'statistics/2h', routes.get2HStatistics)
.get(config.API_ENDPOINT + 'statistics/24h', routes.get24HStatistics)
.get(config.API_ENDPOINT + 'statistics/1w', routes.get1WHStatistics)

View File

@ -53,6 +53,19 @@ class Routes {
res.status(500).send(e.message);
}
}
public async getProjectedBlocks(req, res) {
try {
let txId: string | undefined;
if (req.params.txId && /^[a-fA-F0-9]{64}$/.test(req.param.txId)) {
txId = req.params.txId;
}
const result = await projectedBlocks.getProjectedBlocks(txId, 6);
res.send(result);
} catch (e) {
res.status(500).send(e.message);
}
}
}
export default new Routes();