@@ -29,12 +29,28 @@ export function useAlloIndexerClient(): Client {
29
29
} , [ chainId ] ) ;
30
30
}
31
31
32
+ // todo: remove when Huss finished the new calculator
33
+ export function useLegacyAlloIndexerClient ( ) : Client {
34
+ const { chainId } = useAccount ( ) ;
35
+
36
+ return useMemo ( ( ) => {
37
+ if ( ! chainId ) {
38
+ throw new Error ( "Chain ID is not set" ) ;
39
+ }
40
+ return new Client (
41
+ fetch . bind ( window ) ,
42
+ process . env . REACT_APP_INDEXER_V1_API_URL ?? "" ,
43
+ chainId
44
+ ) ;
45
+ } , [ chainId ] ) ;
46
+ }
47
+
32
48
export function useRoundMatchingFunds (
33
49
roundId : string ,
34
50
ignoreSaturation ?: boolean ,
35
51
overrides ?: Blob
36
52
) {
37
- const client = useAlloIndexerClient ( ) ;
53
+ const client = useLegacyAlloIndexerClient ( ) ;
38
54
return useSWR (
39
55
[ roundId , "/matches" , overrides , ignoreSaturation ] ,
40
56
( [ roundId ] ) => {
@@ -44,14 +60,14 @@ export function useRoundMatchingFunds(
44
60
}
45
61
46
62
export function useRound ( roundId : string | number ) {
47
- const client = useAlloIndexerClient ( ) ;
63
+ const client = useLegacyAlloIndexerClient ( ) ;
48
64
return useSWR ( [ roundId , "/stats" ] , ( [ roundId ] ) => {
49
65
return client . getRoundBy ( "id" , roundId ) ;
50
66
} ) ;
51
67
}
52
68
53
69
export function useRoundApplications ( roundId : string ) {
54
- const client = useAlloIndexerClient ( ) ;
70
+ const client = useLegacyAlloIndexerClient ( ) ;
55
71
return useSWR ( [ roundId , "/applications" ] , ( [ roundId ] ) => {
56
72
return client . getRoundApplications ( roundId ) ;
57
73
} ) ;
0 commit comments