mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-15 14:42:38 +03:00
Added Orion Analytics
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@orionprotocol/sdk",
|
||||
"version": "0.5.1",
|
||||
"version": "0.5.2",
|
||||
"description": "Orion Protocol SDK",
|
||||
"main": "./lib/esm/index.js",
|
||||
"module": "./lib/esm/index.js",
|
||||
|
||||
19
src/services/OrionAnalytics/index.ts
Normal file
19
src/services/OrionAnalytics/index.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import fetchWithValidation from '../../fetchWithValidation';
|
||||
import overviewSchema from './schemas/overviewSchema';
|
||||
|
||||
export default class OrionAnalytics {
|
||||
private apiUrl: string;
|
||||
|
||||
constructor(apiUrl: string) {
|
||||
this.apiUrl = apiUrl;
|
||||
|
||||
this.getOverview = this.getOverview.bind(this);
|
||||
}
|
||||
|
||||
getOverview() {
|
||||
return fetchWithValidation(
|
||||
`https://${this.apiUrl}/api/stats/overview`,
|
||||
overviewSchema,
|
||||
);
|
||||
}
|
||||
}
|
||||
10
src/services/OrionAnalytics/schemas/overviewSchema.ts
Normal file
10
src/services/OrionAnalytics/schemas/overviewSchema.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
const overviewSchema = z.object({
|
||||
volume24h: z.number(),
|
||||
volume7d: z.number(),
|
||||
transactionCount24h: z.number(),
|
||||
transactionCount7d: z.number(),
|
||||
});
|
||||
|
||||
export default overviewSchema;
|
||||
@@ -1,3 +1,4 @@
|
||||
export * as orionAggregator from './OrionAggregator';
|
||||
export * as orionBlockchain from './OrionBlockchain';
|
||||
export * as orionAnalytics from './OrionAnalytics';
|
||||
export * as priceFeed from './PriceFeed';
|
||||
|
||||
Reference in New Issue
Block a user