mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-14 06:02:36 +03:00
exchange parameter was strongly typed
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user