@wkalidev/trivia-quest-sdk 2.0.0 → 3.0.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 +73 -40
- package/package.json +1 -1
- package/sdk/README.md +68 -3
- package/sdk/index.d.ts +191 -1
- package/sdk/index.d.ts.map +1 -1
- package/sdk/index.js +162 -3
- package/sdk/index.js.map +1 -1
- package/sdk/package.json +1 -1
- package/sdk/sdk/index.d.ts +449 -67
- package/sdk/sdk/index.js +408 -52
- package/sdk/src/index.ts +485 -52
package/README.md
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://trivia-quest-eight.vercel.app)
|
|
6
6
|
[](https://www.npmjs.com/package/@wkalidev/trivia-quest-sdk)
|
|
7
|
+
[](https://app.ai.self.xyz/agents)
|
|
7
8
|
[](LICENSE)
|
|
8
9
|
|
|
9
10
|
## 🌍 Why Africa?
|
|
@@ -16,13 +17,14 @@ Celo's mission is financial inclusion for the unbanked. With **57% of African ad
|
|
|
16
17
|
|---|---|
|
|
17
18
|
| App | https://trivia-quest-eight.vercel.app |
|
|
18
19
|
| Duel 1v1 | https://trivia-quest-eight.vercel.app/duel |
|
|
19
|
-
| SDK | npm install @wkalidev/trivia-quest-sdk |
|
|
20
|
-
| Stats API | GET /api/stats |
|
|
20
|
+
| SDK v3.0.0 | `npm install @wkalidev/trivia-quest-sdk` |
|
|
21
|
+
| Stats API | `GET /api/stats` |
|
|
22
|
+
| MCP Server | https://trivia-quest-eight.vercel.app/api/mcp |
|
|
21
23
|
| GitHub | https://github.com/wkalidev/trivia-quest |
|
|
22
24
|
|
|
23
25
|
## 🎮 Features
|
|
24
26
|
|
|
25
|
-
-
|
|
27
|
+
- 1200+ questions across 6 categories
|
|
26
28
|
- 10 random questions per game, 15s timer
|
|
27
29
|
- Streak system x2 / x3 multiplier
|
|
28
30
|
- $TRIVQ tokens minted on-chain after every game
|
|
@@ -41,6 +43,8 @@ Celo's mission is financial inclusion for the unbanked. With **57% of African ad
|
|
|
41
43
|
- 🆕 AI Mode — questions by Groq AI (LLaMA 3.1)
|
|
42
44
|
- 🆕 Trivia Duel 1v1 — wager CELO on-chain
|
|
43
45
|
- 🆕 Discord AI Agent — /ask /askcat
|
|
46
|
+
- 🆕 Self Agent ID — verified onchain AI agent (#103)
|
|
47
|
+
- 🆕 Farcaster Push Notifications — daily check-in reminders
|
|
44
48
|
|
|
45
49
|
## 🤖 AI Mode (NEW — May 2026)
|
|
46
50
|
|
|
@@ -49,7 +53,29 @@ Questions generated in real-time by Groq AI (LLaMA 3.1-8b-instant):
|
|
|
49
53
|
- Infinite unique questions — never the same quiz twice
|
|
50
54
|
- Questions preloaded in background while you play
|
|
51
55
|
- Accessible via /quiz → Mode IA button
|
|
52
|
-
- API: GET /api/ai-question?category=Web3%20%26%20Crypto
|
|
56
|
+
- API: `GET /api/ai-question?category=Web3%20%26%20Crypto`
|
|
57
|
+
|
|
58
|
+
## 🔐 Security
|
|
59
|
+
|
|
60
|
+
- Submit score requires ECDSA wallet signature (prevents fake scores)
|
|
61
|
+
- Rate limited: 5 submissions/hour per wallet
|
|
62
|
+
- Cron endpoint protected by CRON_SECRET
|
|
63
|
+
- AI endpoint rate limited: 10 req/min (Self Agents bypass)
|
|
64
|
+
|
|
65
|
+
**Agent registration note:** The ERC-8004 `register-agent.ts` script only supports initial registration. To update the on-chain `agentURI` to `https://trivia-quest-eight.vercel.app/api/agent-metadata`, the owner must call `updateAgent` directly on the ERC-8004 Identity Registry (`0x8004A169FB4a3325136EB29fA0ceB6D2e539a432`) on Celo Mainnet.
|
|
66
|
+
|
|
67
|
+
## 🔐 Self Agent ID (NEW — May 2026)
|
|
68
|
+
|
|
69
|
+
The Trivia Q Discord bot is registered as a verified onchain AI agent via [Self Protocol](https://app.ai.self.xyz):
|
|
70
|
+
|
|
71
|
+
| Property | Value |
|
|
72
|
+
|---|---|
|
|
73
|
+
| Agent ID | #103 |
|
|
74
|
+
| Agent Address | `0xFa475D3E676c4A87e410F536b1231FcD220B0261` |
|
|
75
|
+
| Network | Celo Mainnet |
|
|
76
|
+
| Status | ✅ Verified onchain |
|
|
77
|
+
|
|
78
|
+
Every AI request made by the bot is cryptographically signed with ECDSA — verifiable on-chain. The `/api/ai-question` endpoint recognizes verified Self Agents and grants them priority access, bypassing standard rate limits.
|
|
53
79
|
|
|
54
80
|
## ⚔️ Trivia Duel 1v1 (NEW — May 2026)
|
|
55
81
|
|
|
@@ -59,26 +85,26 @@ Questions generated in real-time by Groq AI (LLaMA 3.1-8b-instant):
|
|
|
59
85
|
- Tie = both players refunded minus fees
|
|
60
86
|
- Expires in 24h if no one joins → full refund
|
|
61
87
|
- 10% protocol fee on winnings
|
|
62
|
-
- Contract: 0xee7be00cd5454b9bea56d864d82076b8b5de5ca1
|
|
88
|
+
- Contract: `0xee7be00cd5454b9bea56d864d82076b8b5de5ca1`
|
|
63
89
|
|
|
64
90
|
## 🔗 Smart Contracts
|
|
65
91
|
|
|
66
92
|
### Celo Mainnet
|
|
67
93
|
| Contract | Address |
|
|
68
94
|
|---|---|
|
|
69
|
-
| TriviaQToken ($TRIVQ) v2 | 0xe65fc5cacaf9a5aebbc0e151dee08a53f24a05c5 |
|
|
70
|
-
| TriviaQuest v3 | 0xffe22d3d1b63866ac9da8ac92fdb9ceddeadb0bb |
|
|
71
|
-
| TriviaDuel v1
|
|
72
|
-
| DailyCheckIn v2 | 0x8650e6c477f8ae3933dc6d61d85e65c90cf71828 |
|
|
73
|
-
| Referral v2 | 0xa0fcd85a25ecb71ca1ea9d63da058c832c27c62e |
|
|
95
|
+
| TriviaQToken ($TRIVQ) v2 | `0xe65fc5cacaf9a5aebbc0e151dee08a53f24a05c5` |
|
|
96
|
+
| TriviaQuest v3 | `0xffe22d3d1b63866ac9da8ac92fdb9ceddeadb0bb` |
|
|
97
|
+
| TriviaDuel v1 🆕 | `0xee7be00cd5454b9bea56d864d82076b8b5de5ca1` |
|
|
98
|
+
| DailyCheckIn v2 | `0x8650e6c477f8ae3933dc6d61d85e65c90cf71828` |
|
|
99
|
+
| Referral v2 | `0xa0fcd85a25ecb71ca1ea9d63da058c832c27c62e` |
|
|
74
100
|
|
|
75
101
|
### Base Mainnet
|
|
76
102
|
| Contract | Address |
|
|
77
103
|
|---|---|
|
|
78
|
-
| TriviaQToken ($TRIVQ) | 0x3217e21a74a068779902213ab06ad3301a8e6a02 |
|
|
79
|
-
| TriviaQuest | 0xf44dfec3230bcf917ca7ccc59b4e67df2507e21f |
|
|
80
|
-
| DailyCheckIn | 0x8a6f59c5f1f11a7ae75c54b1eb95c477405f1bda |
|
|
81
|
-
| Referral | 0x4dafb4d844ce8bd52ce3ad4cee2a4e73780d0c91 |
|
|
104
|
+
| TriviaQToken ($TRIVQ) | `0x3217e21a74a068779902213ab06ad3301a8e6a02` |
|
|
105
|
+
| TriviaQuest | `0xf44dfec3230bcf917ca7ccc59b4e67df2507e21f` |
|
|
106
|
+
| DailyCheckIn | `0x8a6f59c5f1f11a7ae75c54b1eb95c477405f1bda` |
|
|
107
|
+
| Referral | `0x4dafb4d844ce8bd52ce3ad4cee2a4e73780d0c91` |
|
|
82
108
|
|
|
83
109
|
## 💎 $TRIVQ Tokenomics
|
|
84
110
|
|
|
@@ -112,11 +138,13 @@ Questions generated in real-time by Groq AI (LLaMA 3.1-8b-instant):
|
|
|
112
138
|
| NFT Storage | Pinata IPFS |
|
|
113
139
|
| Frontend | Next.js 16 + TypeScript + TailwindCSS |
|
|
114
140
|
| Web3 | Wagmi + Viem + RainbowKit |
|
|
115
|
-
| AI | Groq API (LLaMA 3.1-8b-instant)
|
|
141
|
+
| AI | Groq API (LLaMA 3.1-8b-instant) |
|
|
142
|
+
| AI Agent | Self Protocol — Agent #103 🆕 |
|
|
116
143
|
| i18n | next-intl (FR, EN, ES, IT) |
|
|
117
144
|
| Bot | discord.js v14 + ethers.js v6 |
|
|
118
145
|
| Bot Hosting | Railway (24/7) |
|
|
119
146
|
| Deploy | Vercel + GitHub Actions |
|
|
147
|
+
| Notifications | Farcaster Mini App SDK + Supabase |
|
|
120
148
|
|
|
121
149
|
## 🛠️ Local Setup
|
|
122
150
|
|
|
@@ -131,7 +159,7 @@ yarn dev
|
|
|
131
159
|
|
|
132
160
|
# Bot
|
|
133
161
|
cd ../bot && npm install
|
|
134
|
-
# Add DISCORD_TOKEN, CLIENT_ID, GUILD_ID, GROQ_API_KEY to .env
|
|
162
|
+
# Add DISCORD_TOKEN, CLIENT_ID, GUILD_ID, GROQ_API_KEY, SELF_AGENT_PRIVATE_KEY to .env
|
|
135
163
|
npm run build && npm start
|
|
136
164
|
|
|
137
165
|
# Contracts
|
|
@@ -141,30 +169,35 @@ npx hardhat compile
|
|
|
141
169
|
|
|
142
170
|
## 🎯 Proof of Ship Checklist
|
|
143
171
|
|
|
144
|
-
- Build For MiniPay
|
|
145
|
-
- Deploy On Celo (5 contracts)
|
|
146
|
-
- Deploy On Base (4 contracts)
|
|
147
|
-
- $TRIVQ Token ERC-20 verified
|
|
148
|
-
- 150 NFT Badges ERC-1155 on IPFS
|
|
149
|
-
- Daily Check-in on-chain
|
|
150
|
-
- Protocol Fee 10%
|
|
151
|
-
- Auto Round Management via cron
|
|
152
|
-
- Referral System
|
|
153
|
-
- $TRIVQ Price Tracker
|
|
154
|
-
- Liquidity Pool on Ubeswap v3
|
|
155
|
-
- PWA Push Notifications
|
|
156
|
-
- Public SDK on npm
|
|
157
|
-
- Farcaster Frame
|
|
158
|
-
- Dynamic OG image
|
|
159
|
-
- Score share card
|
|
160
|
-
- Public Stats API
|
|
161
|
-
- Discord Bot 24/7 on Railway
|
|
162
|
-
- Multi-chain Celo + Base
|
|
163
|
-
- Coinbase Verification
|
|
164
|
-
- Terms of Service + Privacy Policy
|
|
165
|
-
-
|
|
166
|
-
-
|
|
167
|
-
-
|
|
172
|
+
- [x] Build For MiniPay
|
|
173
|
+
- [x] Deploy On Celo (5 contracts)
|
|
174
|
+
- [x] Deploy On Base (4 contracts)
|
|
175
|
+
- [x] $TRIVQ Token ERC-20 verified
|
|
176
|
+
- [x] 150 NFT Badges ERC-1155 on IPFS
|
|
177
|
+
- [x] Daily Check-in on-chain
|
|
178
|
+
- [x] Protocol Fee 10%
|
|
179
|
+
- [x] Auto Round Management via cron
|
|
180
|
+
- [x] Referral System
|
|
181
|
+
- [x] $TRIVQ Price Tracker
|
|
182
|
+
- [x] Liquidity Pool on Ubeswap v3
|
|
183
|
+
- [x] PWA Push Notifications
|
|
184
|
+
- [x] Public SDK on npm
|
|
185
|
+
- [x] Farcaster Frame
|
|
186
|
+
- [x] Dynamic OG image
|
|
187
|
+
- [x] Score share card
|
|
188
|
+
- [x] Public Stats API
|
|
189
|
+
- [x] Discord Bot 24/7 on Railway
|
|
190
|
+
- [x] Multi-chain Celo + Base
|
|
191
|
+
- [x] Coinbase Verification
|
|
192
|
+
- [x] Terms of Service + Privacy Policy
|
|
193
|
+
- [x] AI Question Mode (Groq LLaMA 3.1) 🆕
|
|
194
|
+
- [x] Trivia Duel 1v1 on-chain 🆕
|
|
195
|
+
- [x] Discord AI Agent /ask /askcat 🆕
|
|
196
|
+
- [x] Self Agent ID — verified onchain AI agent #103 🆕
|
|
197
|
+
- [x] Farcaster Push Notifications (daily reminders) 🆕
|
|
198
|
+
- [x] MCP Server endpoint — /api/mcp 🆕
|
|
199
|
+
- [x] 8004scan score improved (MCP unlocks full Service scoring) 🆕
|
|
200
|
+
- [x] Submit score signature verification 🆕
|
|
168
201
|
|
|
169
202
|
## 👤 Author
|
|
170
203
|
|
package/package.json
CHANGED
package/sdk/README.md
CHANGED
|
@@ -17,13 +17,16 @@ yarn add @wkalidev/trivia-quest-sdk
|
|
|
17
17
|
## What's included
|
|
18
18
|
|
|
19
19
|
- ✅ Contract addresses (Celo Mainnet + Base Mainnet + Testnet)
|
|
20
|
-
- ✅ Full ABIs (TriviaQuest, TriviaDuel, TRIVQ Token)
|
|
21
|
-
- ✅ TypeScript types (`Round`, `Duel`, `DuelStatus`, `PlayerStats`, `LeaderboardEntry`)
|
|
20
|
+
- ✅ Full ABIs (TriviaQuest, TriviaDuel, TRIVQ Token, CheckIn, Referral)
|
|
21
|
+
- ✅ TypeScript types (`Round`, `Duel`, `DuelStatus`, `PlayerStats`, `LeaderboardEntry`, `CheckInData`, `NetworkStats`, `GeneratedQuestion`, `StatsResponse`)
|
|
22
22
|
- ✅ Multi-chain helper `getAddress(chainId, contract)`
|
|
23
23
|
- ✅ Score & streak utils (`getMultiplier`, `calculatePoints`, `getStreakLabel`)
|
|
24
24
|
- ✅ Duel utils (`formatWager`, `getDuelNetPrize`, `isDuelExpired`, `getDuelStatusLabel`)
|
|
25
25
|
- ✅ Format utils (`formatTrivq`, `formatCelo`, `formatAddress`)
|
|
26
26
|
- ✅ MiniPay detection (`isMiniPay`, `getMiniPayAccount`)
|
|
27
|
+
- ✅ MCP endpoint (`getMCPEndpoint`)
|
|
28
|
+
- ✅ AI question generator (`generateQuestion(category?)`)
|
|
29
|
+
- ✅ Live stats fetcher (`getStats()`)
|
|
27
30
|
|
|
28
31
|
---
|
|
29
32
|
|
|
@@ -191,8 +194,71 @@ import type {
|
|
|
191
194
|
|
|
192
195
|
---
|
|
193
196
|
|
|
197
|
+
## New in v3.0.0 — MCP & AI
|
|
198
|
+
|
|
199
|
+
### `getMCPEndpoint()`
|
|
200
|
+
|
|
201
|
+
Returns the URL of the TriviaQ MCP server (Model Context Protocol).
|
|
202
|
+
|
|
203
|
+
```typescript
|
|
204
|
+
import { getMCPEndpoint } from "@wkalidev/trivia-quest-sdk";
|
|
205
|
+
|
|
206
|
+
const url = getMCPEndpoint();
|
|
207
|
+
// "https://trivia-quest-eight.vercel.app/api/mcp"
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### `generateQuestion(category?)`
|
|
211
|
+
|
|
212
|
+
Fetches a single AI-generated question from the TriviaQ Groq endpoint.
|
|
213
|
+
|
|
214
|
+
```typescript
|
|
215
|
+
import { generateQuestion } from "@wkalidev/trivia-quest-sdk";
|
|
216
|
+
|
|
217
|
+
// Random category
|
|
218
|
+
const q = await generateQuestion();
|
|
219
|
+
console.log(q.question); // "What is a smart contract?"
|
|
220
|
+
console.log(q.options); // ["A legal contract", "Self-executing code on blockchain", ...]
|
|
221
|
+
console.log(q.answer); // 1 (index of correct option)
|
|
222
|
+
console.log(q.category); // "Web3 & Crypto"
|
|
223
|
+
|
|
224
|
+
// Specific category
|
|
225
|
+
const geo = await generateQuestion("African Geography");
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### `getStats()`
|
|
229
|
+
|
|
230
|
+
Fetches live network statistics from both Celo and Base.
|
|
231
|
+
|
|
232
|
+
```typescript
|
|
233
|
+
import { getStats } from "@wkalidev/trivia-quest-sdk";
|
|
234
|
+
|
|
235
|
+
const stats = await getStats();
|
|
236
|
+
console.log(stats.players); // 42
|
|
237
|
+
console.log(stats.roundId); // 7
|
|
238
|
+
console.log(stats.prizePool); // "1500000000000000000"
|
|
239
|
+
console.log(stats.totalCheckins); // 318
|
|
240
|
+
console.log(stats.chains); // { celo: true, base: true }
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
> **Security note:** `generateQuestion` calls the public `/api/ai-question` endpoint which is rate-limited (10 req/min). Verified Self Protocol agents bypass rate limiting via the `X-Self-Signature` header.
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
194
247
|
## Changelog
|
|
195
248
|
|
|
249
|
+
### v3.0.0
|
|
250
|
+
- Added `getMCPEndpoint()` — MCP server URL helper
|
|
251
|
+
- Added `generateQuestion(category?)` — AI-powered question fetcher (Groq LLaMA 3.1)
|
|
252
|
+
- Added `getStats()` — live network stats with Celo + Base support
|
|
253
|
+
- Added types: `GeneratedQuestion`, `StatsResponse`
|
|
254
|
+
- Bumped `SDK_VERSION` to `"3.0.0"`
|
|
255
|
+
|
|
256
|
+
### v2.1.0
|
|
257
|
+
- Added `CHECKIN_ABI` and `REFERRAL_ABI`
|
|
258
|
+
- Added `fetchNetworkStats()`, `getStreakBonus()`, `getNextStreakMilestone()`, `formatCountdown()`
|
|
259
|
+
- Added `calculateRewards()` reward calculator
|
|
260
|
+
- Added `CATEGORIES` array with category metadata
|
|
261
|
+
|
|
196
262
|
### v2.0.0
|
|
197
263
|
- Added `DUEL_ABI` and `DUEL_ADDRESS_CELO` for TriviaDuel 1v1
|
|
198
264
|
- Added `BASE_MAINNET` contracts
|
|
@@ -201,7 +267,6 @@ import type {
|
|
|
201
267
|
- Added format utils: `formatTrivq`, `formatCelo`, `formatAddress`
|
|
202
268
|
- Added `TRIVQ_ABI` full token ABI
|
|
203
269
|
- Added `DuelStatus` enum and `Duel` type
|
|
204
|
-
- Updated `Round` type with `topWinners` array
|
|
205
270
|
|
|
206
271
|
### v1.4.0
|
|
207
272
|
- Initial public release
|
package/sdk/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "
|
|
1
|
+
export declare const SDK_VERSION = "3.0.0";
|
|
2
2
|
export declare const TRIVIA_QUEST_ADDRESS_CELO: "0xffe22d3d1b63866ac9da8ac92fdb9ceddeadb0bb";
|
|
3
3
|
export declare const TRIVQ_TOKEN_ADDRESS_CELO: "0xe65fc5cacaf9a5aebbc0e151dee08a53f24a05c5";
|
|
4
4
|
export declare const CHECKIN_ADDRESS_CELO: "0x8650e6c477f8ae3933dc6d61d85e65c90cf71828";
|
|
@@ -404,4 +404,194 @@ export declare function getMiniPayAccount(): Promise<string | null>;
|
|
|
404
404
|
export declare function formatAddress(address: string): string;
|
|
405
405
|
export declare function formatTrivq(raw: bigint): string;
|
|
406
406
|
export declare function formatCelo(wei: bigint): string;
|
|
407
|
+
export declare const CHECKIN_ABI: readonly [{
|
|
408
|
+
readonly name: "checkIn";
|
|
409
|
+
readonly type: "function";
|
|
410
|
+
readonly stateMutability: "nonpayable";
|
|
411
|
+
readonly inputs: readonly [{
|
|
412
|
+
readonly name: "categoryId";
|
|
413
|
+
readonly type: "uint256";
|
|
414
|
+
}];
|
|
415
|
+
readonly outputs: readonly [];
|
|
416
|
+
}, {
|
|
417
|
+
readonly name: "getPlayerData";
|
|
418
|
+
readonly type: "function";
|
|
419
|
+
readonly stateMutability: "view";
|
|
420
|
+
readonly inputs: readonly [{
|
|
421
|
+
readonly name: "player";
|
|
422
|
+
readonly type: "address";
|
|
423
|
+
}];
|
|
424
|
+
readonly outputs: readonly [{
|
|
425
|
+
readonly name: "lastCheckIn";
|
|
426
|
+
readonly type: "uint256";
|
|
427
|
+
}, {
|
|
428
|
+
readonly name: "streak";
|
|
429
|
+
readonly type: "uint256";
|
|
430
|
+
}, {
|
|
431
|
+
readonly name: "totalCheckIns";
|
|
432
|
+
readonly type: "uint256";
|
|
433
|
+
}, {
|
|
434
|
+
readonly name: "checkInAvailable";
|
|
435
|
+
readonly type: "bool";
|
|
436
|
+
}, {
|
|
437
|
+
readonly name: "secondsUntilNext";
|
|
438
|
+
readonly type: "uint256";
|
|
439
|
+
}];
|
|
440
|
+
}, {
|
|
441
|
+
readonly name: "totalCheckIns";
|
|
442
|
+
readonly type: "function";
|
|
443
|
+
readonly stateMutability: "view";
|
|
444
|
+
readonly inputs: readonly [];
|
|
445
|
+
readonly outputs: readonly [{
|
|
446
|
+
readonly type: "uint256";
|
|
447
|
+
}];
|
|
448
|
+
}];
|
|
449
|
+
export declare const REFERRAL_ABI: readonly [{
|
|
450
|
+
readonly name: "registerReferral";
|
|
451
|
+
readonly type: "function";
|
|
452
|
+
readonly stateMutability: "nonpayable";
|
|
453
|
+
readonly inputs: readonly [{
|
|
454
|
+
readonly name: "referrer";
|
|
455
|
+
readonly type: "address";
|
|
456
|
+
}];
|
|
457
|
+
readonly outputs: readonly [];
|
|
458
|
+
}, {
|
|
459
|
+
readonly name: "getReferrer";
|
|
460
|
+
readonly type: "function";
|
|
461
|
+
readonly stateMutability: "view";
|
|
462
|
+
readonly inputs: readonly [{
|
|
463
|
+
readonly name: "user";
|
|
464
|
+
readonly type: "address";
|
|
465
|
+
}];
|
|
466
|
+
readonly outputs: readonly [{
|
|
467
|
+
readonly type: "address";
|
|
468
|
+
}];
|
|
469
|
+
}, {
|
|
470
|
+
readonly name: "getReferralCount";
|
|
471
|
+
readonly type: "function";
|
|
472
|
+
readonly stateMutability: "view";
|
|
473
|
+
readonly inputs: readonly [{
|
|
474
|
+
readonly name: "referrer";
|
|
475
|
+
readonly type: "address";
|
|
476
|
+
}];
|
|
477
|
+
readonly outputs: readonly [{
|
|
478
|
+
readonly type: "uint256";
|
|
479
|
+
}];
|
|
480
|
+
}];
|
|
481
|
+
export type CheckInData = {
|
|
482
|
+
lastCheckIn: bigint;
|
|
483
|
+
streak: bigint;
|
|
484
|
+
totalCheckIns: bigint;
|
|
485
|
+
checkInAvailable: boolean;
|
|
486
|
+
secondsUntilNext: bigint;
|
|
487
|
+
};
|
|
488
|
+
export type NetworkStats = {
|
|
489
|
+
players: number;
|
|
490
|
+
roundId: number;
|
|
491
|
+
prizePool: string;
|
|
492
|
+
totalCheckins: number;
|
|
493
|
+
};
|
|
494
|
+
export declare function fetchNetworkStats(): Promise<NetworkStats>;
|
|
495
|
+
export declare function getStreakBonus(streak: number): number;
|
|
496
|
+
export declare function getNextStreakMilestone(streak: number): number;
|
|
497
|
+
export declare function formatCountdown(seconds: number): string;
|
|
498
|
+
export declare const CATEGORIES: readonly [{
|
|
499
|
+
readonly id: 1;
|
|
500
|
+
readonly name: "Africa Explorer";
|
|
501
|
+
readonly emoji: "🌍";
|
|
502
|
+
readonly description: "African Geography";
|
|
503
|
+
}, {
|
|
504
|
+
readonly id: 2;
|
|
505
|
+
readonly name: "Crypto Master";
|
|
506
|
+
readonly emoji: "⛓";
|
|
507
|
+
readonly description: "Web3 & Crypto";
|
|
508
|
+
}, {
|
|
509
|
+
readonly id: 3;
|
|
510
|
+
readonly name: "Culture Keeper";
|
|
511
|
+
readonly emoji: "📜";
|
|
512
|
+
readonly description: "History & Culture";
|
|
513
|
+
}, {
|
|
514
|
+
readonly id: 4;
|
|
515
|
+
readonly name: "Tech Wizard";
|
|
516
|
+
readonly emoji: "⚡";
|
|
517
|
+
readonly description: "Science & Tech";
|
|
518
|
+
}, {
|
|
519
|
+
readonly id: 5;
|
|
520
|
+
readonly name: "Sport Champion";
|
|
521
|
+
readonly emoji: "🏆";
|
|
522
|
+
readonly description: "Sports";
|
|
523
|
+
}, {
|
|
524
|
+
readonly id: 6;
|
|
525
|
+
readonly name: "Trivia Legend";
|
|
526
|
+
readonly emoji: "✨";
|
|
527
|
+
readonly description: "General Knowledge";
|
|
528
|
+
}];
|
|
529
|
+
export declare function getCategoryById(id: number): {
|
|
530
|
+
readonly id: 1;
|
|
531
|
+
readonly name: "Africa Explorer";
|
|
532
|
+
readonly emoji: "🌍";
|
|
533
|
+
readonly description: "African Geography";
|
|
534
|
+
} | {
|
|
535
|
+
readonly id: 2;
|
|
536
|
+
readonly name: "Crypto Master";
|
|
537
|
+
readonly emoji: "⛓";
|
|
538
|
+
readonly description: "Web3 & Crypto";
|
|
539
|
+
} | {
|
|
540
|
+
readonly id: 3;
|
|
541
|
+
readonly name: "Culture Keeper";
|
|
542
|
+
readonly emoji: "📜";
|
|
543
|
+
readonly description: "History & Culture";
|
|
544
|
+
} | {
|
|
545
|
+
readonly id: 4;
|
|
546
|
+
readonly name: "Tech Wizard";
|
|
547
|
+
readonly emoji: "⚡";
|
|
548
|
+
readonly description: "Science & Tech";
|
|
549
|
+
} | {
|
|
550
|
+
readonly id: 5;
|
|
551
|
+
readonly name: "Sport Champion";
|
|
552
|
+
readonly emoji: "🏆";
|
|
553
|
+
readonly description: "Sports";
|
|
554
|
+
} | {
|
|
555
|
+
readonly id: 6;
|
|
556
|
+
readonly name: "Trivia Legend";
|
|
557
|
+
readonly emoji: "✨";
|
|
558
|
+
readonly description: "General Knowledge";
|
|
559
|
+
};
|
|
560
|
+
export declare function calculateRewards(params: {
|
|
561
|
+
score: number;
|
|
562
|
+
streak: number;
|
|
563
|
+
isCheckIn?: boolean;
|
|
564
|
+
isDuelWinner?: boolean;
|
|
565
|
+
wager?: bigint;
|
|
566
|
+
}): {
|
|
567
|
+
trivq: number;
|
|
568
|
+
celoWin: bigint;
|
|
569
|
+
};
|
|
570
|
+
/** Returns the MCP server endpoint URL. */
|
|
571
|
+
export declare function getMCPEndpoint(): string;
|
|
572
|
+
export type GeneratedQuestion = {
|
|
573
|
+
question: string;
|
|
574
|
+
options: string[];
|
|
575
|
+
answer: number;
|
|
576
|
+
category: string;
|
|
577
|
+
};
|
|
578
|
+
/**
|
|
579
|
+
* Fetches an AI-generated question from the TriviaQ AI endpoint.
|
|
580
|
+
* @param category Optional category (e.g. "Web3 & Crypto"). Uses random if omitted.
|
|
581
|
+
*/
|
|
582
|
+
export declare function generateQuestion(category?: string): Promise<GeneratedQuestion>;
|
|
583
|
+
export type StatsResponse = {
|
|
584
|
+
players: number;
|
|
585
|
+
roundId: number;
|
|
586
|
+
prizePool: string;
|
|
587
|
+
totalCheckins: number;
|
|
588
|
+
chains: {
|
|
589
|
+
celo: boolean;
|
|
590
|
+
base: boolean;
|
|
591
|
+
};
|
|
592
|
+
};
|
|
593
|
+
/**
|
|
594
|
+
* Fetches live TriviaQ network statistics from the public stats API.
|
|
595
|
+
*/
|
|
596
|
+
export declare function getStats(): Promise<StatsResponse>;
|
|
407
597
|
//# sourceMappingURL=index.d.ts.map
|
package/sdk/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../sdk-src/index.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,UAAU,CAAC;AAKnC,eAAO,MAAM,yBAAyB,EAAG,4CAAqD,CAAC;AAC/F,eAAO,MAAM,wBAAwB,EAAK,4CAAqD,CAAC;AAChG,eAAO,MAAM,oBAAoB,EAAS,4CAAqD,CAAC;AAChG,eAAO,MAAM,qBAAqB,EAAQ,4CAAqD,CAAC;AAChG,eAAO,MAAM,iBAAiB,EAAY,4CAAqD,CAAC;AAGhG,eAAO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