diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index 162f685..6dc656d 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -13,6 +13,7 @@ model Bounties {
title String
description String
amount String
+ amount_sort Float
issuer String
in_progress Boolean? @default(true)
is_joined_bounty Boolean? @default(false)
diff --git a/src/app/[netname]/bounty/[id]/page.tsx b/src/app/[netname]/bounty/[id]/page.tsx
index 9c063c3..dfc28b7 100644
--- a/src/app/[netname]/bounty/[id]/page.tsx
+++ b/src/app/[netname]/bounty/[id]/page.tsx
@@ -1,20 +1,50 @@
'use client';
-import * as React from 'react';
-import { ToastContainer } from 'react-toastify';
-
-import 'react-toastify/dist/ReactToastify.css';
-
+import React, { useState } from 'react';
import BountyClaims from '@/components/bounty/BountyClaims';
import BountyInfo from '@/components/bounty/BountyInfo';
import CreateClaim from '@/components/ui/CreateClaim';
import NavBarMobile from '@/components/global/NavBarMobile';
import { useScreenSize } from '@/hooks/useScreenSize';
+import { useSearchParams } from 'next/navigation';
+import { useQuery } from '@tanstack/react-query';
+import { trpc, trpcClient } from '@/trpc/client';
+import { useGetChain } from '@/hooks/useGetChain';
+import Loading from '@/components/global/Loading';
export default function Bounty({ params }: { params: { id: string } }) {
+ const chain = useGetChain();
+ const searchParams = useSearchParams();
const isMobile = useScreenSize();
+ const utils = trpc.useUtils();
+ const [status, setStatus] = useState('Indexing…');
+
+ const indexingMutation = useQuery({
+ queryKey: ['indexing'],
+ queryFn: async () => {
+ setStatus('Indexing 1s');
+ for (let i = 0; i < 60; i++) {
+ setStatus(`Indexing ${i}s`);
+ const bounty = await trpcClient.isBountyCreated.query({
+ id: Number(params.id),
+ chainId: chain.id,
+ });
+
+ if (bounty) {
+ utils.bounty.invalidate();
+ return;
+ }
+
+ await new Promise((resolve) => setTimeout(resolve, 1_000));
+ }
+
+ throw new Error('Failed to index bounty');
+ },
+ enabled: searchParams.get('indexing') === 'true',
+ });
return (
<>
+