mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-04-02 11:07:59 +03:00
feat: added frontage service
This commit is contained in:
20
src/services/Frontage/index.ts
Normal file
20
src/services/Frontage/index.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { fetchWithValidation } from 'simple-typed-fetch';
|
||||
import { searchTickersSchema } from './schemas';
|
||||
|
||||
export class Frontage {
|
||||
private readonly apiUrl: string;
|
||||
|
||||
constructor(apiUrl: string) {
|
||||
this.apiUrl = apiUrl;
|
||||
|
||||
this.searchTickers = this.searchTickers.bind(this);
|
||||
}
|
||||
|
||||
searchTickers = () => {
|
||||
return fetchWithValidation(`${this.apiUrl}/api/v1/tickers/search`,
|
||||
searchTickersSchema
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
export * as schemas from './schemas/index.js';
|
||||
1
src/services/Frontage/schemas/index.ts
Normal file
1
src/services/Frontage/schemas/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './search-tickers-schema';
|
||||
9
src/services/Frontage/schemas/search-tickers-schema.ts
Normal file
9
src/services/Frontage/schemas/search-tickers-schema.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
export const searchTickersSchema = z.array(z.object({
|
||||
pair: z.string(),
|
||||
volume24: z.number(),
|
||||
change24: z.number(),
|
||||
lastPrice: z.number(),
|
||||
networks: z.array(z.string()),
|
||||
}));
|
||||
@@ -3,3 +3,4 @@ export * as blockchainService from './BlockchainService/index.js';
|
||||
export * as priceFeed from './PriceFeed/index.js';
|
||||
export * as referralSystem from './ReferralSystem/index.js';
|
||||
export * as indexer from './Indexer/index.js';
|
||||
export * as frontage from './Frontage/index.js';
|
||||
|
||||
Reference in New Issue
Block a user