mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-13 21:52:36 +03:00
feat: getTickers method was updated
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@orionprotocol/sdk",
|
||||
"version": "0.20.79-rc11",
|
||||
"version": "0.20.79-rc12",
|
||||
"description": "Orion Protocol SDK",
|
||||
"main": "./lib/index.cjs",
|
||||
"module": "./lib/index.js",
|
||||
|
||||
@@ -46,9 +46,10 @@ export class Frontage {
|
||||
sortType,
|
||||
offset,
|
||||
limit,
|
||||
}: { category: TickersCategories } & TickersBaseSearchParams) => {
|
||||
tickers,
|
||||
}: { category: TickersCategories, tickers?: string } & TickersBaseSearchParams) => {
|
||||
const queryParams = [
|
||||
`category=${encodeURIComponent(category)}`,
|
||||
category === 'FAVORITES' && tickers !== undefined ? `tickers=${encodeURIComponent(tickers)}` : `category=${encodeURIComponent(category)}`,
|
||||
currentNetwork !== undefined ? `¤tNetwork=${encodeURIComponent(currentNetwork).toUpperCase()}` : '',
|
||||
targetNetwork !== undefined ? `&targetNetwork=${encodeURIComponent(targetNetwork).toUpperCase()}` : '',
|
||||
sortBy !== undefined ? `&sortBy=${encodeURIComponent(sortBy)}` : '',
|
||||
@@ -57,8 +58,12 @@ export class Frontage {
|
||||
limit !== undefined ? `&limit=${limit}` : '',
|
||||
].filter(Boolean).join('&');
|
||||
|
||||
const url = category === 'FAVORITES' && tickers !== undefined
|
||||
? `${this.apiUrl}/api/v1/tickers/get/favourites?${queryParams}`
|
||||
: `${this.apiUrl}/api/v1/tickers/get/category?${queryParams}`;
|
||||
|
||||
return fetchWithValidation(
|
||||
`${this.apiUrl}/api/v1/tickers/get/category?${queryParams}`,
|
||||
url,
|
||||
tickersSchema
|
||||
);
|
||||
};
|
||||
|
||||
@@ -465,7 +465,7 @@ export type OrderSource = 'TERMINAL_MARKET' | 'TERMINAL_LIMIT' | 'SWAP_UI' | 'WI
|
||||
// Frontage
|
||||
export type NetworkCode = typeof networkCodes[number];
|
||||
|
||||
export type TickersCategories = 'USD' | 'ORN' | 'NATIVE' | 'ALTS';
|
||||
export type TickersCategories = 'FAVORITES' | 'USD' | 'ORN' | 'NATIVE' | 'ALTS';
|
||||
|
||||
export type TickersSortBy = 'PRICE' | 'CHANGE' | 'VOLUME';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user