exchange parameter was strongly typed

This commit is contained in:
kuduzow
2022-12-02 09:42:34 +03:00
parent 69fe09894e
commit 8794c1de47
2 changed files with 5 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@orionprotocol/sdk",
"version": "0.15.19-rc.0",
"version": "0.15.19-rc.1",
"description": "Orion Protocol SDK",
"main": "./lib/esm/index.js",
"module": "./lib/esm/index.js",

View File

@@ -1,4 +1,5 @@
import fetchWithValidation from '../../fetchWithValidation';
import { Exchange } from '../../types';
import { statisticsOverviewSchema, topPairsStatisticsSchema } from './schemas';
import candlesSchema from './schemas/candlesSchema';
import { PriceFeedWS } from './ws';
@@ -22,7 +23,7 @@ class PriceFeed {
timeStart: number,
timeEnd: number,
interval: '5m' | '30m' | '1h' | '1d',
exchange = 'all',
exchange = 'all'
) => {
const url = new URL(this.candlesUrl);
url.searchParams.append('symbol', symbol);
@@ -34,14 +35,14 @@ class PriceFeed {
return fetchWithValidation(url.toString(), candlesSchema);
};
getStatisticsOverview(exchange = 'ALL') {
getStatisticsOverview(exchange: Exchange | 'ALL' = 'ALL') {
const url = new URL(`${this.statisticsUrl}/overview`);
url.searchParams.append('exchange', exchange);
return fetchWithValidation(url.toString(), statisticsOverviewSchema);
}
getTopPairStatistics(exchange = 'ALL') {
getTopPairStatistics(exchange: Exchange | 'ALL' = 'ALL') {
const url = new URL(`${this.statisticsUrl}/top-pairs`);
url.searchParams.append('exchange', exchange);