mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-13 21:52:36 +03:00
feat: updated new changes from frontage
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@orionprotocol/sdk",
|
||||
"version": "0.20.79-rc7",
|
||||
"version": "0.20.79-rc8",
|
||||
"description": "Orion Protocol SDK",
|
||||
"main": "./lib/index.cjs",
|
||||
"module": "./lib/index.js",
|
||||
|
||||
@@ -10,6 +10,7 @@ export class Frontage {
|
||||
|
||||
this.searchTickers = this.searchTickers.bind(this);
|
||||
this.getTickers = this.getTickers.bind(this);
|
||||
this.getFavorites = this.getFavorites.bind(this);
|
||||
}
|
||||
|
||||
searchTickers = ({
|
||||
@@ -57,7 +58,32 @@ export class Frontage {
|
||||
].filter(Boolean).join('&');
|
||||
|
||||
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
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
export const tickersSchema = z.array(z.object({
|
||||
export const tickerSchema = z.object({
|
||||
pair: z.string(),
|
||||
volume24: z.number(),
|
||||
change24: z.number(),
|
||||
lastPrice: z.number(),
|
||||
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
|
||||
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';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user