-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added frontend functions for transaction stats
- Loading branch information
1 parent
35f8266
commit e16d166
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
packages/app-explorer/src/systems/Statistics/transactions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}, | ||
); |