@wkalidev/trivia-quest-sdk 1.1.0 → 1.2.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/package.json +3 -3
- package/sdk/index.d.ts +127 -101
- package/sdk/index.js +94 -109
- package/README.md +0 -127
- package/sdk/index.d.ts.map +0 -1
- package/sdk/index.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wkalidev/trivia-quest-sdk",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "SDK
|
|
3
|
+
"version": "1.2.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
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
4
|
-
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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
|
-
|
|
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: "
|
|
127
|
+
readonly name: "streak";
|
|
112
128
|
readonly type: "uint256";
|
|
113
129
|
}, {
|
|
114
|
-
readonly name: "
|
|
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
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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.
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
8
|
-
exports.
|
|
9
|
-
exports.
|
|
10
|
-
exports.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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: "
|
|
74
|
+
name: "getTotalPlayers",
|
|
66
75
|
type: "function",
|
|
67
76
|
stateMutability: "view",
|
|
68
|
-
inputs: [
|
|
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: "
|
|
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: "
|
|
90
|
+
name: "checkIn",
|
|
92
91
|
type: "function",
|
|
93
92
|
stateMutability: "nonpayable",
|
|
94
|
-
inputs: [
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
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
|
-
//
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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;
|
package/README.md
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
# Trivia Q 🎮
|
|
2
|
-
|
|
3
|
-
> Play. Learn. Earn on Celo.
|
|
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.
|
|
6
|
-
|
|
7
|
-
## 🌍 Why Africa?
|
|
8
|
-
|
|
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.
|
|
70
|
-
|
|
71
|
-
## 🏆 Prize Distribution (Multi-Winner)
|
|
72
|
-
|
|
73
|
-
| Position | Share |
|
|
74
|
-
|---|---|
|
|
75
|
-
| 🥇 1st place | 50% |
|
|
76
|
-
| 🥈 2nd place | 30% |
|
|
77
|
-
| 🥉 3rd place | 20% |
|
|
78
|
-
|
|
79
|
-
## 🌍 Multi-Language Support
|
|
80
|
-
|
|
81
|
-
| Language | Code |
|
|
82
|
-
|---|---|
|
|
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
|
-
```
|
|
104
|
-
|
|
105
|
-
## 🎯 Proof of Ship Checklist
|
|
106
|
-
|
|
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
|
|
111
|
-
|
|
112
|
-
## 📋 Tech Stack
|
|
113
|
-
|
|
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
|
package/sdk/index.d.ts.map
DELETED
|
@@ -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,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAGF,wBAAgB,SAAS,IAAI,OAAO,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