Skip to content

Commit dcfd283

Browse files
committed
use legcay endpoints
1 parent f8b3209 commit dcfd283

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

packages/round-manager/src/hooks.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,28 @@ export function useAlloIndexerClient(): Client {
2929
}, [chainId]);
3030
}
3131

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+
3248
export function useRoundMatchingFunds(
3349
roundId: string,
3450
ignoreSaturation?: boolean,
3551
overrides?: Blob
3652
) {
37-
const client = useAlloIndexerClient();
53+
const client = useLegacyAlloIndexerClient();
3854
return useSWR(
3955
[roundId, "/matches", overrides, ignoreSaturation],
4056
([roundId]) => {
@@ -44,14 +60,14 @@ export function useRoundMatchingFunds(
4460
}
4561

4662
export function useRound(roundId: string | number) {
47-
const client = useAlloIndexerClient();
63+
const client = useLegacyAlloIndexerClient();
4864
return useSWR([roundId, "/stats"], ([roundId]) => {
4965
return client.getRoundBy("id", roundId);
5066
});
5167
}
5268

5369
export function useRoundApplications(roundId: string) {
54-
const client = useAlloIndexerClient();
70+
const client = useLegacyAlloIndexerClient();
5571
return useSWR([roundId, "/applications"], ([roundId]) => {
5672
return client.getRoundApplications(roundId);
5773
});

0 commit comments

Comments
 (0)