add zano_price route

This commit is contained in:
jejolare 2024-03-13 00:18:17 +07:00
parent 44a7f87c6a
commit e3338b3243

View file

@ -1410,6 +1410,23 @@ app.get(
})
);
let priceDate = {};
app.get('/api/zano_price', exceptionHandler(async (req, res) => {
if (priceDate?.zano?.usd !== undefined) {
res.json({
success: true,
data: priceDate
});
} else {
res.json({
success: false,
data: {}
});
}
}));
(async () => {
while (true) {
const response = await axios({
@ -1417,6 +1434,10 @@ app.get(
url: 'https://api.zano.org/assets_whitelist_testnet.json'
});
const zanoInfo = await fetch("https://api.coingecko.com/api/v3/simple/price?ids=zano&vs_currencies=usd").then(res => res.json());
if (zanoInfo?.zano?.usd !== undefined) {
priceDate = zanoInfo;
}
const assets = [
...response.data.assets,
{