add zano_price route
This commit is contained in:
parent
44a7f87c6a
commit
e3338b3243
1 changed files with 21 additions and 0 deletions
|
|
@ -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,
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue