diff --git a/src/components/bounty/BountyClaims.tsx b/src/components/bounty/BountyClaims.tsx
index 4d8ed59..aaeb2f6 100644
--- a/src/components/bounty/BountyClaims.tsx
+++ b/src/components/bounty/BountyClaims.tsx
@@ -35,6 +35,16 @@ export default function BountyClaims({ bountyId }: { bountyId: string }) {
}
);
+ const bountyClaimsCount = trpc.bountyClaimsCount.useQuery(
+ {
+ bountyId: Number(bountyId),
+ chainId: chain.id,
+ },
+ {
+ enabled: !!bountyId,
+ }
+ );
+
const { data: votingClaim } = trpc.claim.useQuery(
{
claimId: Number(votingClaimId),
@@ -63,13 +73,7 @@ export default function BountyClaims({ bountyId }: { bountyId: string }) {
-
- {claims.data?.pages.reduce(
- (acc, curr) => acc + curr.items.length,
- 0
- )}{' '}
- claims
-
+ {Number(bountyClaimsCount.data) || 0} claims
{claims.data && (
diff --git a/src/trpc/routers/_app.ts b/src/trpc/routers/_app.ts
index b4d7f1b..3249bd6 100644
--- a/src/trpc/routers/_app.ts
+++ b/src/trpc/routers/_app.ts
@@ -179,6 +179,25 @@ export const appRouter = createTRPCRouter({
};
}),
+ bountyClaimsCount: baseProcedure
+ .input(
+ z.object({
+ bountyId: z.number(),
+ chainId: z.number(),
+ })
+ )
+ .query(async ({ input }) => {
+ return await prisma.claims.count({
+ where: {
+ bounty_id: input.bountyId,
+ chain_id: input.chainId,
+ ban: {
+ none: {},
+ },
+ },
+ });
+ }),
+
claim: baseProcedure
.input(z.object({ claimId: z.number(), chainId: z.number() }))
.query(async ({ input }) => {