diff --git a/.env.dist b/.env.dist index 2b50f2b..32c3803 100644 --- a/.env.dist +++ b/.env.dist @@ -10,3 +10,4 @@ THREE_ROUTE_API_AUTH_TOKEN= REDIS_URL= ADD_NOTIFICATION_USERNAME= ADD_NOTIFICATION_PASSWORD= +TZPRO_API_KEY= diff --git a/README.md b/README.md index 81400aa..2c21d2e 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ The Express backend which helps Temple Wallet to decrease amount of requests to | Path | Description | | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | /api/dapps | Provides a list of dApps with their TVL, summary TVL and amount of TEZ locked in them. | -| /api/exchange-rates/tez | Returns a single number, which is TEZ to USD exchange rate according to markets tickers from tzstats.com | +| /api/exchange-rates/tez | Returns a single number, which is TEZ to USD exchange rate according to markets tickers from TzPro API.com | | /api/exchange-rates | Returns the exchange rates of tokens to USD based on Quipuswap and Dexter pools (for most of them), stats from TZero (only for Aspencoin) and exchange rates from Coingecko (for WRAP tokens which are still not in pools). | | /api/moonpay-sign | Returns signed MoonPay url | | /api/mobile-check | Returns the minimum allowed versions of Android and IOS applications. Verifies App Check token. | diff --git a/src/config.ts b/src/config.ts index 4cfd913..81ec1d8 100644 --- a/src/config.ts +++ b/src/config.ts @@ -12,7 +12,8 @@ export const EnvVars = { THREE_ROUTE_API_AUTH_TOKEN: getEnv('THREE_ROUTE_API_AUTH_TOKEN'), REDIS_URL: getEnv('REDIS_URL'), ADD_NOTIFICATION_USERNAME: getEnv('ADD_NOTIFICATION_USERNAME'), - ADD_NOTIFICATION_PASSWORD: getEnv('ADD_NOTIFICATION_PASSWORD') + ADD_NOTIFICATION_PASSWORD: getEnv('ADD_NOTIFICATION_PASSWORD'), + TZPRO_API_KEY: getEnv('TZPRO_API_KEY') }; for (const name in EnvVars) { diff --git a/src/utils/tezos.ts b/src/utils/tezos.ts index e279b26..669ee3f 100644 --- a/src/utils/tezos.ts +++ b/src/utils/tezos.ts @@ -3,6 +3,7 @@ import { tzip12 } from '@taquito/tzip12'; import { tzip16 } from '@taquito/tzip16'; import memoizee from 'memoizee'; +import { EnvVars } from '../config'; import { ITicker } from '../interfaces/ticker.interface'; import fetch from './fetch'; import SingleQueryDataProvider from './SingleQueryDataProvider'; @@ -53,7 +54,9 @@ export const getStorage = memoizee( ); const getTezExchangeRate = async () => { - const marketTickers = await fetch>('https://api.tzstats.com/markets/tickers'); + const marketTickers = await fetch>( + `https://api.tzpro.io/markets/tickers?api_key=${EnvVars.TZPRO_API_KEY}` + ); const usdTickers = marketTickers.filter(e => e.quote === 'USD' && e.base === 'XTZ'); // price index: use all USD ticker last prices with equal weight const vol = usdTickers.reduce((s, t) => s + t.volume_base, 0) || null;