mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-18 03:45:02 +03:00
Added new pairs type: futures
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@orionprotocol/sdk",
|
||||
"version": "0.15.15",
|
||||
"version": "0.16.0-rc.0",
|
||||
"description": "Orion Protocol SDK",
|
||||
"main": "./lib/esm/index.js",
|
||||
"module": "./lib/esm/index.js",
|
||||
|
||||
@@ -14,6 +14,7 @@ import { pairConfigSchema } from './schemas';
|
||||
import {
|
||||
aggregatedOrderbookSchema, exchangeOrderbookSchema,
|
||||
} from './schemas/aggregatedOrderbookSchema';
|
||||
import toUpperCase from '../../utils/toUpperCase';
|
||||
|
||||
class OrionAggregator {
|
||||
private readonly apiUrl: string;
|
||||
@@ -39,10 +40,15 @@ class OrionAggregator {
|
||||
this.getExchangeOrderbook = this.getExchangeOrderbook.bind(this);
|
||||
}
|
||||
|
||||
getPairsList = () => fetchWithValidation(
|
||||
`${this.apiUrl}/api/v1/pairs/list`,
|
||||
z.array(z.string()),
|
||||
);
|
||||
getPairsList = (market: 'spot' | 'futures') => {
|
||||
const url = new URL(`${this.apiUrl}/api/v1/pairs/list`);
|
||||
url.searchParams.append('market', toUpperCase(market));
|
||||
|
||||
return fetchWithValidation(
|
||||
url.toString(),
|
||||
z.array(z.string()),
|
||||
);
|
||||
};
|
||||
|
||||
getAggregatedOrderbook = (pair: string, depth = 20) => {
|
||||
const url = new URL(`${this.apiUrl}/api/v1/orderbook`);
|
||||
|
||||
4
src/utils/toUpperCase.ts
Normal file
4
src/utils/toUpperCase.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export default function toUpperCase<T extends string>(str: T): Uppercase<T> {
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
||||
return str.toUpperCase() as Uppercase<T>;
|
||||
}
|
||||
Reference in New Issue
Block a user