mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-17 08:41:38 +03:00
feat: getTickers method was updated
This commit is contained in:
@@ -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
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user