mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-14 06:02:36 +03:00
feat: updated new changes from frontage
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@orionprotocol/sdk",
|
"name": "@orionprotocol/sdk",
|
||||||
"version": "0.20.79-rc7",
|
"version": "0.20.79-rc8",
|
||||||
"description": "Orion Protocol SDK",
|
"description": "Orion Protocol SDK",
|
||||||
"main": "./lib/index.cjs",
|
"main": "./lib/index.cjs",
|
||||||
"module": "./lib/index.js",
|
"module": "./lib/index.js",
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ export class Frontage {
|
|||||||
|
|
||||||
this.searchTickers = this.searchTickers.bind(this);
|
this.searchTickers = this.searchTickers.bind(this);
|
||||||
this.getTickers = this.getTickers.bind(this);
|
this.getTickers = this.getTickers.bind(this);
|
||||||
|
this.getFavorites = this.getFavorites.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
searchTickers = ({
|
searchTickers = ({
|
||||||
@@ -57,7 +58,32 @@ export class Frontage {
|
|||||||
].filter(Boolean).join('&');
|
].filter(Boolean).join('&');
|
||||||
|
|
||||||
return fetchWithValidation(
|
return fetchWithValidation(
|
||||||
`${this.apiUrl}/api/v1/tickers/get?${queryParams}`,
|
`${this.apiUrl}/api/v1/tickers/get/category?${queryParams}`,
|
||||||
|
tickersSchema
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
getFavorites = ({
|
||||||
|
tickers,
|
||||||
|
currentNetwork,
|
||||||
|
targetNetwork,
|
||||||
|
sortBy,
|
||||||
|
sortType,
|
||||||
|
offset,
|
||||||
|
limit,
|
||||||
|
}: { tickers: string } & TickersBaseSearchParams) => {
|
||||||
|
const queryParams = [
|
||||||
|
`tickers=${encodeURIComponent(tickers)}`,
|
||||||
|
currentNetwork !== undefined ? `¤tNetwork=${encodeURIComponent(currentNetwork).toUpperCase()}` : '',
|
||||||
|
targetNetwork !== undefined ? `&targetNetwork=${encodeURIComponent(targetNetwork).toUpperCase()}` : '',
|
||||||
|
sortBy !== undefined ? `&sortBy=${encodeURIComponent(sortBy)}` : '',
|
||||||
|
sortType !== undefined ? `&sortType=${encodeURIComponent(sortType)}` : '',
|
||||||
|
offset !== undefined ? `&offset=${offset}` : '',
|
||||||
|
limit !== undefined ? `&limit=${limit}` : '',
|
||||||
|
].filter(Boolean).join('&');
|
||||||
|
|
||||||
|
return fetchWithValidation(
|
||||||
|
`${this.apiUrl}/api/v1/tickers/get/favourites?${queryParams}`,
|
||||||
tickersSchema
|
tickersSchema
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
|
||||||
export const tickersSchema = z.array(z.object({
|
export const tickerSchema = z.object({
|
||||||
pair: z.string(),
|
pair: z.string(),
|
||||||
volume24: z.number(),
|
volume24: z.number(),
|
||||||
change24: z.number(),
|
change24: z.number(),
|
||||||
lastPrice: z.number(),
|
lastPrice: z.number(),
|
||||||
networks: z.array(z.string()),
|
networks: z.array(z.string()),
|
||||||
}));
|
});
|
||||||
|
|
||||||
|
export const tickersSchema = z.array(tickerSchema);
|
||||||
|
|||||||
@@ -465,7 +465,7 @@ export type OrderSource = 'TERMINAL_MARKET' | 'TERMINAL_LIMIT' | 'SWAP_UI' | 'WI
|
|||||||
// Frontage
|
// Frontage
|
||||||
export type NetworkCode = typeof networkCodes[number];
|
export type NetworkCode = typeof networkCodes[number];
|
||||||
|
|
||||||
export type TickersCategories = 'USD' | 'ORN' | 'BNB' | 'ALTS';
|
export type TickersCategories = 'USD' | 'ORN' | 'NATIVE' | 'ALTS';
|
||||||
|
|
||||||
export type TickersSortBy = 'PRICE' | 'CHANGE' | 'VOLUME';
|
export type TickersSortBy = 'PRICE' | 'CHANGE' | 'VOLUME';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user