@wkalidev/trivia-quest-sdk 1.1.0 โ†’ 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,127 +1,88 @@
1
- # Trivia Q ๐ŸŽฎ
1
+ # @wkalidev/trivia-quest-sdk
2
2
 
3
- > Play. Learn. Earn on Celo.
3
+ > Official SDK for TriviaQ โ€” Blockchain quiz game on Celo Network
4
4
 
5
- Trivia Q is a blockchain-powered quiz game built on Celo where players earn real CELO rewards by answering questions about African culture, geography, Web3, science, sports, and general knowledge.
5
+ [![npm version](https://badge.fury.io/js/%40wkalidev%2Ftrivia-quest-sdk.svg)](https://www.npmjs.com/package/@wkalidev/trivia-quest-sdk)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
7
 
7
- ## ๐ŸŒ Why Africa?
8
+ ## Installation
8
9
 
9
- Celo's mission is financial inclusion for the unbanked. With 57% of African adults lacking bank accounts but owning smartphones, MiniPay is the perfect gateway. Trivia Q brings fun, education, and real micro-rewards to this audience.
10
-
11
- ## ๐Ÿš€ Live Demo
12
-
13
- ๐Ÿ‘‰ [trivia-quest-eight.vercel.app](https://trivia-quest-eight.vercel.app)
14
-
15
- ## ๐ŸŽฎ Game Features
16
-
17
- - โœ… 446 questions dans 6 catรฉgories
18
- - โœ… 10 questions alรฉatoires par partie
19
- - โœ… Timer de 15 secondes par question
20
- - โœ… Systรจme de Streak x2 / x3 multiplicateur de points
21
- - โœ… Animations Framer Motion
22
- - โœ… Sons & feedback audio (๐Ÿ”Š/๐Ÿ”‡ toggle)
23
- - โœ… Leaderboard on-chain en temps rรฉel
24
- - โœ… Support 4 langues : ๐Ÿ‡ซ๐Ÿ‡ท FR / ๐Ÿ‡ฌ๐Ÿ‡ง EN / ๐Ÿ‡ช๐Ÿ‡ธ ES / ๐Ÿ‡ฎ๐Ÿ‡น IT
25
- - โœ… MiniPay compatible (dรฉtection automatique)
26
- - โœ… PWA installable sur Android
27
-
28
- ## ๐Ÿ“š Question Categories
29
-
30
- | Catรฉgorie | Nb questions |
31
- |---|---|
32
- | ๐ŸŒ Gรฉographie Africaine | ~80 |
33
- | ๐Ÿ’ฐ Web3 & Crypto | ~100 |
34
- | ๐Ÿ“– Histoire & Culture | ~60 |
35
- | ๐Ÿ”ฌ Science & Tech | ~80 |
36
- | โšฝ Sports | ~40 |
37
- | ๐ŸŒ Culture Gรฉnรฉrale | ~86 |
38
-
39
- ## ๐Ÿ—๏ธ Architecture
40
-
41
- - **Smart Contract** โ€” Solidity 0.8.20 + OpenZeppelin sur Celo Mainnet
42
- - **Frontend** โ€” Next.js 16 + TypeScript + TailwindCSS
43
- - **Animations** โ€” Framer Motion
44
- - **Wallet** โ€” RainbowKit + Wagmi + Viem + MiniPay hook
45
- - **i18n** โ€” next-intl (FR, EN, ES, IT)
46
- - **Deploy** โ€” Vercel
47
-
48
- ## ๐Ÿ”— Smart Contracts
49
-
50
- | Network | Address |
51
- |---|---|
52
- | Celo Mainnet v4 | `0xe7faded5157341911a99cae5c49ad4c1eeb1116a` |
53
- | Celo Sepolia (testnet) | `0x50b20728ba0ad803679b5428f267c89aede9a378` |
54
-
55
- ## ๐Ÿ“ฑ MiniPay Compatible
56
-
57
- Trivia Q detects MiniPay automatically and connects the wallet without any popup โ€” seamless UX for mobile users in Africa.
58
-
59
- ## ๐Ÿ”ฅ Streak System
60
-
61
- | Streak | Multiplicateur | Points par bonne rรฉponse |
62
- |---|---|---|
63
- | 0-2 | x1 | 100 pts |
64
- | 3-4 | x2 ๐Ÿ”ฅ๐Ÿ”ฅ | 200 pts |
65
- | 5+ | x3 ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ | 300 pts |
66
-
67
- ## ๐Ÿ† Leaderboard On-Chain
68
-
69
- Le leaderboard est stockรฉ directement sur la blockchain Celo. Chaque joueur accumule des points, et les 10 meilleurs sont affichรฉs en temps rรฉel.
10
+ ```bash
11
+ npm install @wkalidev/trivia-quest-sdk
12
+ # or
13
+ yarn add @wkalidev/trivia-quest-sdk
14
+ ```
70
15
 
71
- ## ๐Ÿ† Prize Distribution (Multi-Winner)
16
+ ## Contracts (Celo Mainnet)
72
17
 
73
- | Position | Share |
18
+ | Contract | Address |
74
19
  |---|---|
75
- | ๐Ÿฅ‡ 1st place | 50% |
76
- | ๐Ÿฅˆ 2nd place | 30% |
77
- | ๐Ÿฅ‰ 3rd place | 20% |
20
+ | TriviaQToken ($TRIVQ) | `0xe65fc5cacaf9a5aebbc0e151dee08a53f24a05c5` |
21
+ | TriviaQuest | `0xffe22d3d1b63866ac9da8ac92fdb9ceddeadb0bb` |
22
+ | DailyCheckIn (ERC-1155) | `0x8650e6c477f8ae3933dc6d61d85e65c90cf71828` |
23
+ | Referral | `0xa0fcd85a25ecb71ca1ea9d63da058c832c27c62e` |
24
+
25
+ ## Usage
26
+
27
+ ```typescript
28
+ import {
29
+ TRIVQ_TOKEN_ADDRESS,
30
+ TRIVIA_QUEST_ADDRESS,
31
+ DAILY_CHECKIN_ADDRESS,
32
+ REFERRAL_ADDRESS,
33
+ TRIVQ_ABI,
34
+ TRIVIA_QUEST_ABI,
35
+ DAILY_CHECKIN_ABI,
36
+ REFERRAL_ABI,
37
+ CELO_CHAIN_ID,
38
+ } from "@wkalidev/trivia-quest-sdk";
39
+
40
+ // Use with viem
41
+ import { createPublicClient, http } from "viem";
42
+ import { celo } from "viem/chains";
43
+
44
+ const client = createPublicClient({
45
+ chain: celo,
46
+ transport: http(),
47
+ });
48
+
49
+ // Read prize pool
50
+ const round = await client.readContract({
51
+ address: TRIVIA_QUEST_ADDRESS,
52
+ abi: TRIVIA_QUEST_ABI,
53
+ functionName: "getCurrentRound",
54
+ });
55
+
56
+ // Read TRIVQ balance
57
+ const balance = await client.readContract({
58
+ address: TRIVQ_TOKEN_ADDRESS,
59
+ abi: TRIVQ_ABI,
60
+ functionName: "balanceOf",
61
+ args: ["0xYOUR_ADDRESS"],
62
+ });
63
+
64
+ // Check daily check-in status
65
+ const playerData = await client.readContract({
66
+ address: DAILY_CHECKIN_ADDRESS,
67
+ abi: DAILY_CHECKIN_ABI,
68
+ functionName: "getPlayerData",
69
+ args: ["0xYOUR_ADDRESS"],
70
+ });
71
+ ```
78
72
 
79
- ## ๐ŸŒ Multi-Language Support
73
+ ## Reward Rates
80
74
 
81
- | Language | Code |
75
+ | Action | Reward |
82
76
  |---|---|
83
- | ๐Ÿ‡ซ๐Ÿ‡ท Franรงais | fr |
84
- | ๐Ÿ‡ฌ๐Ÿ‡ง English | en |
85
- | ๐Ÿ‡ช๐Ÿ‡ธ Espaรฑol | es |
86
- | ๐Ÿ‡ฎ๐Ÿ‡น Italiano | it |
87
-
88
- ## ๐Ÿ› ๏ธ Local Setup
89
- ```bash
90
- # Clone
91
- git clone https://github.com/wkalidev/trivia-quest.git
92
- cd trivia-quest
93
-
94
- # Frontend
95
- cd frontend
96
- yarn install
97
- yarn dev
98
-
99
- # Contracts
100
- cd ../contracts
101
- npm install
102
- npx hardhat compile
103
- ```
77
+ | ๐ŸŽฎ Per point scored | 100 TRIVQ |
78
+ | ๐Ÿ”ฅ Daily check-in | 100 TRIVQ |
79
+ | ๐ŸŽ 7-day streak bonus | 2,000 TRIVQ |
80
+ | ๐Ÿ”— Referral reward | 500 TRIVQ |
104
81
 
105
- ## ๐ŸŽฏ Proof of Ship Checklist
82
+ ## Live Demo
106
83
 
107
- - โœ… Build For MiniPay โ€” MiniPay hook integrated
108
- - โœ… Deploy On Celo โ€” Smart contract on Celo Mainnet
109
- - โœ… Prove Your Humanity โ€” Coinbase Verification
110
- - โœ… Submit Your Project
84
+ ๐Ÿ‘‰ [trivia-quest-eight.vercel.app](https://trivia-quest-eight.vercel.app)
111
85
 
112
- ## ๐Ÿ“‹ Tech Stack
86
+ ## Author
113
87
 
114
- | Layer | Tech |
115
- |---|---|
116
- | Blockchain | Celo Mainnet |
117
- | Smart Contract | Solidity 0.8.20 + OpenZeppelin |
118
- | Frontend | Next.js 16 + TypeScript |
119
- | Styling | TailwindCSS |
120
- | Animations | Framer Motion |
121
- | Web3 | Wagmi + Viem + RainbowKit |
122
- | i18n | next-intl |
123
- | Deploy | Vercel |
124
-
125
- ## ๐Ÿ‘ค Author
126
-
127
- Built by [@wkalidev](https://github.com/wkalidev) for Celo Proof of Ship โ€” April 2026
88
+ Built with ๐Ÿ’™ by [@wkalidev](https://github.com/wkalidev)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wkalidev/trivia-quest-sdk",
3
- "version": "1.1.0",
4
- "description": "SDK for TriviaQuest - Blockchain quiz game on Celo",
3
+ "version": "1.3.0",
4
+ "description": "TriviaQ SDK โ€” Interact with TriviaQ smart - Blockchain quiz game on Celo",
5
5
  "main": "sdk/index.js",
6
6
  "types": "sdk/index.d.ts",
7
7
  "files": [
@@ -23,7 +23,7 @@
23
23
  "license": "MIT",
24
24
  "repository": {
25
25
  "type": "git",
26
- "url": "https://github.com/wkalidev/trivia-quest.git"
26
+ "url": "git+https://github.com/wkalidev/trivia-quest.git"
27
27
  },
28
28
  "homepage": "https://trivia-quest-eight.vercel.app",
29
29
  "peerDependencies": {
package/sdk/index.d.ts CHANGED
@@ -1,45 +1,69 @@
1
- export declare const CONTRACT_ADDRESS_MAINNET: "0xe7faded5157341911a99cae5c49ad4c1eeb1116a";
2
- export declare const CONTRACT_ADDRESS_TESTNET: "0x50b20728ba0ad803679b5428f267c89aede9a378";
3
- export declare const CONTRACT_ABI: readonly [{
4
- readonly name: "joinRound";
1
+ export declare const TRIVQ_TOKEN_ADDRESS: "0xe65fc5cacaf9a5aebbc0e151dee08a53f24a05c5";
2
+ export declare const TRIVIA_QUEST_ADDRESS: "0xffe22d3d1b63866ac9da8ac92fdb9ceddeadb0bb";
3
+ export declare const DAILY_CHECKIN_ADDRESS: "0x8650e6c477f8ae3933dc6d61d85e65c90cf71828";
4
+ export declare const REFERRAL_ADDRESS: "0xa0fcd85a25ecb71ca1ea9d63da058c832c27c62e";
5
+ export declare const TRIVQ_ABI: readonly [{
6
+ readonly name: "balanceOf";
5
7
  readonly type: "function";
6
- readonly stateMutability: "payable";
7
- readonly inputs: readonly [];
8
+ readonly stateMutability: "view";
9
+ readonly inputs: readonly [{
10
+ readonly name: "account";
11
+ readonly type: "address";
12
+ }];
13
+ readonly outputs: readonly [{
14
+ readonly name: "";
15
+ readonly type: "uint256";
16
+ }];
17
+ }, {
18
+ readonly name: "mintReward";
19
+ readonly type: "function";
20
+ readonly stateMutability: "nonpayable";
21
+ readonly inputs: readonly [{
22
+ readonly name: "player";
23
+ readonly type: "address";
24
+ }, {
25
+ readonly name: "amount";
26
+ readonly type: "uint256";
27
+ }];
8
28
  readonly outputs: readonly [];
9
29
  }, {
10
- readonly name: "getCurrentRound";
30
+ readonly name: "rewardsRemaining";
11
31
  readonly type: "function";
12
32
  readonly stateMutability: "view";
13
33
  readonly inputs: readonly [];
14
34
  readonly outputs: readonly [{
15
- readonly type: "tuple";
16
- readonly components: readonly [{
17
- readonly name: "id";
18
- readonly type: "uint256";
19
- }, {
20
- readonly name: "prizePool";
21
- readonly type: "uint256";
22
- }, {
23
- readonly name: "startTime";
24
- readonly type: "uint256";
25
- }, {
26
- readonly name: "endTime";
27
- readonly type: "uint256";
28
- }, {
29
- readonly name: "winner";
30
- readonly type: "address";
31
- }, {
32
- readonly name: "finished";
33
- readonly type: "bool";
34
- }];
35
+ readonly type: "uint256";
35
36
  }];
37
+ }];
38
+ export declare const TRIVIA_QUEST_ABI: readonly [{
39
+ readonly name: "joinRound";
40
+ readonly type: "function";
41
+ readonly stateMutability: "payable";
42
+ readonly inputs: readonly [];
43
+ readonly outputs: readonly [];
36
44
  }, {
37
- readonly name: "entryFee";
45
+ readonly name: "getCurrentRound";
38
46
  readonly type: "function";
39
47
  readonly stateMutability: "view";
40
48
  readonly inputs: readonly [];
41
49
  readonly outputs: readonly [{
50
+ readonly name: "id";
51
+ readonly type: "uint256";
52
+ }, {
53
+ readonly name: "prizePool";
54
+ readonly type: "uint256";
55
+ }, {
56
+ readonly name: "startTime";
42
57
  readonly type: "uint256";
58
+ }, {
59
+ readonly name: "endTime";
60
+ readonly type: "uint256";
61
+ }, {
62
+ readonly name: "topWinners";
63
+ readonly type: "address[]";
64
+ }, {
65
+ readonly name: "finished";
66
+ readonly type: "bool";
43
67
  }];
44
68
  }, {
45
69
  readonly name: "getLeaderboard";
@@ -63,99 +87,101 @@ export declare const CONTRACT_ABI: readonly [{
63
87
  }];
64
88
  }];
65
89
  }, {
66
- readonly name: "getPlayerStats";
90
+ readonly name: "getTotalPlayers";
67
91
  readonly type: "function";
68
92
  readonly stateMutability: "view";
69
- readonly inputs: readonly [{
70
- readonly name: "player";
71
- readonly type: "address";
72
- }];
93
+ readonly inputs: readonly [];
73
94
  readonly outputs: readonly [{
74
- readonly type: "tuple";
75
- readonly components: readonly [{
76
- readonly name: "score";
77
- readonly type: "uint256";
78
- }, {
79
- readonly name: "totalWinnings";
80
- readonly type: "uint256";
81
- }, {
82
- readonly name: "totalPoints";
83
- readonly type: "uint256";
84
- }, {
85
- readonly name: "gamesPlayed";
86
- readonly type: "uint256";
87
- }, {
88
- readonly name: "bestScore";
89
- readonly type: "uint256";
90
- }, {
91
- readonly name: "exists";
92
- readonly type: "bool";
93
- }];
95
+ readonly type: "uint256";
94
96
  }];
95
97
  }, {
96
- readonly name: "getTotalPlayers";
98
+ readonly name: "entryFee";
97
99
  readonly type: "function";
98
100
  readonly stateMutability: "view";
99
101
  readonly inputs: readonly [];
100
102
  readonly outputs: readonly [{
101
103
  readonly type: "uint256";
102
104
  }];
103
- }, {
104
- readonly name: "submitScore";
105
+ }];
106
+ export declare const DAILY_CHECKIN_ABI: readonly [{
107
+ readonly name: "checkIn";
105
108
  readonly type: "function";
106
109
  readonly stateMutability: "nonpayable";
110
+ readonly inputs: readonly [{
111
+ readonly name: "categoryId";
112
+ readonly type: "uint256";
113
+ }];
114
+ readonly outputs: readonly [];
115
+ }, {
116
+ readonly name: "getPlayerData";
117
+ readonly type: "function";
118
+ readonly stateMutability: "view";
107
119
  readonly inputs: readonly [{
108
120
  readonly name: "player";
109
121
  readonly type: "address";
122
+ }];
123
+ readonly outputs: readonly [{
124
+ readonly name: "lastCheckIn";
125
+ readonly type: "uint256";
110
126
  }, {
111
- readonly name: "score";
127
+ readonly name: "streak";
112
128
  readonly type: "uint256";
113
129
  }, {
114
- readonly name: "points";
130
+ readonly name: "totalCheckIns";
131
+ readonly type: "uint256";
132
+ }, {
133
+ readonly name: "checkInAvailable";
134
+ readonly type: "bool";
135
+ }, {
136
+ readonly name: "secondsUntilNext";
115
137
  readonly type: "uint256";
116
138
  }];
139
+ }, {
140
+ readonly name: "isCheckInAvailable";
141
+ readonly type: "function";
142
+ readonly stateMutability: "view";
143
+ readonly inputs: readonly [{
144
+ readonly name: "player";
145
+ readonly type: "address";
146
+ }];
147
+ readonly outputs: readonly [{
148
+ readonly type: "bool";
149
+ }];
150
+ }];
151
+ export declare const REFERRAL_ABI: readonly [{
152
+ readonly name: "registerReferral";
153
+ readonly type: "function";
154
+ readonly stateMutability: "nonpayable";
155
+ readonly inputs: readonly [{
156
+ readonly name: "referrer";
157
+ readonly type: "address";
158
+ }];
117
159
  readonly outputs: readonly [];
160
+ }, {
161
+ readonly name: "getReferralStats";
162
+ readonly type: "function";
163
+ readonly stateMutability: "view";
164
+ readonly inputs: readonly [{
165
+ readonly name: "user";
166
+ readonly type: "address";
167
+ }];
168
+ readonly outputs: readonly [{
169
+ readonly name: "refs";
170
+ readonly type: "uint256";
171
+ }, {
172
+ readonly name: "earned";
173
+ readonly type: "uint256";
174
+ }, {
175
+ readonly name: "referred";
176
+ readonly type: "bool";
177
+ }, {
178
+ readonly name: "referrer";
179
+ readonly type: "address";
180
+ }];
118
181
  }];
119
- export type LeaderboardEntry = {
120
- player: string;
121
- totalPoints: bigint;
122
- bestScore: bigint;
123
- gamesPlayed: bigint;
124
- };
125
- export type PlayerStats = {
126
- score: bigint;
127
- totalWinnings: bigint;
128
- totalPoints: bigint;
129
- gamesPlayed: bigint;
130
- bestScore: bigint;
131
- exists: boolean;
132
- };
133
- export type Round = {
134
- id: bigint;
135
- prizePool: bigint;
136
- startTime: bigint;
137
- endTime: bigint;
138
- winner: string;
139
- finished: boolean;
140
- };
141
- export declare function isMiniPay(): boolean;
142
- export declare function getMiniPayAccount(): Promise<string | null>;
143
- export declare function getMultiplier(streak: number): number;
144
- export declare function calculatePoints(correct: boolean, streak: number): number;
145
- export declare function getStreakLabel(streak: number): string;
146
- export declare const CELO_MAINNET: {
147
- id: number;
148
- name: string;
149
- rpcUrl: string;
150
- explorerUrl: string;
151
- contractAddress: "0xe7faded5157341911a99cae5c49ad4c1eeb1116a";
152
- };
153
- export declare const CELO_TESTNET: {
154
- id: number;
155
- name: string;
156
- rpcUrl: string;
157
- explorerUrl: string;
158
- contractAddress: "0x50b20728ba0ad803679b5428f267c89aede9a378";
159
- };
160
- export declare const SDK_VERSION = "1.0.0";
161
- //# sourceMappingURL=index.d.ts.map
182
+ export declare const CELO_CHAIN_ID = 42220;
183
+ export declare const CELO_RPC = "https://forno.celo.org";
184
+ export declare const DAILY_REWARD_TRIVQ = 100;
185
+ export declare const WEEK_BONUS_TRIVQ = 2000;
186
+ export declare const REFERRAL_REWARD_TRIVQ = 500;
187
+ export declare const TRIVQ_PER_POINT = 100;
package/sdk/index.js CHANGED
@@ -1,16 +1,37 @@
1
1
  "use strict";
2
- // TriviaQuest SDK
3
- // Blockchain quiz game on Celo
4
2
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.SDK_VERSION = exports.CELO_TESTNET = exports.CELO_MAINNET = exports.CONTRACT_ABI = exports.CONTRACT_ADDRESS_TESTNET = exports.CONTRACT_ADDRESS_MAINNET = void 0;
6
- exports.isMiniPay = isMiniPay;
7
- exports.getMiniPayAccount = getMiniPayAccount;
8
- exports.getMultiplier = getMultiplier;
9
- exports.calculatePoints = calculatePoints;
10
- exports.getStreakLabel = getStreakLabel;
11
- exports.CONTRACT_ADDRESS_MAINNET = "0xe7faded5157341911a99cae5c49ad4c1eeb1116a";
12
- exports.CONTRACT_ADDRESS_TESTNET = "0x50b20728ba0ad803679b5428f267c89aede9a378";
13
- exports.CONTRACT_ABI = [
3
+ exports.TRIVQ_PER_POINT = exports.REFERRAL_REWARD_TRIVQ = exports.WEEK_BONUS_TRIVQ = exports.DAILY_REWARD_TRIVQ = exports.CELO_RPC = exports.CELO_CHAIN_ID = exports.REFERRAL_ABI = exports.DAILY_CHECKIN_ABI = exports.TRIVIA_QUEST_ABI = exports.TRIVQ_ABI = exports.REFERRAL_ADDRESS = exports.DAILY_CHECKIN_ADDRESS = exports.TRIVIA_QUEST_ADDRESS = exports.TRIVQ_TOKEN_ADDRESS = void 0;
4
+ exports.TRIVQ_TOKEN_ADDRESS = "0xe65fc5cacaf9a5aebbc0e151dee08a53f24a05c5";
5
+ exports.TRIVIA_QUEST_ADDRESS = "0xffe22d3d1b63866ac9da8ac92fdb9ceddeadb0bb";
6
+ exports.DAILY_CHECKIN_ADDRESS = "0x8650e6c477f8ae3933dc6d61d85e65c90cf71828";
7
+ exports.REFERRAL_ADDRESS = "0xa0fcd85a25ecb71ca1ea9d63da058c832c27c62e";
8
+ exports.TRIVQ_ABI = [
9
+ {
10
+ name: "balanceOf",
11
+ type: "function",
12
+ stateMutability: "view",
13
+ inputs: [{ name: "account", type: "address" }],
14
+ outputs: [{ name: "", type: "uint256" }],
15
+ },
16
+ {
17
+ name: "mintReward",
18
+ type: "function",
19
+ stateMutability: "nonpayable",
20
+ inputs: [
21
+ { name: "player", type: "address" },
22
+ { name: "amount", type: "uint256" },
23
+ ],
24
+ outputs: [],
25
+ },
26
+ {
27
+ name: "rewardsRemaining",
28
+ type: "function",
29
+ stateMutability: "view",
30
+ inputs: [],
31
+ outputs: [{ type: "uint256" }],
32
+ },
33
+ ];
34
+ exports.TRIVIA_QUEST_ABI = [
14
35
  {
15
36
  name: "joinRound",
16
37
  type: "function",
@@ -24,26 +45,14 @@ exports.CONTRACT_ABI = [
24
45
  stateMutability: "view",
25
46
  inputs: [],
26
47
  outputs: [
27
- {
28
- type: "tuple",
29
- components: [
30
- { name: "id", type: "uint256" },
31
- { name: "prizePool", type: "uint256" },
32
- { name: "startTime", type: "uint256" },
33
- { name: "endTime", type: "uint256" },
34
- { name: "winner", type: "address" },
35
- { name: "finished", type: "bool" },
36
- ],
37
- },
48
+ { name: "id", type: "uint256" },
49
+ { name: "prizePool", type: "uint256" },
50
+ { name: "startTime", type: "uint256" },
51
+ { name: "endTime", type: "uint256" },
52
+ { name: "topWinners", type: "address[]" },
53
+ { name: "finished", type: "bool" },
38
54
  ],
39
55
  },
40
- {
41
- name: "entryFee",
42
- type: "function",
43
- stateMutability: "view",
44
- inputs: [],
45
- outputs: [{ type: "uint256" }],
46
- },
47
56
  {
48
57
  name: "getLeaderboard",
49
58
  type: "function",
@@ -62,99 +71,75 @@ exports.CONTRACT_ABI = [
62
71
  ],
63
72
  },
64
73
  {
65
- name: "getPlayerStats",
74
+ name: "getTotalPlayers",
66
75
  type: "function",
67
76
  stateMutability: "view",
68
- inputs: [{ name: "player", type: "address" }],
69
- outputs: [
70
- {
71
- type: "tuple",
72
- components: [
73
- { name: "score", type: "uint256" },
74
- { name: "totalWinnings", type: "uint256" },
75
- { name: "totalPoints", type: "uint256" },
76
- { name: "gamesPlayed", type: "uint256" },
77
- { name: "bestScore", type: "uint256" },
78
- { name: "exists", type: "bool" },
79
- ],
80
- },
81
- ],
77
+ inputs: [],
78
+ outputs: [{ type: "uint256" }],
82
79
  },
83
80
  {
84
- name: "getTotalPlayers",
81
+ name: "entryFee",
85
82
  type: "function",
86
83
  stateMutability: "view",
87
84
  inputs: [],
88
85
  outputs: [{ type: "uint256" }],
89
86
  },
87
+ ];
88
+ exports.DAILY_CHECKIN_ABI = [
90
89
  {
91
- name: "submitScore",
90
+ name: "checkIn",
92
91
  type: "function",
93
92
  stateMutability: "nonpayable",
94
- inputs: [
95
- { name: "player", type: "address" },
96
- { name: "score", type: "uint256" },
97
- { name: "points", type: "uint256" },
93
+ inputs: [{ name: "categoryId", type: "uint256" }],
94
+ outputs: [],
95
+ },
96
+ {
97
+ name: "getPlayerData",
98
+ type: "function",
99
+ stateMutability: "view",
100
+ inputs: [{ name: "player", type: "address" }],
101
+ outputs: [
102
+ { name: "lastCheckIn", type: "uint256" },
103
+ { name: "streak", type: "uint256" },
104
+ { name: "totalCheckIns", type: "uint256" },
105
+ { name: "checkInAvailable", type: "bool" },
106
+ { name: "secondsUntilNext", type: "uint256" },
98
107
  ],
108
+ },
109
+ {
110
+ name: "isCheckInAvailable",
111
+ type: "function",
112
+ stateMutability: "view",
113
+ inputs: [{ name: "player", type: "address" }],
114
+ outputs: [{ type: "bool" }],
115
+ },
116
+ ];
117
+ exports.REFERRAL_ABI = [
118
+ {
119
+ name: "registerReferral",
120
+ type: "function",
121
+ stateMutability: "nonpayable",
122
+ inputs: [{ name: "referrer", type: "address" }],
99
123
  outputs: [],
100
124
  },
125
+ {
126
+ name: "getReferralStats",
127
+ type: "function",
128
+ stateMutability: "view",
129
+ inputs: [{ name: "user", type: "address" }],
130
+ outputs: [
131
+ { name: "refs", type: "uint256" },
132
+ { name: "earned", type: "uint256" },
133
+ { name: "referred", type: "bool" },
134
+ { name: "referrer", type: "address" },
135
+ ],
136
+ },
101
137
  ];
102
- // โ”€โ”€ MiniPay Utils โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
103
- function isMiniPay() {
104
- if (typeof window === "undefined")
105
- return false;
106
- return window.navigator.userAgent.includes("MiniPay");
107
- }
108
- async function getMiniPayAccount() {
109
- if (!isMiniPay())
110
- return null;
111
- try {
112
- const ethereum = window.ethereum;
113
- if (!ethereum)
114
- return null;
115
- const accounts = await ethereum.request({ method: "eth_requestAccounts" });
116
- return accounts[0] ?? null;
117
- }
118
- catch {
119
- return null;
120
- }
121
- }
122
- // โ”€โ”€ Score Utils โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
123
- function getMultiplier(streak) {
124
- if (streak >= 5)
125
- return 3;
126
- if (streak >= 3)
127
- return 2;
128
- return 1;
129
- }
130
- function calculatePoints(correct, streak) {
131
- if (!correct)
132
- return 0;
133
- return 100 * getMultiplier(streak + 1);
134
- }
135
- function getStreakLabel(streak) {
136
- if (streak >= 5)
137
- return "๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ x3 MEGA";
138
- if (streak >= 3)
139
- return "๐Ÿ”ฅ๐Ÿ”ฅ x2 HOT";
140
- if (streak >= 1)
141
- return "๐Ÿ”ฅ Streak";
142
- return "";
143
- }
144
- // โ”€โ”€ Network Config โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
145
- exports.CELO_MAINNET = {
146
- id: 42220,
147
- name: "Celo Mainnet",
148
- rpcUrl: "https://forno.celo.org",
149
- explorerUrl: "https://celoscan.io",
150
- contractAddress: exports.CONTRACT_ADDRESS_MAINNET,
151
- };
152
- exports.CELO_TESTNET = {
153
- id: 11142220,
154
- name: "Celo Sepolia",
155
- rpcUrl: "https://forno.celo-sepolia.celo-testnet.org",
156
- explorerUrl: "https://sepolia.celoscan.io",
157
- contractAddress: exports.CONTRACT_ADDRESS_TESTNET,
158
- };
159
- exports.SDK_VERSION = "1.0.0";
160
- //# sourceMappingURL=index.js.map
138
+ // Chain info
139
+ exports.CELO_CHAIN_ID = 42220;
140
+ exports.CELO_RPC = "https://forno.celo.org";
141
+ // Reward rates
142
+ exports.DAILY_REWARD_TRIVQ = 100;
143
+ exports.WEEK_BONUS_TRIVQ = 2000;
144
+ exports.REFERRAL_REWARD_TRIVQ = 500;
145
+ exports.TRIVQ_PER_POINT = 100;
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../sdk-src/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,wBAAwB,EAAG,4CAAqD,CAAC;AAC9F,eAAO,MAAM,wBAAwB,EAAG,4CAAqD,CAAC;AAE9F,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwFf,CAAC;AAGX,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAA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