Added Orion Analytics

This commit is contained in:
Aleksandr Kraiz
2022-05-10 19:38:05 +04:00
parent 7b1467f0ce
commit fd0d6b2570
4 changed files with 31 additions and 1 deletions

View File

@@ -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",

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

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

View File

@@ -1,3 +1,4 @@
export * as orionAggregator from './OrionAggregator';
export * as orionBlockchain from './OrionBlockchain';
export * as orionAnalytics from './OrionAnalytics';
export * as priceFeed from './PriceFeed';