Custom hooks for managing ticket purchases and user event scores in the Fan Score Protocol.
// Buy tickets from the secondary market
const { buyTicket, loading, error } = useBuyTicket();
// Usage
await buyTicket({
ticketId: "123",
buyerAddress: "0x..."
});
/ Get user's fan score for an event
const { getScore, loading, error } = useUserEventScore();
// Usage
const score = await getScore({
userId: "spotify_user_id",
eventId: "123"
});
function TicketPurchase() {
const { buyTicket, loading } = useBuyTicket();
return (
<button disabled={loading}>
{loading ? "Processing..." : "Buy Ticket"}
</button>
);
}
function ScoreDisplay() {
const { getScore, error } = useUserEventScore();
if (error) {
return <div>Error: {error}</div>;
}
return <div>Score: {score}</div>;
}