-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: filip <[email protected]>
- Loading branch information
1 parent
9cee86a
commit e044643
Showing
13 changed files
with
339 additions
and
117 deletions.
There are no files selected for viewing
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
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,26 @@ | ||
import { aztecExplorer } from "~/service/constants"; | ||
import client, { validateResponse } from "./client"; | ||
import { z } from "zod"; | ||
|
||
export const statsL2Api = { | ||
getL2TotalTxEffects: async (): Promise<string> => { | ||
const response = await client.get(aztecExplorer.getL2TotalTxEffects); | ||
return validateResponse(z.string(), response.data); | ||
}, | ||
getL2TotalTxEffectsLast24h: async (): Promise<string> => { | ||
const response = await client.get(aztecExplorer.getL2TotalTxEffectsLast24h); | ||
return validateResponse(z.string(), response.data); | ||
}, | ||
getL2TotalContracts: async (): Promise<string> => { | ||
const response = await client.get(aztecExplorer.getL2TotalContracts); | ||
return validateResponse(z.string(), response.data); | ||
}, | ||
getL2AverageFees: async (): Promise<string> => { | ||
const response = await client.get(aztecExplorer.getL2AverageFees); | ||
return validateResponse(z.string(), response.data); | ||
}, | ||
getL2AverageBlockTime: async (): Promise<string> => { | ||
const response = await client.get(aztecExplorer.getL2AverageBlockTime); | ||
return validateResponse(z.string(), response.data); | ||
}, | ||
}; |
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
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
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
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
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,37 @@ | ||
import { type UseQueryResult, useQuery } from "@tanstack/react-query"; | ||
import { statsL2Api } from "~/api/stats"; | ||
|
||
export const useTotalTxEffects = (): UseQueryResult<string, Error> => { | ||
return useQuery<string, Error>({ | ||
queryKey: ["useTotalTxEffects"], | ||
queryFn: statsL2Api.getL2TotalTxEffects, | ||
}); | ||
}; | ||
|
||
export const useTotalTxEffectsLast24h = (): UseQueryResult<string, Error> => { | ||
return useQuery<string, Error>({ | ||
queryKey: ["useTotalTxEffectsLast24h"], | ||
queryFn: statsL2Api.getL2TotalTxEffectsLast24h, | ||
}); | ||
}; | ||
|
||
export const useTotalContracts = (): UseQueryResult<string, Error> => { | ||
return useQuery<string, Error>({ | ||
queryKey: ["useTotalContracts"], | ||
queryFn: statsL2Api.getL2TotalContracts, | ||
}); | ||
}; | ||
|
||
export const useAvarageFees = (): UseQueryResult<string, Error> => { | ||
return useQuery<string, Error>({ | ||
queryKey: ["useAvarageFees"], | ||
queryFn: statsL2Api.getL2AverageFees, | ||
}); | ||
}; | ||
|
||
export const useAvarageBlockTime = (): UseQueryResult<string, Error> => { | ||
return useQuery<string, Error>({ | ||
queryKey: ["useAvarageBlockTime"], | ||
queryFn: statsL2Api.getL2AverageBlockTime, | ||
}); | ||
}; |
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
Oops, something went wrong.