Skip to content

Commit

Permalink
added frontend functions for transaction stats
Browse files Browse the repository at this point in the history
  • Loading branch information
raghukapur9 committed Sep 25, 2024
1 parent 35f8266 commit e16d166
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions packages/app-explorer/src/systems/Statistics/transactions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
'use server';

import { z } from 'zod';
import { act } from '../../systems/Core/utils/act-server';
import { sdk } from '../../systems/Core/utils/sdk';

const schema = z.object({
timeFilter: z.string().optional().nullable(),
});

export const getTransactionStats = act(schema, async ({ timeFilter }) => {
const params = { timeFilter: timeFilter } as {
timeFilter?: string;
};
const data = await sdk.transactionsStatistics(params);
return data;
});

export const getTransactionFeeStats = act(schema, async ({ timeFilter }) => {
const params = { timeFilter: timeFilter } as {
timeFilter?: string;
};
const data = await sdk.transactionFeeStatistics(params);
return data;
});

export const getCumulativeTransactionFeeStats = act(
schema,
async ({ timeFilter }) => {
const params = { timeFilter: timeFilter } as {
timeFilter?: string;
};
const data = await sdk.cumulativeFeeStatistics(params);
return data;
},
);

export const getCumulativeTransactionStats = act(
schema,
async ({ timeFilter }) => {
const params = { timeFilter: timeFilter } as {
timeFilter?: string;
};
const data = await sdk.cumulativeTransactionStatistics(params);
return data;
},
);

0 comments on commit e16d166

Please sign in to comment.