Reward Kit is still in early alpha, and may contain bugs or unexpected behavior.
The Boost V2 Docs are under active development and will be subject to changes.
A React Query hook that fetches signature data required for claiming incentives from a boost. The hook manages the API request to get authorized signatures for claiming.
import { useClaimSignatures } from '@boostxyz/reward-kit-react';function ClaimSignaturesWithErrorHandling() { const { data: signatures, isPending, error, refetch } = useClaimSignatures({ boostId: "1:0x123...789:0", address: "0xabc...def", incentiveId: 0 }); // Handle different states if (isPending) { return <div>Fetching signatures...</div>; } if (error) { return ( <div> <p>Error fetching signatures: {error.message}</p> <button onClick={() => refetch()}> Retry </button> </div> ); } if (!signatures?.length) { return <div>No signatures available for claiming</div>; } return ( <div> <h3>Valid Signatures Found</h3> <ul> {signatures.map((sig, index) => ( <li key={index}> Signature {index + 1} for {sig.claimant} </li> ))} </ul> </div> );}
The hook automatically caches results and revalidates data every 10 seconds (configured via staleTime). It only fetches data when both address and boostId are provided, as controlled by the enabled option.