nara-sdk 1.0.85 → 1.0.87
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 +3 -4
- package/package.json +1 -1
- package/src/idls/nara_quest.json +3 -3
- package/src/idls/nara_quest.ts +3 -3
- package/src/quest.ts +12 -35
package/README.md
CHANGED
|
@@ -199,7 +199,7 @@ import {
|
|
|
199
199
|
} from 'nara-sdk';
|
|
200
200
|
|
|
201
201
|
const quest = await getQuestInfo(connection);
|
|
202
|
-
console.log(`Boost slots: ${quest.
|
|
202
|
+
console.log(`Boost slots: ${quest.boostRemainingSlots}/${quest.boostRewardCount}`);
|
|
203
203
|
|
|
204
204
|
const stakeInfo = await getStakeInfo(connection, wallet.publicKey);
|
|
205
205
|
console.log(`Your boost credits: ${stakeInfo?.boostCredits ?? 0}`);
|
|
@@ -216,9 +216,8 @@ const { signature } = await submitAnswer(connection, wallet, proof.solana);
|
|
|
216
216
|
|
|
217
217
|
Relevant `QuestInfo` fields:
|
|
218
218
|
|
|
219
|
-
- `
|
|
220
|
-
— the single Boost PoMI winner bucket
|
|
221
|
-
for chain parity)
|
|
219
|
+
- `boostRewardCount` / `boostWinnerCount` / `boostRewardPerWinner` / `boostRemainingSlots`
|
|
220
|
+
— the single Boost PoMI winner bucket
|
|
222
221
|
- `round` / `question` / `answerHash` / `deadline` / `timeRemaining`
|
|
223
222
|
|
|
224
223
|
Legacy staking (`stake` / `unstake`) remains callable so existing stakers can
|
package/package.json
CHANGED
package/src/idls/nara_quest.json
CHANGED
|
@@ -2067,15 +2067,15 @@
|
|
|
2067
2067
|
"type": "u64"
|
|
2068
2068
|
},
|
|
2069
2069
|
{
|
|
2070
|
-
"name": "
|
|
2070
|
+
"name": "boost_reward_count",
|
|
2071
2071
|
"type": "u32"
|
|
2072
2072
|
},
|
|
2073
2073
|
{
|
|
2074
|
-
"name": "
|
|
2074
|
+
"name": "boost_reward_per_winner",
|
|
2075
2075
|
"type": "u64"
|
|
2076
2076
|
},
|
|
2077
2077
|
{
|
|
2078
|
-
"name": "
|
|
2078
|
+
"name": "boost_winner_count",
|
|
2079
2079
|
"type": "u32"
|
|
2080
2080
|
},
|
|
2081
2081
|
{
|
package/src/idls/nara_quest.ts
CHANGED
|
@@ -2073,15 +2073,15 @@ export type NaraQuest = {
|
|
|
2073
2073
|
"type": "u64"
|
|
2074
2074
|
},
|
|
2075
2075
|
{
|
|
2076
|
-
"name": "
|
|
2076
|
+
"name": "boostRewardCount",
|
|
2077
2077
|
"type": "u32"
|
|
2078
2078
|
},
|
|
2079
2079
|
{
|
|
2080
|
-
"name": "
|
|
2080
|
+
"name": "boostRewardPerWinner",
|
|
2081
2081
|
"type": "u64"
|
|
2082
2082
|
},
|
|
2083
2083
|
{
|
|
2084
|
-
"name": "
|
|
2084
|
+
"name": "boostWinnerCount",
|
|
2085
2085
|
"type": "u32"
|
|
2086
2086
|
},
|
|
2087
2087
|
{
|
package/src/quest.ts
CHANGED
|
@@ -47,15 +47,11 @@ export interface QuestInfo {
|
|
|
47
47
|
answerHash: number[];
|
|
48
48
|
/** Total reward pool for the round, in NARA */
|
|
49
49
|
totalReward: number;
|
|
50
|
-
/**
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
stakeRewardCount: number;
|
|
56
|
-
stakeWinnerCount: number;
|
|
57
|
-
stakeRewardPerWinner: number;
|
|
58
|
-
stakeRemainingSlots: number;
|
|
50
|
+
/** Boost PoMI winner bucket (single reward track). */
|
|
51
|
+
boostRewardCount: number;
|
|
52
|
+
boostWinnerCount: number;
|
|
53
|
+
boostRewardPerWinner: number;
|
|
54
|
+
boostRemainingSlots: number;
|
|
59
55
|
difficulty: number;
|
|
60
56
|
deadline: number;
|
|
61
57
|
timeRemaining: number;
|
|
@@ -109,13 +105,6 @@ export interface QuestOptions {
|
|
|
109
105
|
circuitWasmPath?: string | Uint8Array;
|
|
110
106
|
/** File path (Node.js), URL string, or pre-loaded Uint8Array (browser) */
|
|
111
107
|
zkeyPath?: string | Uint8Array;
|
|
112
|
-
/**
|
|
113
|
-
* @deprecated Boost PoMI no longer gates on stake; credits are the sole admission ticket.
|
|
114
|
-
* If set, a legacy `stake` instruction is still bundled before `submit_answer`:
|
|
115
|
-
* - number: stake the exact NARA amount
|
|
116
|
-
* - "auto": no-op (kept for API compatibility)
|
|
117
|
-
*/
|
|
118
|
-
stake?: "auto" | number;
|
|
119
108
|
}
|
|
120
109
|
|
|
121
110
|
export interface ActivityLog {
|
|
@@ -336,8 +325,8 @@ export async function getQuestInfo(
|
|
|
336
325
|
stakeHigh, stakeLow, createdAtMs, decayMs, nowMs
|
|
337
326
|
);
|
|
338
327
|
|
|
339
|
-
const
|
|
340
|
-
const
|
|
328
|
+
const boostRewardCount = pool.boostRewardCount;
|
|
329
|
+
const boostWinnerCount = pool.boostWinnerCount;
|
|
341
330
|
|
|
342
331
|
return {
|
|
343
332
|
active,
|
|
@@ -345,10 +334,10 @@ export async function getQuestInfo(
|
|
|
345
334
|
question: pool.question,
|
|
346
335
|
answerHash: Array.from(pool.answerHash),
|
|
347
336
|
totalReward: pool.rewardAmount.toNumber() / LAMPORTS_PER_SOL,
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
337
|
+
boostRewardCount,
|
|
338
|
+
boostWinnerCount,
|
|
339
|
+
boostRewardPerWinner: pool.boostRewardPerWinner.toNumber() / LAMPORTS_PER_SOL,
|
|
340
|
+
boostRemainingSlots: Math.max(0, boostRewardCount - boostWinnerCount),
|
|
352
341
|
difficulty: pool.difficulty,
|
|
353
342
|
deadline,
|
|
354
343
|
timeRemaining: secsLeft,
|
|
@@ -458,24 +447,12 @@ export async function submitAnswer(
|
|
|
458
447
|
);
|
|
459
448
|
}
|
|
460
449
|
|
|
461
|
-
// Legacy optional stake instruction (staking channel is closed but still callable)
|
|
462
|
-
let stakeIx: any = null;
|
|
463
|
-
if (typeof options?.stake === "number" && options.stake > 0) {
|
|
464
|
-
const stakeLamports = new BN(Math.round(options.stake * LAMPORTS_PER_SOL));
|
|
465
|
-
stakeIx = await program.methods
|
|
466
|
-
.stake(stakeLamports)
|
|
467
|
-
.accounts({ user: wallet.publicKey } as any)
|
|
468
|
-
.instruction();
|
|
469
|
-
}
|
|
470
|
-
|
|
471
450
|
const submitIx = await program.methods
|
|
472
451
|
.submitAnswer(proof.proofA as any, proof.proofB as any, proof.proofC as any, agent, model)
|
|
473
452
|
.accounts({ user: wallet.publicKey, payer: wallet.publicKey })
|
|
474
453
|
.instruction();
|
|
475
454
|
|
|
476
|
-
const ixs = [];
|
|
477
|
-
if (stakeIx) ixs.push(stakeIx);
|
|
478
|
-
ixs.push(submitIx);
|
|
455
|
+
const ixs = [submitIx];
|
|
479
456
|
|
|
480
457
|
if (activityLog) {
|
|
481
458
|
const { makeLogActivityIx, makeLogActivityWithReferralIx } = await import("./agent_registry");
|