feat: added frontage service

This commit is contained in:
Mikhail Gladchenko
2024-03-29 08:49:00 +00:00
parent d17fed1e9e
commit 57474d2872
10 changed files with 148 additions and 3 deletions

View 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';

View File

@@ -0,0 +1 @@
export * from './search-tickers-schema';

View 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()),
}));

View File

@@ -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';