Bisq module separation.

Transaction view.
Block view.
Blocks list.
This commit is contained in:
softsimon
2020-07-13 15:16:12 +07:00
parent 60e1b9a41e
commit db2e293ce5
25 changed files with 438 additions and 187 deletions

View File

@@ -105,7 +105,7 @@ class Routes {
}
public getBisqBlock(req: Request, res: Response) {
const result = bisq.getBlock(req['hash']);
const result = bisq.getBlock(req.params.hash);
if (result) {
res.send(result);
} else {
@@ -113,16 +113,10 @@ class Routes {
}
}
public getBisqBlockTransactions(req: Request, res: Response) {
const blockHash = req.params.hash || '';
public getBisqBlocks(req: Request, res: Response) {
const index = parseInt(req.params.index, 10) || 0;
const length = parseInt(req.params.length, 10) > 100 ? 100 : parseInt(req.params.length, 10) || 25;
const [transactions, count] = bisq.getBlockTransactions(blockHash, index, length);
if (count === -1) {
res.header('X-Total-Count', '0');
res.send([]);
return;
}
const [transactions, count] = bisq.getBlocks(index, length);
res.header('X-Total-Count', count.toString());
res.send(transactions);
}