Loading lottery history...
;
+ }
+
+ if (error) {
+ return (
+
+
Lottery History
+ {history.length === 0 ? (
+
No past lottery rounds
+ ) : (
+
+
+
+ | Round |
+ Date |
+ Pot Size |
+ Winner |
+ Participants |
+
+
+
+ {history.map((round) => (
+
+ | {round.id} |
+ {new Date(round.timestamp * 1000).toLocaleString()} |
+ {round.potSize} ETH |
+ {round.winner} |
+ {round.participants} |
+
+ ))}
+
+
+ )}
+
+ );
+};
\ No newline at end of file
diff --git a/src/hooks/useLotteryContract.ts b/src/hooks/useLotteryContract.ts
new file mode 100644
index 0000000..7c30a25
--- /dev/null
+++ b/src/hooks/useLotteryContract.ts
@@ -0,0 +1,24 @@
+import { useState, useEffect } from 'react';
+
+export const useLotteryContract = () => {
+ const [contract, setContract] = useState(null);
+
+ useEffect(() => {
+ // Mock contract initialization logic
+ const mockContract = {
+ getPastRounds: async () => [
+ {
+ id: { toNumber: () => 1 },
+ timestamp: { toNumber: () => 1625097600 },
+ potSize: { toString: () => '5' },
+ winner: '0x123456789',
+ participants: { toNumber: () => 10 }
+ }
+ ]
+ };
+
+ setContract(mockContract as any);
+ }, []);
+
+ return { contract };
+};
\ No newline at end of file
diff --git a/src/pages/index.tsx b/src/pages/index.tsx
new file mode 100644
index 0000000..3d772a0
--- /dev/null
+++ b/src/pages/index.tsx
@@ -0,0 +1,21 @@
+import React from 'react';
+import { LotteryForm } from '../components/lottery/LotteryForm';
+import { LotteryHistoryView } from '../components/lottery/LotteryHistoryView';
+
+const LotteryPage: React.FC = () => {
+ return (
+