From 54fdfad2ac6fd83e6adf471e1053bb65ef3ee097 Mon Sep 17 00:00:00 2001 From: Kostya Pogromskiy Date: Thu, 8 Apr 2021 15:02:07 +0300 Subject: [PATCH 01/29] Available supply = total supply --- index.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index beee3e4..249de0a 100644 --- a/index.js +++ b/index.js @@ -87,17 +87,14 @@ function round8(num) { async function queryTicker() { try { const startAt = Date.now(); - const [supplyBN, {btc, vlx}, balance1BN, balance2BN] = await Promise.all([ + const [supplyBN, {btc, vlx}] = await Promise.all([ getVlxSupplyBN(), getCryptoCoinsInfo(), - getVlxBalanceBN("0x889a488442f84f096e725d6c3119c72ea75f6b5f"), - getVlxBalanceBN("0x2632534445471de586514e5726568eee0110bd2b"), ]); - const foundationBN = balance1BN.plus(balance2BN); const btc_usd = round8(btc.quote.USD.price); console.log('btc_usd', btc.quote.USD.price, btc_usd); - const available_supply = supplyBN.minus(foundationBN).toString(); const total_supply = fixTotalSupply(supplyBN.toNumber()) + const available_supply = total_supply; const price_usd = round6(vlx.quote.USD.price); const volume = round(vlx.quote.USD.volume_24h); const price_btc = round8(vlx.quote.USD.price / btc.quote.USD.price); From a2aeee83dc439260ba0381b6d7b05f18fa4b1062 Mon Sep 17 00:00:00 2001 From: Kostya Pogromskiy Date: Sun, 25 Apr 2021 20:09:05 +0300 Subject: [PATCH 02/29] Use native vlx circulating supply --- index.js | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/index.js b/index.js index 249de0a..d79d687 100644 --- a/index.js +++ b/index.js @@ -41,10 +41,21 @@ function initParams() { } async function getVlxSupplyBN() { - const resSupply = await fetch(`${explorerUrl}?module=stats&action=ethsupply`); + const resSupply = await fetch(`${explorerUrl}/../rpc`, { + method: 'POST', + cache: 'no-cache', + headers: { + 'content-type': 'application/json', + accept: '*/*', + }, + body: '{"method":"getSupply","jsonrpc":"2.0","params":[{"commitment":"max"}],"id":"69e8210f-1227-4a0d-a96d-c89d990bd296"}' + }); const jsonSupply = await resSupply.json(); - const supply = jsonSupply.result; - return new BigNumber(supply).dividedBy(1e18); + const supply = jsonSupply.result.value.total; + if (debug) { + console.log('Got supply', supply); + } + return new BigNumber(supply/1e9 + ''); } async function getCryptoCoinsInfo() { @@ -61,15 +72,16 @@ async function getCryptoCoinsInfo() { return {btc, vlx}; } -async function getVlxBalanceBN(address) { - const res = await fetch(`${explorerUrl}?module=account&action=eth_get_balance&address=${address}`); - const json = await res.json(); - const balance = json.result; - return new BigNumber(balance).dividedBy(1e18); -} +// async function getVlxBalanceBN(address) { +// const res = await fetch(`${explorerUrl}?module=account&action=eth_get_balance&address=${address}`); +// const json = await res.json(); +// const balance = json.result; +// return new BigNumber(balance).dividedBy(1e18); +// } function fixTotalSupply(supply) { - return Math.round(Math.max(2080000000, supply)) + ""; + return supply + ""; + // return Math.round(Math.max(2080000000, supply)) + ""; } function round(num) { From 12906fdd9bb4eb3dc7f2379d7f1642dd41359a8e Mon Sep 17 00:00:00 2001 From: Kostya Pogromskiy Date: Sun, 25 Apr 2021 20:41:40 +0300 Subject: [PATCH 03/29] Show debug info on error --- index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/index.js b/index.js index d79d687..4285ea5 100644 --- a/index.js +++ b/index.js @@ -51,6 +51,9 @@ async function getVlxSupplyBN() { body: '{"method":"getSupply","jsonrpc":"2.0","params":[{"commitment":"max"}],"id":"69e8210f-1227-4a0d-a96d-c89d990bd296"}' }); const jsonSupply = await resSupply.json(); + if (!jsonSupply.result || !jsonSupply.result.value || !jsonSupply.result.value.total) { + console.log('Got invalid response when trying to getSupply', jsonSupply); + } const supply = jsonSupply.result.value.total; if (debug) { console.log('Got supply', supply); From 25162864a9fc4468ac8d3054642f6d23460fae50 Mon Sep 17 00:00:00 2001 From: Kostya Pogromskiy Date: Sun, 25 Apr 2021 20:51:31 +0300 Subject: [PATCH 04/29] Fix explorer url --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 4285ea5..e2759f1 100644 --- a/index.js +++ b/index.js @@ -41,7 +41,7 @@ function initParams() { } async function getVlxSupplyBN() { - const resSupply = await fetch(`${explorerUrl}/../rpc`, { + const resSupply = await fetch(`https://mainnet.velas.com/rpc`, { method: 'POST', cache: 'no-cache', headers: { From 041a39ef1b4b774c78775b5da3668e236e5cb1a1 Mon Sep 17 00:00:00 2001 From: Kostya Pogromskiy Date: Sun, 25 Apr 2021 21:11:35 +0300 Subject: [PATCH 05/29] Gracefull fallback on service error --- index.js | 65 +++++++++++++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 27 deletions(-) diff --git a/index.js b/index.js index e2759f1..e7abec7 100644 --- a/index.js +++ b/index.js @@ -41,38 +41,49 @@ function initParams() { } async function getVlxSupplyBN() { - const resSupply = await fetch(`https://mainnet.velas.com/rpc`, { - method: 'POST', - cache: 'no-cache', - headers: { - 'content-type': 'application/json', - accept: '*/*', - }, - body: '{"method":"getSupply","jsonrpc":"2.0","params":[{"commitment":"max"}],"id":"69e8210f-1227-4a0d-a96d-c89d990bd296"}' - }); - const jsonSupply = await resSupply.json(); - if (!jsonSupply.result || !jsonSupply.result.value || !jsonSupply.result.value.total) { - console.log('Got invalid response when trying to getSupply', jsonSupply); - } - const supply = jsonSupply.result.value.total; - if (debug) { - console.log('Got supply', supply); + try { + const resSupply = await fetch(`https://mainnet.velas.com/rpc`, { + method: 'POST', + cache: 'no-cache', + headers: { + 'content-type': 'application/json', + accept: '*/*', + }, + body: '{"method":"getSupply","jsonrpc":"2.0","params":[{"commitment":"max"}],"id":"69e8210f-1227-4a0d-a96d-c89d990bd296"}' + }); + const jsonSupply = await resSupply.json(); + if (!jsonSupply.result || !jsonSupply.result.value || !jsonSupply.result.value.total) { + console.log('Got invalid response when trying to getSupply', jsonSupply); + return new BigNumber(0); + } + const supply = jsonSupply.result.value.total; + if (debug) { + console.log('Got supply', supply); + } + return new BigNumber(supply/1e9 + ''); + } catch(e) { + console.error(e); + return new BigNumber(0); } - return new BigNumber(supply/1e9 + ''); } async function getCryptoCoinsInfo() { - const resCmcListing = await fetch(`https://web-api.coinmarketcap.com/v1/cryptocurrency/listings/latest?limit=${cmcLimit}&start=1`); - const jsonCmcListing = await resCmcListing.json(); - const btc = jsonCmcListing.data.find((coin) => coin.symbol === "BTC"); - const vlx = jsonCmcListing.data.find((coin) => coin.symbol === "VLX"); - if (!btc) { - throw new Error("Btc is not found at coinmarketcap listing"); - } - if (!vlx) { - throw new Error("Vlx is not found at coinmarketcap listing"); + try { + const resCmcListing = await fetch(`https://web-api.coinmarketcap.com/v1/cryptocurrency/listings/latest?limit=${cmcLimit}&start=1`); + const jsonCmcListing = await resCmcListing.json(); + const btc = jsonCmcListing.data.find((coin) => coin.symbol === "BTC"); + const vlx = jsonCmcListing.data.find((coin) => coin.symbol === "VLX"); + if (!btc) { + throw new Error("Btc is not found at coinmarketcap listing"); + } + if (!vlx) { + throw new Error("Vlx is not found at coinmarketcap listing"); + } + return {btc, vlx}; + }catch(e) { + console.error(e); + return {btc: {quote: {USD: {price: 0, volume_24h: 0}}}, vlx: {quote: {USD: {price: 0, volume_24h: 0}}}}; } - return {btc, vlx}; } // async function getVlxBalanceBN(address) { From c7b52f68e1716000ed6376271510d42a0974886e Mon Sep 17 00:00:00 2001 From: Kostya Pogromskiy Date: Fri, 14 May 2021 19:18:41 +0300 Subject: [PATCH 06/29] Add ltc, eth, gbx to ticker --- index.js | 73 ++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 55 insertions(+), 18 deletions(-) diff --git a/index.js b/index.js index e7abec7..abd7715 100644 --- a/index.js +++ b/index.js @@ -2,7 +2,7 @@ const express = require("express"); const fetch = require("node-fetch"); const BigNumber = require("bignumber.js"); const fs = require("fs"); - +const monitoringCurrencies = ['vlx', 'btc', 'ltc', 'eth', 'gbx' ]; const app = express(); let tickerRefreshPromise = null; let cachedTicker = null; @@ -31,7 +31,7 @@ function initParams() { cmcLimit = process.env.CMC_LIMIT; console.log("Using coinmarketcap limit taken from environment variable CMC_LIMIT", cmcLimit); } else { - cmcLimit = 300; + cmcLimit = 3000; console.log("Using coinmarketcap limit. You can set environment variable CMC_LIMIT to change it", cmcLimit); } @@ -71,15 +71,22 @@ async function getCryptoCoinsInfo() { try { const resCmcListing = await fetch(`https://web-api.coinmarketcap.com/v1/cryptocurrency/listings/latest?limit=${cmcLimit}&start=1`); const jsonCmcListing = await resCmcListing.json(); - const btc = jsonCmcListing.data.find((coin) => coin.symbol === "BTC"); - const vlx = jsonCmcListing.data.find((coin) => coin.symbol === "VLX"); - if (!btc) { - throw new Error("Btc is not found at coinmarketcap listing"); - } - if (!vlx) { - throw new Error("Vlx is not found at coinmarketcap listing"); + const result = Object.create(null); + for (let currency of monitoringCurrencies) { + const currencyUpper = currency.toUpperCase(); + result[currency] = jsonCmcListing.data.find((coin) => coin.symbol === currencyUpper); + if (!result[currency]) { + result[currency] = { + quote: { + USD: { + price: 0, + volume_24h: 0 + } + } + }; + } } - return {btc, vlx}; + return result; }catch(e) { console.error(e); return {btc: {quote: {USD: {price: 0, volume_24h: 0}}}, vlx: {quote: {USD: {price: 0, volume_24h: 0}}}}; @@ -94,40 +101,70 @@ async function getCryptoCoinsInfo() { // } function fixTotalSupply(supply) { + if (!supply) { + return ''; + } return supply + ""; // return Math.round(Math.max(2080000000, supply)) + ""; } function round(num) { + if (!num) { + return ''; + } return Math.round((num + Number.EPSILON)) + ""; } function round6(num) { + if (!num) { + return ''; + } return Math.round((num + Number.EPSILON) * 1e6) / 1e6 + ""; } function round8(num) { + if (!num) { + return ''; + } return (Math.round((num + Number.EPSILON) * 1e8) / 1e8).toFixed(8); } async function queryTicker() { try { const startAt = Date.now(); - const [supplyBN, {btc, vlx}] = await Promise.all([ + const [supplyBN, prices] = await Promise.all([ getVlxSupplyBN(), getCryptoCoinsInfo(), ]); - const btc_usd = round8(btc.quote.USD.price); - console.log('btc_usd', btc.quote.USD.price, btc_usd); const total_supply = fixTotalSupply(supplyBN.toNumber()) const available_supply = total_supply; - const price_usd = round6(vlx.quote.USD.price); - const volume = round(vlx.quote.USD.volume_24h); - const price_btc = round8(vlx.quote.USD.price / btc.quote.USD.price); - const volume_btc = round8(vlx.quote.USD.volume_24h / btc.quote.USD.price); + const volume = round(prices.vlx.quote.USD.volume_24h); + const price_btc = round8(prices.vlx.quote.USD.price / prices.btc.quote.USD.price); + const volume_btc = round8(prices.vlx.quote.USD.volume_24h / prices.btc.quote.USD.price); - cachedTicker = {total_supply, price_usd, volume, price_btc, volume_btc, available_supply}; + const price_usd = round6(prices.vlx.quote.USD.price); + const btc_usd = round8(prices.btc.quote.USD.price); + if (!cachedTicker) { + cachedTicker = {}; + } + cachedTicker.total_supply = total_supply || cachedTicker.total_supply || "0"; + cachedTicker.price_usd = price_usd || cachedTicker.price_usd || "0"; + cachedTicker.volume = volume || cachedTicker.volume || "0"; + cachedTicker.price_btc = price_btc || cachedTicker.price_btc || "0"; + cachedTicker.volume_btc = volume_btc || cachedTicker.volume_btc || "0"; + cachedTicker.available_supply = available_supply || cachedTicker.available_supply || "0"; + + for (const currency in prices) { + if (currency === 'btc' || currency === 'vlx') { + continue; + } + try { + cachedTicker[`price_${currency}`] = round8(prices[currency].quote.USD.price); + }catch(e) { + console.error(`Parsing ${currency} error`, e); + } + } if (debug) { console.log("Got ticker", Date.now() - startAt, new Date()); } From 81c62490a14a7c98d5fa270891c195a0eb91834b Mon Sep 17 00:00:00 2001 From: Kostya Pogromskiy Date: Fri, 14 May 2021 20:05:40 +0300 Subject: [PATCH 07/29] Change ticker format --- index.js | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/index.js b/index.js index abd7715..d4782e7 100644 --- a/index.js +++ b/index.js @@ -2,7 +2,7 @@ const express = require("express"); const fetch = require("node-fetch"); const BigNumber = require("bignumber.js"); const fs = require("fs"); -const monitoringCurrencies = ['vlx', 'btc', 'ltc', 'eth', 'gbx' ]; +const monitoringCurrencies = ['vlx', 'btc', 'ltc', 'eth', 'gbx', 'usdt' ]; const app = express(); let tickerRefreshPromise = null; let cachedTicker = null; @@ -156,11 +156,11 @@ async function queryTicker() { cachedTicker.available_supply = available_supply || cachedTicker.available_supply || "0"; for (const currency in prices) { - if (currency === 'btc' || currency === 'vlx') { + if (currency === 'vlx') { continue; } try { - cachedTicker[`price_${currency}`] = round8(prices[currency].quote.USD.price); + cachedTicker[`${currency}_price`] = round8(prices[currency].quote.USD.price); }catch(e) { console.error(`Parsing ${currency} error`, e); } @@ -174,20 +174,28 @@ async function queryTicker() { return cachedTicker; } -function queryTickerCached() { - if (!tickerRefreshPromise) { - tickerRefreshPromise = ( - queryTicker().then((ticker) => { - setTimeout(() => { tickerRefreshPromise = null; }, 5000); - return ticker; - }) - ); +async function queryTickerCached() { + if (!cachedTicker) { + return await queryTicker(); } - return tickerRefreshPromise; + return cachedTicker; } +async function refreshTickerRecursively() { + try { + const startAt = Date.now(); + await queryTicker(); + if (debug) { + console.log('Ticker queried recurcively in ms ', Date.now() - startAt); + } + }catch(e) { + console.error('Query ticker', e); + } + setTimeout(refreshTickerRecursively, 5000); +} initParams(); +refreshTickerRecursively(); app.get('/ticker', async (req, res, next) => { try { From 0fff97876b586b7d7e3012daf5e6b4f55569bbcb Mon Sep 17 00:00:00 2001 From: Kostya Pogromskiy Date: Fri, 14 May 2021 20:08:28 +0300 Subject: [PATCH 08/29] Update cmc limit --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3a867a9..3b7bc4e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM node:latest ENV HTTP_PORT 5000 ENV EXPLORER_URL http://127.0.0.1:4000/api -ENV CMC_LIMIT 300 +ENV CMC_LIMIT 3000 ENV DEBUG false WORKDIR /usr/src/app From b618d02923fd82290c3b42cdcd333a94fde4b277 Mon Sep 17 00:00:00 2001 From: kpogromskiy Date: Fri, 6 Aug 2021 19:27:00 +0300 Subject: [PATCH 09/29] Coinmarketcap limit update --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3b7bc4e..34a59b5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM node:latest ENV HTTP_PORT 5000 ENV EXPLORER_URL http://127.0.0.1:4000/api -ENV CMC_LIMIT 3000 +ENV CMC_LIMIT 2500 ENV DEBUG false WORKDIR /usr/src/app From 392dcfd7d189e95fecc31b0234b4b38edb01523b Mon Sep 17 00:00:00 2001 From: Maksym Kryva Date: Fri, 6 Aug 2021 19:34:56 +0300 Subject: [PATCH 10/29] add auto build --- .github/workflows/build.yaml | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/build.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..3d8a04c --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,38 @@ +name: Build +on: + workflow_dispatch: + push: + branches: [main] + +jobs: + docker-build-push: + # Name the Job + name: Build and push + runs-on: build + outputs: + repository: ${{ steps.build.outputs.repository }} + image_tag: ${{ steps.build.outputs.image_tag }} + steps: + - uses: actions/checkout@v2 + - name: Configure AWS credentials + id: checkout + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.AWS_REGION }} + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + - name: Build, tag, and push image to AWS ECR + id: build + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: velas-ticker + IMAGE_TAG: ${{github.sha}} + run: | + docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG --no-cache . + docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG + echo "::set-output name=repository::$ECR_REPOSITORY" + echo "::set-output name=image_tag::$IMAGE_TAG" + From befe06138e26740193d085555cfdfc0281a5fb88 Mon Sep 17 00:00:00 2001 From: Kostya Pogromskiy Date: Fri, 6 Aug 2021 20:11:30 +0300 Subject: [PATCH 11/29] Do not update bitcoin price if CMC request failed --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index d4782e7..3b87e6f 100644 --- a/index.js +++ b/index.js @@ -89,7 +89,7 @@ async function getCryptoCoinsInfo() { return result; }catch(e) { console.error(e); - return {btc: {quote: {USD: {price: 0, volume_24h: 0}}}, vlx: {quote: {USD: {price: 0, volume_24h: 0}}}}; + return Object.create(null); } } From adcc436af1214cc236b2dbc18e8a06d87aaf8c09 Mon Sep 17 00:00:00 2001 From: Kostya Pogromskiy Date: Tue, 31 Aug 2021 11:42:18 +0300 Subject: [PATCH 12/29] Add busd, usdc, huobi and binance coin --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 3b87e6f..95c1371 100644 --- a/index.js +++ b/index.js @@ -2,7 +2,7 @@ const express = require("express"); const fetch = require("node-fetch"); const BigNumber = require("bignumber.js"); const fs = require("fs"); -const monitoringCurrencies = ['vlx', 'btc', 'ltc', 'eth', 'gbx', 'usdt' ]; +const monitoringCurrencies = ['vlx', 'btc', 'ltc', 'eth', 'gbx', 'usdt', 'busd', 'usdc', 'ht', 'bnb' ]; const app = express(); let tickerRefreshPromise = null; let cachedTicker = null; From a848234d99a1fb8d17cc2b172c01fd7c014f0194 Mon Sep 17 00:00:00 2001 From: Kostya Pogromskiy Date: Mon, 6 Sep 2021 10:44:19 +0300 Subject: [PATCH 13/29] Add Solana coin --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 95c1371..aa71035 100644 --- a/index.js +++ b/index.js @@ -2,7 +2,7 @@ const express = require("express"); const fetch = require("node-fetch"); const BigNumber = require("bignumber.js"); const fs = require("fs"); -const monitoringCurrencies = ['vlx', 'btc', 'ltc', 'eth', 'gbx', 'usdt', 'busd', 'usdc', 'ht', 'bnb' ]; +const monitoringCurrencies = ['vlx', 'btc', 'ltc', 'eth', 'gbx', 'usdt', 'busd', 'usdc', 'ht', 'bnb', 'sol' ]; const app = express(); let tickerRefreshPromise = null; let cachedTicker = null; From f26c8ab5bcaf1001ff8540711fc8a965f6fa98a6 Mon Sep 17 00:00:00 2001 From: Kostya Pogromskiy Date: Tue, 21 Dec 2021 16:24:41 +0200 Subject: [PATCH 14/29] Exit on timeout --- index.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index aa71035..4ab5fa3 100644 --- a/index.js +++ b/index.js @@ -12,6 +12,8 @@ let explorerUrl = null; let cmcLimit = null; let debug = false; +const EXIT_AFTER_TIMEOUT = parseInt(process.env.EXIT_AFTER_TIMEOUT) || 3600*1000; + function initParams() { if (process.env.HTTP_PORT) { port = parseInt(process.env.HTTP_PORT); @@ -87,7 +89,7 @@ async function getCryptoCoinsInfo() { } } return result; - }catch(e) { + } catch(e) { console.error(e); return Object.create(null); } @@ -136,6 +138,7 @@ async function queryTicker() { getVlxSupplyBN(), getCryptoCoinsInfo(), ]); + if (!prices.vlx) return cachedTicker; const total_supply = fixTotalSupply(supplyBN.toNumber()) const available_supply = total_supply; const volume = round(prices.vlx.quote.USD.volume_24h); @@ -154,6 +157,7 @@ async function queryTicker() { cachedTicker.price_btc = price_btc || cachedTicker.price_btc || "0"; cachedTicker.volume_btc = volume_btc || cachedTicker.volume_btc || "0"; cachedTicker.available_supply = available_supply || cachedTicker.available_supply || "0"; + cachedTicker.ts = Date.now(); for (const currency in prices) { if (currency === 'vlx') { @@ -161,7 +165,7 @@ async function queryTicker() { } try { cachedTicker[`${currency}_price`] = round8(prices[currency].quote.USD.price); - }catch(e) { + } catch(e) { console.error(`Parsing ${currency} error`, e); } } @@ -188,7 +192,11 @@ async function refreshTickerRecursively() { if (debug) { console.log('Ticker queried recurcively in ms ', Date.now() - startAt); } - }catch(e) { + if (cachedTicker && Date.now() - cachedTicker.ts > EXIT_AFTER_TIMEOUT) { + console.error('Exiting because of timeout'); + process.exit(1); + } + } catch(e) { console.error('Query ticker', e); } setTimeout(refreshTickerRecursively, 5000); @@ -254,7 +262,7 @@ app.get('/config.toml', async (req, res, next) => { return; } res.send(config); - }catch(e) { + } catch(e) { next(e); } }); From 3a350846ed06424f2e5544cb03415838ab605699 Mon Sep 17 00:00:00 2001 From: Kostya Pogromskiy Date: Thu, 23 Dec 2021 16:03:18 +0200 Subject: [PATCH 15/29] Get velas rpc url from the env var --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 4ab5fa3..1ef3676 100644 --- a/index.js +++ b/index.js @@ -13,6 +13,7 @@ let cmcLimit = null; let debug = false; const EXIT_AFTER_TIMEOUT = parseInt(process.env.EXIT_AFTER_TIMEOUT) || 3600*1000; +const VELAS_RPC_URL = process.env.VELAS_RPC_URL || "https://api.velas.com/rpc"; function initParams() { if (process.env.HTTP_PORT) { @@ -44,7 +45,7 @@ function initParams() { async function getVlxSupplyBN() { try { - const resSupply = await fetch(`https://mainnet.velas.com/rpc`, { + const resSupply = await fetch(VELAS_RPC_URL, { method: 'POST', cache: 'no-cache', headers: { From a5695d317039158eb42183aed32cb7cecc1132f3 Mon Sep 17 00:00:00 2001 From: Kostya Pogromskiy Date: Thu, 10 Feb 2022 22:39:37 +0200 Subject: [PATCH 16/29] Use different cycle algorithm --- index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 1ef3676..d1a4d60 100644 --- a/index.js +++ b/index.js @@ -200,11 +200,14 @@ async function refreshTickerRecursively() { } catch(e) { console.error('Query ticker', e); } - setTimeout(refreshTickerRecursively, 5000); } initParams(); -refreshTickerRecursively(); +// Application stops refreshing because of unknown reason. This could be because of +// recursive algorithm in the following function. +// refreshTickerRecursively(); + +setInterval(queryTicker, 50000); app.get('/ticker', async (req, res, next) => { try { From ac6c436fb41751639744729b9558a4e1b099bb37 Mon Sep 17 00:00:00 2001 From: Kostya Pogromskiy Date: Thu, 12 May 2022 15:11:58 +0300 Subject: [PATCH 17/29] Dont exit on old data --- index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/index.js b/index.js index d1a4d60..521c6bf 100644 --- a/index.js +++ b/index.js @@ -194,8 +194,7 @@ async function refreshTickerRecursively() { console.log('Ticker queried recurcively in ms ', Date.now() - startAt); } if (cachedTicker && Date.now() - cachedTicker.ts > EXIT_AFTER_TIMEOUT) { - console.error('Exiting because of timeout'); - process.exit(1); + console.error('Data too old', cachedTicker.ts); } } catch(e) { console.error('Query ticker', e); From 47cd205243fb06f9139ee7b64420ed30b0aaa7f6 Mon Sep 17 00:00:00 2001 From: Kostya Pogromskiy Date: Thu, 12 May 2022 15:12:40 +0300 Subject: [PATCH 18/29] Log query data --- index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/index.js b/index.js index 521c6bf..17c1308 100644 --- a/index.js +++ b/index.js @@ -133,6 +133,7 @@ function round8(num) { } async function queryTicker() { + console.log('queryTicker'); try { const startAt = Date.now(); const [supplyBN, prices] = await Promise.all([ From 6ab1d3c338986bd9c606916ac03a52750e20b624 Mon Sep 17 00:00:00 2001 From: Kostya Pogromskiy Date: Wed, 15 Jun 2022 14:36:09 +0300 Subject: [PATCH 19/29] Use timeout to avoid hang --- index.js | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/index.js b/index.js index 17c1308..b770125 100644 --- a/index.js +++ b/index.js @@ -12,9 +12,37 @@ let explorerUrl = null; let cmcLimit = null; let debug = false; -const EXIT_AFTER_TIMEOUT = parseInt(process.env.EXIT_AFTER_TIMEOUT) || 3600*1000; +const TIMEOUT = parseInt(process.env.NETWORK_TIMEOUT) || 100000; const VELAS_RPC_URL = process.env.VELAS_RPC_URL || "https://api.velas.com/rpc"; +function withTimeout(func, timeoutMS = TIMEOUT) { + return new Promise(async (resolve, reject) => { + let isResolved = false; + const timeout = setTimeout(() => { + if (isResolved) return; + isResolved = true; + reject(new Error('Timeout')); + }, timeoutMS); + try { + const res = await func(); + clearTimeout(timeout); + if (!isResolved) { + isResolved = true; + resolve(res); + } else { + console.warn('Got result after timeout', ); + } + } catch(e) { + if (!isResolved) { + isResolved = true; + reject(e); + } else { + console.warn('Error after timeout', e); + } + } + }); +} + function initParams() { if (process.env.HTTP_PORT) { port = parseInt(process.env.HTTP_PORT); @@ -190,24 +218,20 @@ async function queryTickerCached() { async function refreshTickerRecursively() { try { const startAt = Date.now(); - await queryTicker(); + await withTimeout(queryTicker); if (debug) { console.log('Ticker queried recurcively in ms ', Date.now() - startAt); } - if (cachedTicker && Date.now() - cachedTicker.ts > EXIT_AFTER_TIMEOUT) { - console.error('Data too old', cachedTicker.ts); - } } catch(e) { console.error('Query ticker', e); + } finally { + setTimeout(refreshTickerRecursively, 50000); } } initParams(); -// Application stops refreshing because of unknown reason. This could be because of -// recursive algorithm in the following function. -// refreshTickerRecursively(); -setInterval(queryTicker, 50000); +refreshTickerRecursively(); app.get('/ticker', async (req, res, next) => { try { From e27527476e1a070be296fbf6e0d9b53db117a49c Mon Sep 17 00:00:00 2001 From: Kostya Pogromskiy Date: Mon, 27 Jun 2022 08:26:28 +0300 Subject: [PATCH 20/29] Add btc_usd --- index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/index.js b/index.js index b770125..6b2fc02 100644 --- a/index.js +++ b/index.js @@ -185,6 +185,7 @@ async function queryTicker() { cachedTicker.price_usd = price_usd || cachedTicker.price_usd || "0"; cachedTicker.volume = volume || cachedTicker.volume || "0"; cachedTicker.price_btc = price_btc || cachedTicker.price_btc || "0"; + cachedTicker.btc_usd = btc_usd || cachedTicker.btc_usd || "0"; cachedTicker.volume_btc = volume_btc || cachedTicker.volume_btc || "0"; cachedTicker.available_supply = available_supply || cachedTicker.available_supply || "0"; cachedTicker.ts = Date.now(); From af6c13e975685178cb3c3c460517f28f459a1b36 Mon Sep 17 00:00:00 2001 From: Kostya Pogromskiy Date: Tue, 19 Jul 2022 18:29:01 +0300 Subject: [PATCH 21/29] Use cmc api --- index.js | 75 ++++++++++++++++++++++++-------------------------------- 1 file changed, 32 insertions(+), 43 deletions(-) diff --git a/index.js b/index.js index 6b2fc02..770f5c6 100644 --- a/index.js +++ b/index.js @@ -2,7 +2,7 @@ const express = require("express"); const fetch = require("node-fetch"); const BigNumber = require("bignumber.js"); const fs = require("fs"); -const monitoringCurrencies = ['vlx', 'btc', 'ltc', 'eth', 'gbx', 'usdt', 'busd', 'usdc', 'ht', 'bnb', 'sol' ]; +const monitoringCurrencies = ['velas', 'bitcoin', 'litecoin', 'ethereum', 'gobyte', 'tether', 'binance-usd', 'usd-coin', 'huobi-token', 'bnb', 'solana', 'bitorbit', 'usdv', 'pulsepad', 'velhalla', 'weway', 'swapz', 'astroswap', 'qmall-token', 'verve', 'metavpad', 'velaspad', 'wagyuswap', 'velerodao', 'multi-collateral-dai']; const app = express(); let tickerRefreshPromise = null; let cachedTicker = null; @@ -14,6 +14,11 @@ let debug = false; const TIMEOUT = parseInt(process.env.NETWORK_TIMEOUT) || 100000; const VELAS_RPC_URL = process.env.VELAS_RPC_URL || "https://api.velas.com/rpc"; +const API_KEY = process.env.CMC_API_KEY; +if (!API_KEY) { + console.error("CMC API_KEY env variable required"); + process.exit(1); +} function withTimeout(func, timeoutMS = TIMEOUT) { return new Promise(async (resolve, reject) => { @@ -30,9 +35,9 @@ function withTimeout(func, timeoutMS = TIMEOUT) { isResolved = true; resolve(res); } else { - console.warn('Got result after timeout', ); + console.warn('Got result after timeout'); } - } catch(e) { + } catch (e) { if (!isResolved) { isResolved = true; reject(e); @@ -91,8 +96,8 @@ async function getVlxSupplyBN() { if (debug) { console.log('Got supply', supply); } - return new BigNumber(supply/1e9 + ''); - } catch(e) { + return new BigNumber(supply / 1e9 + ''); + } catch (e) { console.error(e); return new BigNumber(0); } @@ -100,43 +105,30 @@ async function getVlxSupplyBN() { async function getCryptoCoinsInfo() { try { - const resCmcListing = await fetch(`https://web-api.coinmarketcap.com/v1/cryptocurrency/listings/latest?limit=${cmcLimit}&start=1`); - const jsonCmcListing = await resCmcListing.json(); + const res = await fetch( + `https://pro-api.coinmarketcap.com/v2/cryptocurrency/quotes/latest?slug=${monitoringCurrencies.join()}`, + { headers: { 'X-CMC_PRO_API_KEY': API_KEY } } + ); + const json = await res.json(); const result = Object.create(null); - for (let currency of monitoringCurrencies) { - const currencyUpper = currency.toUpperCase(); - result[currency] = jsonCmcListing.data.find((coin) => coin.symbol === currencyUpper); - if (!result[currency]) { - result[currency] = { - quote: { - USD: { - price: 0, - volume_24h: 0 - } - } - }; - } + for (let k in json.data) { + const currencyUpper = json.data[k].symbol; + result[currencyUpper.toLowerCase() ] = { + quote: json.data[k].quote, + }; } return result; - } catch(e) { + } catch (e) { console.error(e); return Object.create(null); } } -// async function getVlxBalanceBN(address) { -// const res = await fetch(`${explorerUrl}?module=account&action=eth_get_balance&address=${address}`); -// const json = await res.json(); -// const balance = json.result; -// return new BigNumber(balance).dividedBy(1e18); -// } - function fixTotalSupply(supply) { if (!supply) { return ''; } return supply + ""; - // return Math.round(Math.max(2080000000, supply)) + ""; } function round(num) { @@ -171,11 +163,11 @@ async function queryTicker() { if (!prices.vlx) return cachedTicker; const total_supply = fixTotalSupply(supplyBN.toNumber()) const available_supply = total_supply; - const volume = round(prices.vlx.quote.USD.volume_24h); - const price_btc = round8(prices.vlx.quote.USD.price / prices.btc.quote.USD.price); + const volume = round(prices.vlx.quote.USD.volume_24h); + const price_btc = round8(prices.vlx.quote.USD.price / prices.btc.quote.USD.price); const volume_btc = round8(prices.vlx.quote.USD.volume_24h / prices.btc.quote.USD.price); - const price_usd = round6(prices.vlx.quote.USD.price); + const price_usd = round6(prices.vlx.quote.USD.price); const btc_usd = round8(prices.btc.quote.USD.price); if (!cachedTicker) { @@ -191,19 +183,16 @@ async function queryTicker() { cachedTicker.ts = Date.now(); for (const currency in prices) { - if (currency === 'vlx') { - continue; - } try { cachedTicker[`${currency}_price`] = round8(prices[currency].quote.USD.price); - } catch(e) { + } catch (e) { console.error(`Parsing ${currency} error`, e); } } if (debug) { console.log("Got ticker", Date.now() - startAt, new Date()); } - } catch(e) { + } catch (e) { console.error(e); } return cachedTicker; @@ -223,7 +212,7 @@ async function refreshTickerRecursively() { if (debug) { console.log('Ticker queried recurcively in ms ', Date.now() - startAt); } - } catch(e) { + } catch (e) { console.error('Query ticker', e); } finally { setTimeout(refreshTickerRecursively, 50000); @@ -241,7 +230,7 @@ app.get('/ticker', async (req, res, next) => { throw new Error("Error composing ticker"); } res.json(ticker); - } catch(e) { + } catch (e) { next(e); } }); @@ -253,7 +242,7 @@ app.get('/asapi', async (req, res, next) => { throw new Error("Error composing ticker"); } res.send(ticker.available_supply); - } catch(e) { + } catch (e) { next(e); } }); @@ -265,7 +254,7 @@ app.get('/tsapi', async (req, res, next) => { throw new Error("Error composing ticker"); } res.send(ticker.total_supply); - } catch(e) { + } catch (e) { next(e); } }); @@ -277,7 +266,7 @@ app.get('/api/v1/stats/totalcoins', async (req, res, next) => { throw new Error("Error composing ticker"); } res.send(ticker.total_supply); - } catch(e) { + } catch (e) { next(e); } }); @@ -291,7 +280,7 @@ app.get('/config.toml', async (req, res, next) => { return; } res.send(config); - } catch(e) { + } catch (e) { next(e); } }); From d00c82c9e00e83750ee1d1c6dc38a48f3e4f7b74 Mon Sep 17 00:00:00 2001 From: Kostya Pogromskiy Date: Tue, 19 Jul 2022 18:34:25 +0300 Subject: [PATCH 22/29] Add REFRESH_PERIOD --- index.js | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/index.js b/index.js index 770f5c6..0e6564b 100644 --- a/index.js +++ b/index.js @@ -4,19 +4,19 @@ const BigNumber = require("bignumber.js"); const fs = require("fs"); const monitoringCurrencies = ['velas', 'bitcoin', 'litecoin', 'ethereum', 'gobyte', 'tether', 'binance-usd', 'usd-coin', 'huobi-token', 'bnb', 'solana', 'bitorbit', 'usdv', 'pulsepad', 'velhalla', 'weway', 'swapz', 'astroswap', 'qmall-token', 'verve', 'metavpad', 'velaspad', 'wagyuswap', 'velerodao', 'multi-collateral-dai']; const app = express(); -let tickerRefreshPromise = null; let cachedTicker = null; let port = null; let explorerUrl = null; -let cmcLimit = null; let debug = false; const TIMEOUT = parseInt(process.env.NETWORK_TIMEOUT) || 100000; const VELAS_RPC_URL = process.env.VELAS_RPC_URL || "https://api.velas.com/rpc"; const API_KEY = process.env.CMC_API_KEY; +const REFRESH_PERIOD = parseInt(REFRESH_PERIOD) || 300000; + if (!API_KEY) { - console.error("CMC API_KEY env variable required"); + console.error("CMC_API_KEY env variable required"); process.exit(1); } @@ -63,13 +63,6 @@ function initParams() { explorerUrl = "http://127.0.0.1:4000/api"; console.log("Using default explorer url. You can set environment variable EXPLORER_URL to change it", explorerUrl); } - if (process.env.CMC_LIMIT) { - cmcLimit = process.env.CMC_LIMIT; - console.log("Using coinmarketcap limit taken from environment variable CMC_LIMIT", cmcLimit); - } else { - cmcLimit = 3000; - console.log("Using coinmarketcap limit. You can set environment variable CMC_LIMIT to change it", cmcLimit); - } if (process.env.DEBUG && process.env.DEBUG !== "false" && process.env.DEBUG !== "no" && process.env.DEBUG !== "0" && process.env.DEBUG !== "FALSE" && process.env.DEBUG !== "NO") { debug = true; @@ -215,7 +208,7 @@ async function refreshTickerRecursively() { } catch (e) { console.error('Query ticker', e); } finally { - setTimeout(refreshTickerRecursively, 50000); + setTimeout(refreshTickerRecursively, REFRESH_PERIOD); } } From af772bb3bafd1d04b98b3e16b86e6769d84d7a54 Mon Sep 17 00:00:00 2001 From: Kostya Pogromskiy Date: Tue, 19 Jul 2022 21:02:34 +0300 Subject: [PATCH 23/29] Fix REFRESH_PERIOD env variable usage --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 0e6564b..c8aba2b 100644 --- a/index.js +++ b/index.js @@ -13,7 +13,7 @@ let debug = false; const TIMEOUT = parseInt(process.env.NETWORK_TIMEOUT) || 100000; const VELAS_RPC_URL = process.env.VELAS_RPC_URL || "https://api.velas.com/rpc"; const API_KEY = process.env.CMC_API_KEY; -const REFRESH_PERIOD = parseInt(REFRESH_PERIOD) || 300000; +const REFRESH_PERIOD = parseInt(process.env.REFRESH_PERIOD) || 300000; if (!API_KEY) { console.error("CMC_API_KEY env variable required"); From 0214f4db67d065dabcb5703acf621f86288f8aab Mon Sep 17 00:00:00 2001 From: kpogromskiy Date: Wed, 12 Oct 2022 12:37:51 +0300 Subject: [PATCH 24/29] Create README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..a1bb132 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# ticker + +Serve common cryptocurrency prices From 015f9fccf075dd0f4a15450c1e43ffb433316bcf Mon Sep 17 00:00:00 2001 From: Andrii Hryshaienko Date: Wed, 12 Oct 2022 13:43:59 +0300 Subject: [PATCH 25/29] update ci --- .github/workflows/build.yaml | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 3d8a04c..fd5b2ba 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -5,34 +5,20 @@ on: branches: [main] jobs: - docker-build-push: - # Name the Job + docker-build: name: Build and push - runs-on: build + runs-on: testnet-services outputs: repository: ${{ steps.build.outputs.repository }} image_tag: ${{ steps.build.outputs.image_tag }} steps: - uses: actions/checkout@v2 - - name: Configure AWS credentials - id: checkout - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ${{ secrets.AWS_REGION }} - - name: Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 - - name: Build, tag, and push image to AWS ECR + - name: Build, tag, and push image id: build env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - ECR_REPOSITORY: velas-ticker + REGISTRY: ${{ secrets.REGISTRY_HOST }}/velas + REPOSITORY: ${{ env.APP_REPO }} IMAGE_TAG: ${{github.sha}} run: | - docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG --no-cache . - docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG - echo "::set-output name=repository::$ECR_REPOSITORY" - echo "::set-output name=image_tag::$IMAGE_TAG" - + docker build -t $REGISTRY/$REPOSITORY:$IMAGE_TAG --no-cache . + docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG From 570668dbc7cd4f472b8c0c69a381c0c877f3a438 Mon Sep 17 00:00:00 2001 From: Andrii Hryshaienko Date: Wed, 12 Oct 2022 13:44:51 +0300 Subject: [PATCH 26/29] update ci --- .github/workflows/build.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index fd5b2ba..f9f8650 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -4,6 +4,9 @@ on: push: branches: [main] +env: + APP_REPO: velas-ticker + jobs: docker-build: name: Build and push From 31f57002f3ccff4c3050076e578f38f45212aa4f Mon Sep 17 00:00:00 2001 From: Kostya Pogromskiy Date: Mon, 7 Nov 2022 18:26:36 +0200 Subject: [PATCH 27/29] Add 24h diff query param --- index.js | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/index.js b/index.js index c8aba2b..4619b55 100644 --- a/index.js +++ b/index.js @@ -7,7 +7,6 @@ const app = express(); let cachedTicker = null; let port = null; -let explorerUrl = null; let debug = false; const TIMEOUT = parseInt(process.env.NETWORK_TIMEOUT) || 100000; @@ -56,13 +55,6 @@ function initParams() { port = 5000; console.log("Trying to listen to port", port, ". You can set environment variable HTTP_PORT to change it."); } - if (process.env.EXPLORER_URL) { - explorerUrl = process.env.EXPLORER_URL; - console.log("Using explorer url taken from environment variable EXPLORER_URL", explorerUrl); - } else { - explorerUrl = "http://127.0.0.1:4000/api"; - console.log("Using default explorer url. You can set environment variable EXPLORER_URL to change it", explorerUrl); - } if (process.env.DEBUG && process.env.DEBUG !== "false" && process.env.DEBUG !== "no" && process.env.DEBUG !== "0" && process.env.DEBUG !== "FALSE" && process.env.DEBUG !== "NO") { debug = true; @@ -106,7 +98,7 @@ async function getCryptoCoinsInfo() { const result = Object.create(null); for (let k in json.data) { const currencyUpper = json.data[k].symbol; - result[currencyUpper.toLowerCase() ] = { + result[currencyUpper.toLowerCase()] = { quote: json.data[k].quote, }; } @@ -178,6 +170,7 @@ async function queryTicker() { for (const currency in prices) { try { cachedTicker[`${currency}_price`] = round8(prices[currency].quote.USD.price); + cachedTicker[`${currency}_24hdiff`] = round8(prices[currency].quote.USD.percent_change_24h); } catch (e) { console.error(`Parsing ${currency} error`, e); } @@ -216,9 +209,23 @@ initParams(); refreshTickerRecursively(); +function filterOut24Diff(ticker) { + ticker = Object.assign({}, ticker); + for (const key of Object.keys(ticker)) { + if (key.endsWith('_24hdiff')) { + delete ticker[key]; + } + } + return ticker; +} + app.get('/ticker', async (req, res, next) => { try { - const ticker = await queryTickerCached(); + let ticker = await queryTickerCached(); + if (!req.query.include24hdiff) { // + ticker = filterOut24Diff(ticker); + } + if (!ticker) { throw new Error("Error composing ticker"); } From f02ca01f17e218ff19c6edf272df46f22c61832d Mon Sep 17 00:00:00 2001 From: Kostya Pogromskiy Date: Mon, 7 Nov 2022 21:24:22 +0200 Subject: [PATCH 28/29] Fix deps --- package-lock.json | 563 +++++++++++++++++++++++++++++++++++++++++++++- yarn.lock | 382 +++++++++++++++++++++++++++++++ 2 files changed, 941 insertions(+), 4 deletions(-) create mode 100644 yarn.lock diff --git a/package-lock.json b/package-lock.json index a93652b..d44902a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,8 +1,541 @@ { "name": "velas-ticker", "version": "1.0.0", - "lockfileVersion": 1, + "lockfileVersion": 2, "requires": true, + "packages": { + "": { + "name": "velas-ticker", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "bignumber.js": "^9.0.0", + "express": "^4.17.1", + "node-fetch": "^2.6.1" + } + }, + "node_modules/accepts": { + "version": "1.3.7", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", + "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", + "dependencies": { + "mime-types": "~2.1.24", + "negotiator": "0.6.2" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" + }, + "node_modules/bignumber.js": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz", + "integrity": "sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A==", + "engines": { + "node": "*" + } + }, + "node_modules/body-parser": { + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", + "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==", + "dependencies": { + "bytes": "3.1.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.2", + "http-errors": "1.7.2", + "iconv-lite": "0.4.24", + "on-finished": "~2.3.0", + "qs": "6.7.0", + "raw-body": "2.4.0", + "type-is": "~1.6.17" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/bytes": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", + "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/content-disposition": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", + "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==", + "dependencies": { + "safe-buffer": "5.1.2" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz", + "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" + }, + "node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/destroy": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" + }, + "node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/express": { + "version": "4.17.1", + "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", + "integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==", + "dependencies": { + "accepts": "~1.3.7", + "array-flatten": "1.1.1", + "body-parser": "1.19.0", + "content-disposition": "0.5.3", + "content-type": "~1.0.4", + "cookie": "0.4.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "~1.1.2", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.5", + "qs": "6.7.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.1.2", + "send": "0.17.1", + "serve-static": "1.14.1", + "setprototypeof": "1.1.1", + "statuses": "~1.5.0", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/finalhandler": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", + "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.3", + "statuses": "~1.5.0", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/forwarded": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", + "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/http-errors": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", + "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==", + "dependencies": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.1", + "statuses": ">= 1.5.0 < 2", + "toidentifier": "1.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mime-db": { + "version": "1.44.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", + "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.27", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz", + "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==", + "dependencies": { + "mime-db": "1.44.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "node_modules/negotiator": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", + "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/node-fetch": { + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" + }, + "node_modules/proxy-addr": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz", + "integrity": "sha512-dh/frvCBVmSsDYzw6n926jv974gddhkFPfiN8hPOi30Wax25QZyZEGveluCgliBnqmuM+UJmBErbAUFIoDbjOw==", + "dependencies": { + "forwarded": "~0.1.2", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/qs": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", + "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz", + "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==", + "dependencies": { + "bytes": "3.1.0", + "http-errors": "1.7.2", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/send": { + "version": "0.17.1", + "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", + "integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==", + "dependencies": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "~1.7.2", + "mime": "1.6.0", + "ms": "2.1.1", + "on-finished": "~2.3.0", + "range-parser": "~1.2.1", + "statuses": "~1.5.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" + }, + "node_modules/serve-static": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz", + "integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==", + "dependencies": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.17.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/setprototypeof": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", + "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" + }, + "node_modules/statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/toidentifier": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", + "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + } + }, "dependencies": { "accepts": { "version": "1.3.7", @@ -241,9 +774,12 @@ "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" }, "node-fetch": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "requires": { + "whatwg-url": "^5.0.0" + } }, "on-finished": { "version": "2.3.0", @@ -356,6 +892,11 @@ "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==" }, + "tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, "type-is": { "version": "1.6.18", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", @@ -379,6 +920,20 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" + }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } } } } diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..17b2129 --- /dev/null +++ b/yarn.lock @@ -0,0 +1,382 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"accepts@~1.3.7": + "integrity" "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==" + "resolved" "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz" + "version" "1.3.7" + dependencies: + "mime-types" "~2.1.24" + "negotiator" "0.6.2" + +"array-flatten@1.1.1": + "integrity" "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" + "resolved" "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz" + "version" "1.1.1" + +"bignumber.js@^9.0.0": + "integrity" "sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A==" + "resolved" "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz" + "version" "9.0.0" + +"body-parser@1.19.0": + "integrity" "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==" + "resolved" "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz" + "version" "1.19.0" + dependencies: + "bytes" "3.1.0" + "content-type" "~1.0.4" + "debug" "2.6.9" + "depd" "~1.1.2" + "http-errors" "1.7.2" + "iconv-lite" "0.4.24" + "on-finished" "~2.3.0" + "qs" "6.7.0" + "raw-body" "2.4.0" + "type-is" "~1.6.17" + +"bytes@3.1.0": + "integrity" "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==" + "resolved" "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz" + "version" "3.1.0" + +"content-disposition@0.5.3": + "integrity" "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==" + "resolved" "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz" + "version" "0.5.3" + dependencies: + "safe-buffer" "5.1.2" + +"content-type@~1.0.4": + "integrity" "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" + "resolved" "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz" + "version" "1.0.4" + +"cookie-signature@1.0.6": + "integrity" "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" + "resolved" "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz" + "version" "1.0.6" + +"cookie@0.4.0": + "integrity" "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==" + "resolved" "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz" + "version" "0.4.0" + +"debug@2.6.9": + "integrity" "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==" + "resolved" "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz" + "version" "2.6.9" + dependencies: + "ms" "2.0.0" + +"depd@~1.1.2": + "integrity" "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" + "resolved" "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz" + "version" "1.1.2" + +"destroy@~1.0.4": + "integrity" "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" + "resolved" "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz" + "version" "1.0.4" + +"ee-first@1.1.1": + "integrity" "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" + "resolved" "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz" + "version" "1.1.1" + +"encodeurl@~1.0.2": + "integrity" "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" + "resolved" "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz" + "version" "1.0.2" + +"escape-html@~1.0.3": + "integrity" "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + "resolved" "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz" + "version" "1.0.3" + +"etag@~1.8.1": + "integrity" "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" + "resolved" "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz" + "version" "1.8.1" + +"express@^4.17.1": + "integrity" "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==" + "resolved" "https://registry.npmjs.org/express/-/express-4.17.1.tgz" + "version" "4.17.1" + dependencies: + "accepts" "~1.3.7" + "array-flatten" "1.1.1" + "body-parser" "1.19.0" + "content-disposition" "0.5.3" + "content-type" "~1.0.4" + "cookie" "0.4.0" + "cookie-signature" "1.0.6" + "debug" "2.6.9" + "depd" "~1.1.2" + "encodeurl" "~1.0.2" + "escape-html" "~1.0.3" + "etag" "~1.8.1" + "finalhandler" "~1.1.2" + "fresh" "0.5.2" + "merge-descriptors" "1.0.1" + "methods" "~1.1.2" + "on-finished" "~2.3.0" + "parseurl" "~1.3.3" + "path-to-regexp" "0.1.7" + "proxy-addr" "~2.0.5" + "qs" "6.7.0" + "range-parser" "~1.2.1" + "safe-buffer" "5.1.2" + "send" "0.17.1" + "serve-static" "1.14.1" + "setprototypeof" "1.1.1" + "statuses" "~1.5.0" + "type-is" "~1.6.18" + "utils-merge" "1.0.1" + "vary" "~1.1.2" + +"finalhandler@~1.1.2": + "integrity" "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==" + "resolved" "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz" + "version" "1.1.2" + dependencies: + "debug" "2.6.9" + "encodeurl" "~1.0.2" + "escape-html" "~1.0.3" + "on-finished" "~2.3.0" + "parseurl" "~1.3.3" + "statuses" "~1.5.0" + "unpipe" "~1.0.0" + +"forwarded@~0.1.2": + "integrity" "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" + "resolved" "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz" + "version" "0.1.2" + +"fresh@0.5.2": + "integrity" "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" + "resolved" "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz" + "version" "0.5.2" + +"http-errors@~1.7.2", "http-errors@1.7.2": + "integrity" "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==" + "resolved" "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz" + "version" "1.7.2" + dependencies: + "depd" "~1.1.2" + "inherits" "2.0.3" + "setprototypeof" "1.1.1" + "statuses" ">= 1.5.0 < 2" + "toidentifier" "1.0.0" + +"iconv-lite@0.4.24": + "integrity" "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==" + "resolved" "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz" + "version" "0.4.24" + dependencies: + "safer-buffer" ">= 2.1.2 < 3" + +"inherits@2.0.3": + "integrity" "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + "resolved" "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz" + "version" "2.0.3" + +"ipaddr.js@1.9.1": + "integrity" "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" + "resolved" "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz" + "version" "1.9.1" + +"media-typer@0.3.0": + "integrity" "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" + "resolved" "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz" + "version" "0.3.0" + +"merge-descriptors@1.0.1": + "integrity" "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" + "resolved" "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz" + "version" "1.0.1" + +"methods@~1.1.2": + "integrity" "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" + "resolved" "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz" + "version" "1.1.2" + +"mime-db@1.44.0": + "integrity" "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==" + "resolved" "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz" + "version" "1.44.0" + +"mime-types@~2.1.24": + "integrity" "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==" + "resolved" "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz" + "version" "2.1.27" + dependencies: + "mime-db" "1.44.0" + +"mime@1.6.0": + "integrity" "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" + "resolved" "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz" + "version" "1.6.0" + +"ms@2.0.0": + "integrity" "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + "resolved" "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz" + "version" "2.0.0" + +"ms@2.1.1": + "integrity" "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" + "resolved" "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz" + "version" "2.1.1" + +"negotiator@0.6.2": + "integrity" "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" + "resolved" "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz" + "version" "0.6.2" + +"node-fetch@^2.6.1": + "integrity" "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==" + "resolved" "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz" + "version" "2.6.7" + dependencies: + "whatwg-url" "^5.0.0" + +"on-finished@~2.3.0": + "integrity" "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=" + "resolved" "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz" + "version" "2.3.0" + dependencies: + "ee-first" "1.1.1" + +"parseurl@~1.3.3": + "integrity" "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" + "resolved" "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz" + "version" "1.3.3" + +"path-to-regexp@0.1.7": + "integrity" "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" + "resolved" "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz" + "version" "0.1.7" + +"proxy-addr@~2.0.5": + "integrity" "sha512-dh/frvCBVmSsDYzw6n926jv974gddhkFPfiN8hPOi30Wax25QZyZEGveluCgliBnqmuM+UJmBErbAUFIoDbjOw==" + "resolved" "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz" + "version" "2.0.6" + dependencies: + "forwarded" "~0.1.2" + "ipaddr.js" "1.9.1" + +"qs@6.7.0": + "integrity" "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" + "resolved" "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz" + "version" "6.7.0" + +"range-parser@~1.2.1": + "integrity" "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" + "resolved" "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz" + "version" "1.2.1" + +"raw-body@2.4.0": + "integrity" "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==" + "resolved" "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz" + "version" "2.4.0" + dependencies: + "bytes" "3.1.0" + "http-errors" "1.7.2" + "iconv-lite" "0.4.24" + "unpipe" "1.0.0" + +"safe-buffer@5.1.2": + "integrity" "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + "resolved" "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz" + "version" "5.1.2" + +"safer-buffer@>= 2.1.2 < 3": + "integrity" "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + "resolved" "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz" + "version" "2.1.2" + +"send@0.17.1": + "integrity" "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==" + "resolved" "https://registry.npmjs.org/send/-/send-0.17.1.tgz" + "version" "0.17.1" + dependencies: + "debug" "2.6.9" + "depd" "~1.1.2" + "destroy" "~1.0.4" + "encodeurl" "~1.0.2" + "escape-html" "~1.0.3" + "etag" "~1.8.1" + "fresh" "0.5.2" + "http-errors" "~1.7.2" + "mime" "1.6.0" + "ms" "2.1.1" + "on-finished" "~2.3.0" + "range-parser" "~1.2.1" + "statuses" "~1.5.0" + +"serve-static@1.14.1": + "integrity" "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==" + "resolved" "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz" + "version" "1.14.1" + dependencies: + "encodeurl" "~1.0.2" + "escape-html" "~1.0.3" + "parseurl" "~1.3.3" + "send" "0.17.1" + +"setprototypeof@1.1.1": + "integrity" "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" + "resolved" "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz" + "version" "1.1.1" + +"statuses@>= 1.5.0 < 2", "statuses@~1.5.0": + "integrity" "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" + "resolved" "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz" + "version" "1.5.0" + +"toidentifier@1.0.0": + "integrity" "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==" + "resolved" "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz" + "version" "1.0.0" + +"tr46@~0.0.3": + "integrity" "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + "resolved" "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz" + "version" "0.0.3" + +"type-is@~1.6.17", "type-is@~1.6.18": + "integrity" "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==" + "resolved" "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz" + "version" "1.6.18" + dependencies: + "media-typer" "0.3.0" + "mime-types" "~2.1.24" + +"unpipe@~1.0.0", "unpipe@1.0.0": + "integrity" "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" + "resolved" "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz" + "version" "1.0.0" + +"utils-merge@1.0.1": + "integrity" "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" + "resolved" "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz" + "version" "1.0.1" + +"vary@~1.1.2": + "integrity" "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" + "resolved" "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz" + "version" "1.1.2" + +"webidl-conversions@^3.0.0": + "integrity" "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + "resolved" "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz" + "version" "3.0.1" + +"whatwg-url@^5.0.0": + "integrity" "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==" + "resolved" "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz" + "version" "5.0.0" + dependencies: + "tr46" "~0.0.3" + "webidl-conversions" "^3.0.0" From 177abd7fabfa33bd1430a5fb0c1f2abed6d421cb Mon Sep 17 00:00:00 2001 From: Kostiantyn Pohromskyi Date: Tue, 18 Apr 2023 15:43:04 +0200 Subject: [PATCH 29/29] Add prices --- index.js | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 4619b55..cc1adbb 100644 --- a/index.js +++ b/index.js @@ -2,7 +2,7 @@ const express = require("express"); const fetch = require("node-fetch"); const BigNumber = require("bignumber.js"); const fs = require("fs"); -const monitoringCurrencies = ['velas', 'bitcoin', 'litecoin', 'ethereum', 'gobyte', 'tether', 'binance-usd', 'usd-coin', 'huobi-token', 'bnb', 'solana', 'bitorbit', 'usdv', 'pulsepad', 'velhalla', 'weway', 'swapz', 'astroswap', 'qmall-token', 'verve', 'metavpad', 'velaspad', 'wagyuswap', 'velerodao', 'multi-collateral-dai']; +const monitoringCurrencies = ['velas', 'bitcoin', 'litecoin', 'ethereum', 'gobyte', 'tether', 'binance-usd', 'usd-coin', 'huobi-token', 'bnb', 'solana', 'bitorbit', 'usdv', 'pulsepad', 'velhalla', 'weway', 'swapz', 'astroswap', 'qmall-token', 'verve', 'metavpad', 'velaspad', 'wagyuswap', 'velerodao', 'multi-collateral-dai', 'cardano', 'metafame', 'polygon', 'avalanche']; const app = express(); let cachedTicker = null; @@ -102,6 +102,9 @@ async function getCryptoCoinsInfo() { quote: json.data[k].quote, }; } + if (json?.status?.error_message) { + console.log('cmc response', json); + } return result; } catch (e) { console.error(e); @@ -109,6 +112,33 @@ async function getCryptoCoinsInfo() { } } +function addLabPrices(prices) { + if (!prices) { + return; + } + prices.labbusd_price = prices.busd_price; + prices.labusdt_price = prices.usdt_price; + prices.labusdc_price = prices.usdc_price; + prices.labeth_price = prices.eth_price; + prices.labbnb_price = prices.bnb_price; + prices.labmatic_price = prices.matic_price; + prices.labavax_price = prices.avax_price; +} + +function addAnyPrices(prices) { + if (!prices) { + return; + } + prices.anybusd_price = prices.busd_price; + prices.anyusdt_price = prices.usdt_price; + prices.anyusdc_price = prices.usdc_price; + prices.anyeth_price = prices.eth_price; + prices.anybnb_price = prices.bnb_price; + prices.anymatic_price = prices.matic_price; + prices.anyavax_price = prices.avax_price; + prices.anydai_price = prices.dai_price; +} + function fixTotalSupply(supply) { if (!supply) { return ''; @@ -175,6 +205,9 @@ async function queryTicker() { console.error(`Parsing ${currency} error`, e); } } + addLabPrices(cachedTicker); + addAnyPrices(cachedTicker); + if (debug) { console.log("Got ticker", Date.now() - startAt, new Date()); } @@ -231,6 +264,7 @@ app.get('/ticker', async (req, res, next) => { } res.json(ticker); } catch (e) { + console.error(e); next(e); } }); @@ -243,6 +277,7 @@ app.get('/asapi', async (req, res, next) => { } res.send(ticker.available_supply); } catch (e) { + console.error(e); next(e); } }); @@ -255,6 +290,7 @@ app.get('/tsapi', async (req, res, next) => { } res.send(ticker.total_supply); } catch (e) { + console.error(e); next(e); } }); @@ -267,6 +303,7 @@ app.get('/api/v1/stats/totalcoins', async (req, res, next) => { } res.send(ticker.total_supply); } catch (e) { + console.error(e); next(e); } }); @@ -281,6 +318,7 @@ app.get('/config.toml', async (req, res, next) => { } res.send(config); } catch (e) { + console.error(e); next(e); } });