History Page
This example will guide you through displaying the user's purchase history.
This references our Jackpot Demo Integration Github Repo. You can find the code for the demo integration here or view the live demo here.
History Page
This is the entry point for the history page.
// /app/history/page.tsx
import { HistoryComponent } from '@/components/history-component';
export default function HistoryPage() {
return <HistoryComponent />;
}History Component
This component will display the user's purchase history.
// /app/components/history-component.tsx
'use client';
import { useAccount } from 'wagmi';
import { UserPurchaseHistory } from './history-components/user-purchase-history';
export function HistoryComponent() {
const { address, isConnected } = useAccount();
return (
<>
{isConnected && address ? (
<UserPurchaseHistory address={address} />
) : (
<div className="pb-6">
<p className="text-lg text-center text-emerald-500">
Connect wallet to view your purchase history
</p>
</div>
)}
</>
);
}User Purchase History
This component will display the user's purchase history.
API Route
This API route will fetch the user's purchase history from the contract using BaseScan's API.
Last updated