Merge branch 'master' into log-priority

i first forgot to fetch upstream in github, conflicts are fixed
This commit is contained in:
Antoni Spaanderman
2022-02-07 09:15:42 +01:00
35 changed files with 723 additions and 303 deletions

View File

@@ -319,7 +319,9 @@ class Server {
if (Common.isLiquid()) {
this.app
.get(config.MEMPOOL.API_URL_PREFIX + 'assets/icons', routes.getAllLiquidIcon)
.get(config.MEMPOOL.API_URL_PREFIX + 'assets/featured', routes.$getAllFeaturedLiquidAssets)
.get(config.MEMPOOL.API_URL_PREFIX + 'asset/:assetId/icon', routes.getLiquidIcon)
.get(config.MEMPOOL.API_URL_PREFIX + 'assets/group/:id', routes.$getAssetGroup)
;
}

View File

@@ -21,6 +21,7 @@ import bitcoinClient from './api/bitcoin/bitcoin-client';
import elementsParser from './api/liquid/elements-parser';
import icons from './api/liquid/icons';
import miningStats from './api/mining';
import axios from 'axios';
class Routes {
constructor() {}
@@ -855,6 +856,25 @@ class Routes {
res.status(404).send('Asset icons not found');
}
}
public async $getAllFeaturedLiquidAssets(req: Request, res: Response) {
try {
const response = await axios.get('https://liquid.network/api/v1/assets/featured', { responseType: 'stream', timeout: 10000 });
response.data.pipe(res);
} catch (e) {
res.status(500).end();
}
}
public async $getAssetGroup(req: Request, res: Response) {
try {
const response = await axios.get('https://liquid.network/api/v1/assets/group/' + parseInt(req.params.id, 10),
{ responseType: 'stream', timeout: 10000 });
response.data.pipe(res);
} catch (e) {
res.status(500).end();
}
}
}
export default new Routes();