Skip to content

Commit

Permalink
update queries inline with new ponder update (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
technophile-04 authored Jan 6, 2025
1 parent a733c77 commit 596375a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
6 changes: 4 additions & 2 deletions packages/nextjs/hooks/useCohortAddBuilderEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import contracts from "~~/generated/hardhat_contracts";
const BuildersQuery = gql`
query Builders($cohortAddress: String!) {
cohortBuilders(where: { cohortContractAddress: $cohortAddress }, orderBy: "timestamp", orderDirection: "desc") {
id
items {
id
}
}
}
`;
Expand All @@ -17,6 +19,6 @@ export const useAddBuilderEvents = () => {
},
});

const data = addBuilderEventsData?.cohortBuilders || [];
const data = addBuilderEventsData?.cohortBuilders.items || [];
return { data, isLoading };
};
14 changes: 8 additions & 6 deletions packages/nextjs/hooks/useCohortWithdrawEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import contracts from "~~/generated/hardhat_contracts";
const WithdrawalsQuery = gql`
query Withdrawls($cohortAddress: String!) {
cohortWithdrawals(where: { cohortContractAddress: $cohortAddress }, orderBy: "timestamp", orderDirection: "desc") {
reason
builder
amount
timestamp
id
items {
reason
builder
amount
timestamp
id
}
}
}
`;
Expand All @@ -28,7 +30,7 @@ export const useCohortWithdrawEvents = () => {
// },
// });

const newContractWithdrawEvents = newWithdrawEventsData?.cohortWithdrawals || [];
const newContractWithdrawEvents = newWithdrawEventsData?.cohortWithdrawals.items || [];
//const oldContractWithdrawEvents = oldWithdrawEventsData?.cohortWithdrawals || [];

const data = [...newContractWithdrawEvents /*, ...oldContractWithdrawEvents*/];
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import "~~/styles/globals.css";
const shareTechMono = Share_Tech_Mono({ subsets: ["latin"], weight: "400" });

const urqlClient = new Client({
url: "https://bg-ponder-indexer-production.up.railway.app/",
url: "http://localhost:42069",
exchanges: [cacheExchange, fetchExchange],
});

Expand Down
9 changes: 7 additions & 2 deletions packages/nextjs/pages/members.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,14 @@ const Members: NextPage = () => {

useEffect(() => {
if (selectedAddress) {
setFilteredEvents(allWithdrawEvents?.filter((event: any) => event.builder === selectedAddress) || []);
setFilteredEvents(
allWithdrawEvents?.filter((event: any) => {
return event.builder.toLowerCase() === selectedAddress.toLowerCase();
}) || [],
);
}
}, [selectedAddress, allWithdrawEvents]);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [selectedAddress]);

return (
<>
Expand Down

0 comments on commit 596375a

Please sign in to comment.