11import { useEffect , useMemo , useRef } from 'react' ;
22import { useChain } from '@interchain-kit/react' ;
3- import { defaultContext , useQuery } from '@tanstack/react-query' ;
3+ import { defaultContext } from '@tanstack/react-query' ;
44
55import { prettyGrants } from '@/utils' ;
6- import { useQueryHooks } from './useQueryHooks' ;
76import {
87 useGetGranteeGrants ,
98 useGetGranterGrants ,
@@ -13,21 +12,15 @@ export const useGrants = (chainName: string) => {
1312 const { address } = useChain ( chainName ) ;
1413 const prevAddressRef = useRef ( address ) ;
1514
16- const { rpcEndpoint, isFetching : isRpcQueryClientLoading } =
17- useQueryHooks ( chainName , {
18- context : defaultContext ,
19- } ) ;
20-
2115 const granterGrantsQuery = useGetGranterGrants ( {
2216 request : {
2317 granter : address || '' ,
2418 } ,
2519 options : {
2620 context : defaultContext ,
27- enabled : ! ! address && ! ! rpcEndpoint ,
21+ enabled : ! ! address ,
2822 select : ( data ) => data ?. grants ,
2923 } ,
30- clientResolver : rpcEndpoint ,
3124 } ) ;
3225
3326 const granteeGrantsQuery = useGetGranteeGrants ( {
@@ -36,10 +29,9 @@ export const useGrants = (chainName: string) => {
3629 } ,
3730 options : {
3831 context : defaultContext ,
39- enabled : ! ! address && ! ! rpcEndpoint ,
32+ enabled : ! ! address ,
4033 select : ( data ) => data ?. grants ,
4134 } ,
42- clientResolver : rpcEndpoint ,
4335 } ) ;
4436
4537 const dataQueries = {
@@ -71,10 +63,9 @@ export const useGrants = (chainName: string) => {
7163 ( { isRefetching } ) => isRefetching
7264 ) ;
7365
74- const isLoading =
75- isRpcQueryClientLoading || isInitialFetching || isRefetching ;
66+ const isLoading = isInitialFetching || isRefetching ;
7667
77- const isError = ! rpcEndpoint && ! isRpcQueryClientLoading ;
68+ const isError = false ;
7869
7970 type DataQueries = typeof dataQueries ;
8071
0 commit comments