-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: injective amino signing (#549)
* feat: dashboard through api
- Loading branch information
1 parent
fc949f1
commit 38f5213
Showing
307 changed files
with
143,968 additions
and
206 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
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,58 @@ | ||
import { useMemo } from 'react' | ||
import { useQueries } from 'react-query' | ||
|
||
import { fetchSupply } from 'libs/fetchSupply' | ||
import { debounce } from 'lodash' | ||
import { getBondingAPRsAPI } from 'services/useAPI' | ||
import { getDashboardData } from 'util/getDashboardData' | ||
|
||
export const useGetDashboardDataAPI = () => { | ||
const debouncedRefetch = useMemo(() => debounce((refetchFunc) => refetchFunc(), 500), | ||
[]) | ||
|
||
const queries = useQueries([ | ||
{ | ||
queryKey: ['WHALEsupply'], | ||
queryFn: () => fetchSupply(), | ||
refetchOnMount: 'always', | ||
refetchInterval: 180000 | ||
}, | ||
{ | ||
queryKey: ['dashBoardData'], | ||
queryFn: () => getDashboardData(), | ||
refetchOnMount: 'always', | ||
refetchInterval: 180000 | ||
}, | ||
{ | ||
queryKey: ['bondingInfos'], | ||
queryFn: () => getBondingAPRsAPI(), | ||
refetchOnMount: 'always', | ||
refetchInterval: 180000 | ||
}, | ||
]) | ||
|
||
const isLoading = useMemo(() => queries.some((query) => ( | ||
query.isLoading || (!query.data && query.data !== 0) | ||
)), | ||
[queries]) | ||
|
||
const refetchAll = () => { | ||
queries.forEach((query) => { | ||
debouncedRefetch(query.refetch) | ||
}) | ||
} | ||
|
||
const data = useMemo(() => { | ||
const supply = queries[0].data | ||
const dashboardData = queries[1].data | ||
const bondingInfos = queries[2].data | ||
|
||
return { supply, | ||
dashboardData, | ||
bondingInfos } | ||
}, [queries]) | ||
|
||
return { data, | ||
isLoading, | ||
refetch: refetchAll } | ||
} |
130 changes: 0 additions & 130 deletions
130
components/Pages/Dashboard/hooks/useGetDailyBuybacks.ts
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.