naracli 1.0.94 → 1.0.95
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 +4 -3
- package/dist/nara-cli-bundle.cjs +324 -271
- package/package.json +2 -2
- package/src/cli/commands/agent.ts +51 -0
- package/src/cli/commands/quest.ts +39 -50
package/dist/nara-cli-bundle.cjs
CHANGED
|
@@ -66721,10 +66721,156 @@ var require_dist3 = __commonJS({
|
|
|
66721
66721
|
}
|
|
66722
66722
|
});
|
|
66723
66723
|
|
|
66724
|
-
// node_modules/.pnpm/
|
|
66724
|
+
// node_modules/.pnpm/base-x@5.0.1/node_modules/base-x/src/esm/index.js
|
|
66725
|
+
function base(ALPHABET2) {
|
|
66726
|
+
if (ALPHABET2.length >= 255) {
|
|
66727
|
+
throw new TypeError("Alphabet too long");
|
|
66728
|
+
}
|
|
66729
|
+
const BASE_MAP = new Uint8Array(256);
|
|
66730
|
+
for (let j2 = 0; j2 < BASE_MAP.length; j2++) {
|
|
66731
|
+
BASE_MAP[j2] = 255;
|
|
66732
|
+
}
|
|
66733
|
+
for (let i = 0; i < ALPHABET2.length; i++) {
|
|
66734
|
+
const x3 = ALPHABET2.charAt(i);
|
|
66735
|
+
const xc = x3.charCodeAt(0);
|
|
66736
|
+
if (BASE_MAP[xc] !== 255) {
|
|
66737
|
+
throw new TypeError(x3 + " is ambiguous");
|
|
66738
|
+
}
|
|
66739
|
+
BASE_MAP[xc] = i;
|
|
66740
|
+
}
|
|
66741
|
+
const BASE3 = ALPHABET2.length;
|
|
66742
|
+
const LEADER = ALPHABET2.charAt(0);
|
|
66743
|
+
const FACTOR = Math.log(BASE3) / Math.log(256);
|
|
66744
|
+
const iFACTOR = Math.log(256) / Math.log(BASE3);
|
|
66745
|
+
function encode(source) {
|
|
66746
|
+
if (source instanceof Uint8Array) {
|
|
66747
|
+
} else if (ArrayBuffer.isView(source)) {
|
|
66748
|
+
source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
|
|
66749
|
+
} else if (Array.isArray(source)) {
|
|
66750
|
+
source = Uint8Array.from(source);
|
|
66751
|
+
}
|
|
66752
|
+
if (!(source instanceof Uint8Array)) {
|
|
66753
|
+
throw new TypeError("Expected Uint8Array");
|
|
66754
|
+
}
|
|
66755
|
+
if (source.length === 0) {
|
|
66756
|
+
return "";
|
|
66757
|
+
}
|
|
66758
|
+
let zeroes = 0;
|
|
66759
|
+
let length = 0;
|
|
66760
|
+
let pbegin = 0;
|
|
66761
|
+
const pend = source.length;
|
|
66762
|
+
while (pbegin !== pend && source[pbegin] === 0) {
|
|
66763
|
+
pbegin++;
|
|
66764
|
+
zeroes++;
|
|
66765
|
+
}
|
|
66766
|
+
const size = (pend - pbegin) * iFACTOR + 1 >>> 0;
|
|
66767
|
+
const b58 = new Uint8Array(size);
|
|
66768
|
+
while (pbegin !== pend) {
|
|
66769
|
+
let carry = source[pbegin];
|
|
66770
|
+
let i = 0;
|
|
66771
|
+
for (let it1 = size - 1; (carry !== 0 || i < length) && it1 !== -1; it1--, i++) {
|
|
66772
|
+
carry += 256 * b58[it1] >>> 0;
|
|
66773
|
+
b58[it1] = carry % BASE3 >>> 0;
|
|
66774
|
+
carry = carry / BASE3 >>> 0;
|
|
66775
|
+
}
|
|
66776
|
+
if (carry !== 0) {
|
|
66777
|
+
throw new Error("Non-zero carry");
|
|
66778
|
+
}
|
|
66779
|
+
length = i;
|
|
66780
|
+
pbegin++;
|
|
66781
|
+
}
|
|
66782
|
+
let it2 = size - length;
|
|
66783
|
+
while (it2 !== size && b58[it2] === 0) {
|
|
66784
|
+
it2++;
|
|
66785
|
+
}
|
|
66786
|
+
let str = LEADER.repeat(zeroes);
|
|
66787
|
+
for (; it2 < size; ++it2) {
|
|
66788
|
+
str += ALPHABET2.charAt(b58[it2]);
|
|
66789
|
+
}
|
|
66790
|
+
return str;
|
|
66791
|
+
}
|
|
66792
|
+
function decodeUnsafe(source) {
|
|
66793
|
+
if (typeof source !== "string") {
|
|
66794
|
+
throw new TypeError("Expected String");
|
|
66795
|
+
}
|
|
66796
|
+
if (source.length === 0) {
|
|
66797
|
+
return new Uint8Array();
|
|
66798
|
+
}
|
|
66799
|
+
let psz = 0;
|
|
66800
|
+
let zeroes = 0;
|
|
66801
|
+
let length = 0;
|
|
66802
|
+
while (source[psz] === LEADER) {
|
|
66803
|
+
zeroes++;
|
|
66804
|
+
psz++;
|
|
66805
|
+
}
|
|
66806
|
+
const size = (source.length - psz) * FACTOR + 1 >>> 0;
|
|
66807
|
+
const b256 = new Uint8Array(size);
|
|
66808
|
+
while (psz < source.length) {
|
|
66809
|
+
const charCode = source.charCodeAt(psz);
|
|
66810
|
+
if (charCode > 255) {
|
|
66811
|
+
return;
|
|
66812
|
+
}
|
|
66813
|
+
let carry = BASE_MAP[charCode];
|
|
66814
|
+
if (carry === 255) {
|
|
66815
|
+
return;
|
|
66816
|
+
}
|
|
66817
|
+
let i = 0;
|
|
66818
|
+
for (let it3 = size - 1; (carry !== 0 || i < length) && it3 !== -1; it3--, i++) {
|
|
66819
|
+
carry += BASE3 * b256[it3] >>> 0;
|
|
66820
|
+
b256[it3] = carry % 256 >>> 0;
|
|
66821
|
+
carry = carry / 256 >>> 0;
|
|
66822
|
+
}
|
|
66823
|
+
if (carry !== 0) {
|
|
66824
|
+
throw new Error("Non-zero carry");
|
|
66825
|
+
}
|
|
66826
|
+
length = i;
|
|
66827
|
+
psz++;
|
|
66828
|
+
}
|
|
66829
|
+
let it4 = size - length;
|
|
66830
|
+
while (it4 !== size && b256[it4] === 0) {
|
|
66831
|
+
it4++;
|
|
66832
|
+
}
|
|
66833
|
+
const vch = new Uint8Array(zeroes + (size - it4));
|
|
66834
|
+
let j2 = zeroes;
|
|
66835
|
+
while (it4 !== size) {
|
|
66836
|
+
vch[j2++] = b256[it4++];
|
|
66837
|
+
}
|
|
66838
|
+
return vch;
|
|
66839
|
+
}
|
|
66840
|
+
function decode(string2) {
|
|
66841
|
+
const buffer = decodeUnsafe(string2);
|
|
66842
|
+
if (buffer) {
|
|
66843
|
+
return buffer;
|
|
66844
|
+
}
|
|
66845
|
+
throw new Error("Non-base" + BASE3 + " character");
|
|
66846
|
+
}
|
|
66847
|
+
return {
|
|
66848
|
+
encode,
|
|
66849
|
+
decodeUnsafe,
|
|
66850
|
+
decode
|
|
66851
|
+
};
|
|
66852
|
+
}
|
|
66853
|
+
var esm_default;
|
|
66854
|
+
var init_esm5 = __esm({
|
|
66855
|
+
"node_modules/.pnpm/base-x@5.0.1/node_modules/base-x/src/esm/index.js"() {
|
|
66856
|
+
esm_default = base;
|
|
66857
|
+
}
|
|
66858
|
+
});
|
|
66859
|
+
|
|
66860
|
+
// node_modules/.pnpm/bs58@6.0.0/node_modules/bs58/src/esm/index.js
|
|
66861
|
+
var ALPHABET, esm_default2;
|
|
66862
|
+
var init_esm6 = __esm({
|
|
66863
|
+
"node_modules/.pnpm/bs58@6.0.0/node_modules/bs58/src/esm/index.js"() {
|
|
66864
|
+
init_esm5();
|
|
66865
|
+
ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
66866
|
+
esm_default2 = esm_default(ALPHABET);
|
|
66867
|
+
}
|
|
66868
|
+
});
|
|
66869
|
+
|
|
66870
|
+
// node_modules/.pnpm/nara-sdk@1.0.85_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0.22_typescript@5.9.3_utf-8-validate@6.0.6/node_modules/nara-sdk/src/constants.ts
|
|
66725
66871
|
var DEFAULT_RPC_URL, DEFAULT_QUEST_RELAY_URL, DEFAULT_QUEST_PROGRAM_ID, DEFAULT_SKILLS_PROGRAM_ID, DEFAULT_ZKID_PROGRAM_ID, DEFAULT_AGENT_REGISTRY_PROGRAM_ID, DEFAULT_ALT_ADDRESS, DEFAULT_BRIDGE_FEE_BPS, BRIDGE_FEE_BPS_DENOMINATOR, DEFAULT_BRIDGE_FEE_RECIPIENT_SOLANA, DEFAULT_BRIDGE_FEE_RECIPIENT_NARA;
|
|
66726
66872
|
var init_constants2 = __esm({
|
|
66727
|
-
"node_modules/.pnpm/nara-sdk@1.0.
|
|
66873
|
+
"node_modules/.pnpm/nara-sdk@1.0.85_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0.22_typescript@5.9.3_utf-8-validate@6.0.6/node_modules/nara-sdk/src/constants.ts"() {
|
|
66728
66874
|
DEFAULT_RPC_URL = process.env.RPC_URL || "https://mainnet-api.nara.build/";
|
|
66729
66875
|
DEFAULT_QUEST_RELAY_URL = process.env.QUEST_RELAY_URL || "https://quest-api.nara.build/";
|
|
66730
66876
|
DEFAULT_QUEST_PROGRAM_ID = process.env.QUEST_PROGRAM_ID || "Quest11111111111111111111111111111111111111";
|
|
@@ -66739,7 +66885,7 @@ var init_constants2 = __esm({
|
|
|
66739
66885
|
}
|
|
66740
66886
|
});
|
|
66741
66887
|
|
|
66742
|
-
// node_modules/.pnpm/nara-sdk@1.0.
|
|
66888
|
+
// node_modules/.pnpm/nara-sdk@1.0.85_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0.22_typescript@5.9.3_utf-8-validate@6.0.6/node_modules/nara-sdk/src/tx.ts
|
|
66743
66889
|
function getAltAddress() {
|
|
66744
66890
|
if (_overrideAltAddresses !== null) return _overrideAltAddresses;
|
|
66745
66891
|
if (!DEFAULT_ALT_ADDRESS) return [];
|
|
@@ -66861,7 +67007,7 @@ async function sendTx(connection, payer, instructions, signers, opts) {
|
|
|
66861
67007
|
}
|
|
66862
67008
|
var import_web394, _cachedAlts, _cachedAltKey, _overrideAltAddresses, _globalSkipPreflight;
|
|
66863
67009
|
var init_tx = __esm({
|
|
66864
|
-
"node_modules/.pnpm/nara-sdk@1.0.
|
|
67010
|
+
"node_modules/.pnpm/nara-sdk@1.0.85_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0.22_typescript@5.9.3_utf-8-validate@6.0.6/node_modules/nara-sdk/src/tx.ts"() {
|
|
66865
67011
|
import_web394 = __toESM(require_index_cjs(), 1);
|
|
66866
67012
|
init_constants2();
|
|
66867
67013
|
_cachedAlts = [];
|
|
@@ -83116,10 +83262,10 @@ var require_cjs2 = __commonJS({
|
|
|
83116
83262
|
}
|
|
83117
83263
|
});
|
|
83118
83264
|
|
|
83119
|
-
// node_modules/.pnpm/nara-sdk@1.0.
|
|
83265
|
+
// node_modules/.pnpm/nara-sdk@1.0.85_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0.22_typescript@5.9.3_utf-8-validate@6.0.6/node_modules/nara-sdk/src/idls/nara_quest.json
|
|
83120
83266
|
var nara_quest_default;
|
|
83121
83267
|
var init_nara_quest = __esm({
|
|
83122
|
-
"node_modules/.pnpm/nara-sdk@1.0.
|
|
83268
|
+
"node_modules/.pnpm/nara-sdk@1.0.85_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0.22_typescript@5.9.3_utf-8-validate@6.0.6/node_modules/nara-sdk/src/idls/nara_quest.json"() {
|
|
83123
83269
|
nara_quest_default = {
|
|
83124
83270
|
address: "Quest11111111111111111111111111111111111111",
|
|
83125
83271
|
metadata: {
|
|
@@ -85009,8 +85155,8 @@ var init_nara_quest = __esm({
|
|
|
85009
85155
|
},
|
|
85010
85156
|
{
|
|
85011
85157
|
code: 6017,
|
|
85012
|
-
name: "
|
|
85013
|
-
msg: "
|
|
85158
|
+
name: "BoostCreditsOverflow",
|
|
85159
|
+
msg: "Boost credits overflow"
|
|
85014
85160
|
},
|
|
85015
85161
|
{
|
|
85016
85162
|
code: 6018,
|
|
@@ -85041,6 +85187,11 @@ var init_nara_quest = __esm({
|
|
|
85041
85187
|
code: 6023,
|
|
85042
85188
|
name: "InvalidMultiplier",
|
|
85043
85189
|
msg: "Multiplier must be >= 1"
|
|
85190
|
+
},
|
|
85191
|
+
{
|
|
85192
|
+
code: 6024,
|
|
85193
|
+
name: "NoCredits",
|
|
85194
|
+
msg: "Boost PoMI requires free credits"
|
|
85044
85195
|
}
|
|
85045
85196
|
],
|
|
85046
85197
|
types: [
|
|
@@ -85249,15 +85400,19 @@ var init_nara_quest = __esm({
|
|
|
85249
85400
|
type: "u64"
|
|
85250
85401
|
},
|
|
85251
85402
|
{
|
|
85252
|
-
name: "
|
|
85403
|
+
name: "boost_credits",
|
|
85253
85404
|
type: "u32"
|
|
85254
85405
|
},
|
|
85406
|
+
{
|
|
85407
|
+
name: "user_pubkey",
|
|
85408
|
+
type: "pubkey"
|
|
85409
|
+
},
|
|
85255
85410
|
{
|
|
85256
85411
|
name: "_padding",
|
|
85257
85412
|
type: {
|
|
85258
85413
|
array: [
|
|
85259
85414
|
"u8",
|
|
85260
|
-
|
|
85415
|
+
28
|
|
85261
85416
|
]
|
|
85262
85417
|
}
|
|
85263
85418
|
}
|
|
@@ -85298,10 +85453,10 @@ var init_nara_quest = __esm({
|
|
|
85298
85453
|
}
|
|
85299
85454
|
});
|
|
85300
85455
|
|
|
85301
|
-
// node_modules/.pnpm/nara-sdk@1.0.
|
|
85456
|
+
// node_modules/.pnpm/nara-sdk@1.0.85_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0.22_typescript@5.9.3_utf-8-validate@6.0.6/node_modules/nara-sdk/src/idls/nara_agent_registry.json
|
|
85302
85457
|
var nara_agent_registry_default;
|
|
85303
85458
|
var init_nara_agent_registry = __esm({
|
|
85304
|
-
"node_modules/.pnpm/nara-sdk@1.0.
|
|
85459
|
+
"node_modules/.pnpm/nara-sdk@1.0.85_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0.22_typescript@5.9.3_utf-8-validate@6.0.6/node_modules/nara-sdk/src/idls/nara_agent_registry.json"() {
|
|
85305
85460
|
nara_agent_registry_default = {
|
|
85306
85461
|
address: "AgentRegistry111111111111111111111111111111",
|
|
85307
85462
|
metadata: {
|
|
@@ -90818,7 +90973,7 @@ var init_nara_agent_registry = __esm({
|
|
|
90818
90973
|
}
|
|
90819
90974
|
});
|
|
90820
90975
|
|
|
90821
|
-
// node_modules/.pnpm/nara-sdk@1.0.
|
|
90976
|
+
// node_modules/.pnpm/nara-sdk@1.0.85_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0.22_typescript@5.9.3_utf-8-validate@6.0.6/node_modules/nara-sdk/src/agent_registry.ts
|
|
90822
90977
|
var agent_registry_exports = {};
|
|
90823
90978
|
__export(agent_registry_exports, {
|
|
90824
90979
|
approveRejectedTwitter: () => approveRejectedTwitter,
|
|
@@ -90836,6 +90991,7 @@ __export(agent_registry_exports, {
|
|
|
90836
90991
|
getTweetRecord: () => getTweetRecord,
|
|
90837
90992
|
getTweetVerify: () => getTweetVerify,
|
|
90838
90993
|
initConfig: () => initConfig,
|
|
90994
|
+
listAgentsByAuthority: () => listAgentsByAuthority,
|
|
90839
90995
|
logActivity: () => logActivity,
|
|
90840
90996
|
logActivityWithReferral: () => logActivityWithReferral,
|
|
90841
90997
|
makeLogActivityIx: () => makeLogActivityIx,
|
|
@@ -91043,6 +91199,22 @@ async function getAgentRecord(connection, agentId, options) {
|
|
|
91043
91199
|
}
|
|
91044
91200
|
return parseAgentRecordData(accountInfo.data);
|
|
91045
91201
|
}
|
|
91202
|
+
async function listAgentsByAuthority(connection, authority, options) {
|
|
91203
|
+
const pid = new import_web395.PublicKey(options?.programId ?? DEFAULT_AGENT_REGISTRY_PROGRAM_ID);
|
|
91204
|
+
const accounts = await connection.getProgramAccounts(pid, {
|
|
91205
|
+
commitment: "confirmed",
|
|
91206
|
+
filters: [
|
|
91207
|
+
{ memcmp: { offset: 0, bytes: esm_default2.encode(AGENT_STATE_DISCRIMINATOR) } },
|
|
91208
|
+
{ memcmp: { offset: 8, bytes: authority.toBase58() } }
|
|
91209
|
+
],
|
|
91210
|
+
dataSlice: { offset: 124, length: 36 }
|
|
91211
|
+
});
|
|
91212
|
+
return accounts.map(({ account }) => {
|
|
91213
|
+
const data = Buffer.from(account.data);
|
|
91214
|
+
const agentIdLen = data.readUInt32LE(0);
|
|
91215
|
+
return data.subarray(4, 4 + agentIdLen).toString("utf-8");
|
|
91216
|
+
});
|
|
91217
|
+
}
|
|
91046
91218
|
async function getAgentInfo(connection, agentId, options) {
|
|
91047
91219
|
const pid = new import_web395.PublicKey(options?.programId ?? DEFAULT_AGENT_REGISTRY_PROGRAM_ID);
|
|
91048
91220
|
const agentPda = getAgentPda(pid, agentId);
|
|
@@ -91617,7 +91789,7 @@ async function unbindTwitter(connection, wallet, agentId, username, options) {
|
|
|
91617
91789
|
const ix = await program3.methods.unbindTwitter(agentId, username).accounts({ authority: wallet.publicKey }).instruction();
|
|
91618
91790
|
return sendTx(connection, wallet, [ix]);
|
|
91619
91791
|
}
|
|
91620
|
-
async function verifyTwitter(connection, wallet, agentId, username, options,
|
|
91792
|
+
async function verifyTwitter(connection, wallet, agentId, username, options, boostCreditsDelta, boostCreditsReason) {
|
|
91621
91793
|
const program3 = createProgram(connection, wallet, options?.programId);
|
|
91622
91794
|
const agentPda = getAgentPda(program3.programId, agentId);
|
|
91623
91795
|
const accountInfo = await connection.getAccountInfo(agentPda);
|
|
@@ -91636,16 +91808,16 @@ async function verifyTwitter(connection, wallet, agentId, username, options, fre
|
|
|
91636
91808
|
authorityPointAccount
|
|
91637
91809
|
}).instruction();
|
|
91638
91810
|
const ixs = [ix];
|
|
91639
|
-
if (
|
|
91640
|
-
const {
|
|
91641
|
-
const
|
|
91811
|
+
if (boostCreditsDelta !== void 0 && boostCreditsDelta !== 0) {
|
|
91812
|
+
const { makeAdjustBoostCreditsIx: makeAdjustBoostCreditsIx2 } = await Promise.resolve().then(() => (init_quest(), quest_exports));
|
|
91813
|
+
const boostCreditsIx = await makeAdjustBoostCreditsIx2(
|
|
91642
91814
|
connection,
|
|
91643
91815
|
wallet.publicKey,
|
|
91644
91816
|
authority,
|
|
91645
|
-
|
|
91646
|
-
|
|
91817
|
+
boostCreditsDelta,
|
|
91818
|
+
boostCreditsReason ?? ""
|
|
91647
91819
|
);
|
|
91648
|
-
ixs.push(
|
|
91820
|
+
ixs.push(boostCreditsIx);
|
|
91649
91821
|
}
|
|
91650
91822
|
return sendTx(connection, wallet, ixs);
|
|
91651
91823
|
}
|
|
@@ -91654,7 +91826,7 @@ async function rejectTwitter(connection, wallet, agentId, options) {
|
|
|
91654
91826
|
const ix = await program3.methods.rejectTwitter(agentId).accounts({ verifier: wallet.publicKey }).instruction();
|
|
91655
91827
|
return sendTx(connection, wallet, [ix]);
|
|
91656
91828
|
}
|
|
91657
|
-
async function approveRejectedTwitter(connection, wallet, agentId, username, options,
|
|
91829
|
+
async function approveRejectedTwitter(connection, wallet, agentId, username, options, boostCreditsDelta, boostCreditsReason) {
|
|
91658
91830
|
const program3 = createProgram(connection, wallet, options?.programId);
|
|
91659
91831
|
const agentPda = getAgentPda(program3.programId, agentId);
|
|
91660
91832
|
const accountInfo = await connection.getAccountInfo(agentPda);
|
|
@@ -91673,20 +91845,20 @@ async function approveRejectedTwitter(connection, wallet, agentId, username, opt
|
|
|
91673
91845
|
authorityPointAccount
|
|
91674
91846
|
}).instruction();
|
|
91675
91847
|
const ixs = [ix];
|
|
91676
|
-
if (
|
|
91677
|
-
const {
|
|
91678
|
-
const
|
|
91848
|
+
if (boostCreditsDelta !== void 0 && boostCreditsDelta !== 0) {
|
|
91849
|
+
const { makeAdjustBoostCreditsIx: makeAdjustBoostCreditsIx2 } = await Promise.resolve().then(() => (init_quest(), quest_exports));
|
|
91850
|
+
const boostCreditsIx = await makeAdjustBoostCreditsIx2(
|
|
91679
91851
|
connection,
|
|
91680
91852
|
wallet.publicKey,
|
|
91681
91853
|
authority,
|
|
91682
|
-
|
|
91683
|
-
|
|
91854
|
+
boostCreditsDelta,
|
|
91855
|
+
boostCreditsReason ?? ""
|
|
91684
91856
|
);
|
|
91685
|
-
ixs.push(
|
|
91857
|
+
ixs.push(boostCreditsIx);
|
|
91686
91858
|
}
|
|
91687
91859
|
return sendTx(connection, wallet, ixs);
|
|
91688
91860
|
}
|
|
91689
|
-
async function approveTweet(connection, wallet, agentId, tweetId, options,
|
|
91861
|
+
async function approveTweet(connection, wallet, agentId, tweetId, options, boostCreditsDelta, boostCreditsReason) {
|
|
91690
91862
|
const program3 = createProgram(connection, wallet, options?.programId);
|
|
91691
91863
|
const agentPda = getAgentPda(program3.programId, agentId);
|
|
91692
91864
|
const accountInfo = await connection.getAccountInfo(agentPda);
|
|
@@ -91705,16 +91877,16 @@ async function approveTweet(connection, wallet, agentId, tweetId, options, freeS
|
|
|
91705
91877
|
authorityPointAccount
|
|
91706
91878
|
}).instruction();
|
|
91707
91879
|
const ixs = [ix];
|
|
91708
|
-
if (
|
|
91709
|
-
const {
|
|
91710
|
-
const
|
|
91880
|
+
if (boostCreditsDelta !== void 0 && boostCreditsDelta !== 0) {
|
|
91881
|
+
const { makeAdjustBoostCreditsIx: makeAdjustBoostCreditsIx2 } = await Promise.resolve().then(() => (init_quest(), quest_exports));
|
|
91882
|
+
const boostCreditsIx = await makeAdjustBoostCreditsIx2(
|
|
91711
91883
|
connection,
|
|
91712
91884
|
wallet.publicKey,
|
|
91713
91885
|
authority,
|
|
91714
|
-
|
|
91715
|
-
|
|
91886
|
+
boostCreditsDelta,
|
|
91887
|
+
boostCreditsReason ?? ""
|
|
91716
91888
|
);
|
|
91717
|
-
ixs.push(
|
|
91889
|
+
ixs.push(boostCreditsIx);
|
|
91718
91890
|
}
|
|
91719
91891
|
return sendTx(connection, wallet, ixs);
|
|
91720
91892
|
}
|
|
@@ -91723,14 +91895,15 @@ async function rejectTweet(connection, wallet, agentId, options) {
|
|
|
91723
91895
|
const ix = await program3.methods.rejectTweet(agentId).accounts({ verifier: wallet.publicKey }).instruction();
|
|
91724
91896
|
return sendTx(connection, wallet, [ix]);
|
|
91725
91897
|
}
|
|
91726
|
-
var import_web395, anchor, import_anchor, import_bn, DEFAULT_CHUNK_SIZE, BUFFER_HEADER_SIZE, MEMORY_HEADER_SIZE, BIO_META_HEADER_SIZE;
|
|
91898
|
+
var import_web395, anchor, import_anchor, import_bn, DEFAULT_CHUNK_SIZE, BUFFER_HEADER_SIZE, MEMORY_HEADER_SIZE, BIO_META_HEADER_SIZE, AGENT_STATE_DISCRIMINATOR;
|
|
91727
91899
|
var init_agent_registry = __esm({
|
|
91728
|
-
"node_modules/.pnpm/nara-sdk@1.0.
|
|
91900
|
+
"node_modules/.pnpm/nara-sdk@1.0.85_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0.22_typescript@5.9.3_utf-8-validate@6.0.6/node_modules/nara-sdk/src/agent_registry.ts"() {
|
|
91729
91901
|
import_web395 = __toESM(require_index_cjs(), 1);
|
|
91730
91902
|
anchor = __toESM(require_cjs2(), 1);
|
|
91731
91903
|
import_anchor = __toESM(require_cjs2(), 1);
|
|
91732
91904
|
import_bn = __toESM(require_bn(), 1);
|
|
91733
91905
|
init_esm4();
|
|
91906
|
+
init_esm6();
|
|
91734
91907
|
init_constants2();
|
|
91735
91908
|
init_tx();
|
|
91736
91909
|
init_nara_agent_registry();
|
|
@@ -91738,6 +91911,7 @@ var init_agent_registry = __esm({
|
|
|
91738
91911
|
BUFFER_HEADER_SIZE = 144;
|
|
91739
91912
|
MEMORY_HEADER_SIZE = 104;
|
|
91740
91913
|
BIO_META_HEADER_SIZE = 72;
|
|
91914
|
+
AGENT_STATE_DISCRIMINATOR = Buffer.from([254, 187, 98, 119, 228, 48, 47, 49]);
|
|
91741
91915
|
}
|
|
91742
91916
|
});
|
|
91743
91917
|
|
|
@@ -171486,10 +171660,10 @@ var init_main3 = __esm({
|
|
|
171486
171660
|
}
|
|
171487
171661
|
});
|
|
171488
171662
|
|
|
171489
|
-
// node_modules/.pnpm/nara-sdk@1.0.
|
|
171663
|
+
// node_modules/.pnpm/nara-sdk@1.0.85_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0.22_typescript@5.9.3_utf-8-validate@6.0.6/node_modules/nara-sdk/src/quest.ts
|
|
171490
171664
|
var quest_exports = {};
|
|
171491
171665
|
__export(quest_exports, {
|
|
171492
|
-
|
|
171666
|
+
adjustBoostCredits: () => adjustBoostCredits,
|
|
171493
171667
|
claimAirdrop: () => claimAirdrop,
|
|
171494
171668
|
computeAnswerHash: () => computeAnswerHash,
|
|
171495
171669
|
createQuestion: () => createQuestion,
|
|
@@ -171499,7 +171673,7 @@ __export(quest_exports, {
|
|
|
171499
171673
|
getStakeInfo: () => getStakeInfo,
|
|
171500
171674
|
hasAnswered: () => hasAnswered,
|
|
171501
171675
|
initializeQuest: () => initializeQuest,
|
|
171502
|
-
|
|
171676
|
+
makeAdjustBoostCreditsIx: () => makeAdjustBoostCreditsIx,
|
|
171503
171677
|
makeCreateQuestionIx: () => makeCreateQuestionIx,
|
|
171504
171678
|
parseQuestReward: () => parseQuestReward,
|
|
171505
171679
|
setAirdropConfig: () => setAirdropConfig,
|
|
@@ -171679,8 +171853,6 @@ async function getQuestInfo(connection, wallet, options) {
|
|
|
171679
171853
|
);
|
|
171680
171854
|
const stakeRewardCount = pool.stakeRewardCount;
|
|
171681
171855
|
const stakeWinnerCount = pool.stakeWinnerCount;
|
|
171682
|
-
const creditRewardCount = pool.freeRewardCount;
|
|
171683
|
-
const creditWinnerCount = pool.freeWinnerCount;
|
|
171684
171856
|
return {
|
|
171685
171857
|
active,
|
|
171686
171858
|
round: pool.round.toString(),
|
|
@@ -171691,10 +171863,6 @@ async function getQuestInfo(connection, wallet, options) {
|
|
|
171691
171863
|
stakeWinnerCount,
|
|
171692
171864
|
stakeRewardPerWinner: pool.stakeRewardPerWinner.toNumber() / import_web396.LAMPORTS_PER_SOL,
|
|
171693
171865
|
stakeRemainingSlots: Math.max(0, stakeRewardCount - stakeWinnerCount),
|
|
171694
|
-
creditRewardCount,
|
|
171695
|
-
creditWinnerCount,
|
|
171696
|
-
creditRewardPerWinner: pool.freeRewardPerWinner.toNumber() / import_web396.LAMPORTS_PER_SOL,
|
|
171697
|
-
creditRemainingSlots: Math.max(0, creditRewardCount - creditWinnerCount),
|
|
171698
171866
|
difficulty: pool.difficulty,
|
|
171699
171867
|
deadline,
|
|
171700
171868
|
timeRemaining: secsLeft,
|
|
@@ -171747,31 +171915,16 @@ async function generateProof(answer, answerHash, userPubkey, round2, options) {
|
|
|
171747
171915
|
}
|
|
171748
171916
|
async function submitAnswer(connection, wallet, proof, agent = "", model = "", options, activityLog) {
|
|
171749
171917
|
const program3 = createProgram2(connection, wallet, options?.programId);
|
|
171918
|
+
const stakeInfo = await getStakeInfo(connection, wallet.publicKey, options);
|
|
171919
|
+
if (!stakeInfo || stakeInfo.boostCredits <= 0) {
|
|
171920
|
+
throw new Error(
|
|
171921
|
+
"Boost PoMI requires boost credits. Your balance is 0 \u2014 acquire credits before submitting an answer."
|
|
171922
|
+
);
|
|
171923
|
+
}
|
|
171750
171924
|
let stakeIx = null;
|
|
171751
|
-
if (options?.stake
|
|
171752
|
-
|
|
171753
|
-
|
|
171754
|
-
const quest = await getQuestInfo(connection, wallet, options);
|
|
171755
|
-
const stakeInfo = await getStakeInfo(connection, wallet.publicKey, options);
|
|
171756
|
-
const freeCredits = stakeInfo?.freeCredits ?? 0;
|
|
171757
|
-
if (freeCredits > 0) {
|
|
171758
|
-
stakeLamports = new import_bn2.default(0);
|
|
171759
|
-
} else {
|
|
171760
|
-
const required = quest.effectiveStakeRequirement;
|
|
171761
|
-
const current = stakeInfo?.amount ?? 0;
|
|
171762
|
-
const deficit = required - current;
|
|
171763
|
-
if (deficit > 0) {
|
|
171764
|
-
stakeLamports = new import_bn2.default(Math.round(deficit * import_web396.LAMPORTS_PER_SOL));
|
|
171765
|
-
} else {
|
|
171766
|
-
stakeLamports = new import_bn2.default(0);
|
|
171767
|
-
}
|
|
171768
|
-
}
|
|
171769
|
-
} else {
|
|
171770
|
-
stakeLamports = new import_bn2.default(Math.round(options.stake * import_web396.LAMPORTS_PER_SOL));
|
|
171771
|
-
}
|
|
171772
|
-
if (!stakeLamports.isZero()) {
|
|
171773
|
-
stakeIx = await program3.methods.stake(stakeLamports).accounts({ user: wallet.publicKey }).instruction();
|
|
171774
|
-
}
|
|
171925
|
+
if (typeof options?.stake === "number" && options.stake > 0) {
|
|
171926
|
+
const stakeLamports = new import_bn2.default(Math.round(options.stake * import_web396.LAMPORTS_PER_SOL));
|
|
171927
|
+
stakeIx = await program3.methods.stake(stakeLamports).accounts({ user: wallet.publicKey }).instruction();
|
|
171775
171928
|
}
|
|
171776
171929
|
const submitIx = await program3.methods.submitAnswer(proof.proofA, proof.proofB, proof.proofC, agent, model).accounts({ user: wallet.publicKey, payer: wallet.publicKey }).instruction();
|
|
171777
171930
|
const ixs = [];
|
|
@@ -171845,12 +171998,16 @@ async function parseQuestReward(connection, txSignature, retries = 10) {
|
|
|
171845
171998
|
let winner = "";
|
|
171846
171999
|
const logs = txInfo.meta?.logMessages ?? [];
|
|
171847
172000
|
for (const log3 of logs) {
|
|
171848
|
-
const m = log3.match(/reward (\d+) lamports \(winner (\d+\/\d+)
|
|
172001
|
+
const m = log3.match(/reward (\d+) lamports \(winner (\d+\/\d+)/);
|
|
171849
172002
|
if (m) {
|
|
171850
172003
|
rewardLamports = parseInt(m[1]);
|
|
171851
172004
|
winner = m[2];
|
|
171852
172005
|
break;
|
|
171853
172006
|
}
|
|
172007
|
+
const v = log3.match(/vault insufficient \(winner (\d+\/\d+)/);
|
|
172008
|
+
if (v) {
|
|
172009
|
+
winner = v[1];
|
|
172010
|
+
}
|
|
171854
172011
|
}
|
|
171855
172012
|
return {
|
|
171856
172013
|
rewarded: rewardLamports > 0,
|
|
@@ -171906,7 +172063,8 @@ async function getStakeInfo(connection, user, options) {
|
|
|
171906
172063
|
return {
|
|
171907
172064
|
amount,
|
|
171908
172065
|
stakeRound: record.stakeRound.toNumber(),
|
|
171909
|
-
|
|
172066
|
+
boostCredits: record.boostCredits,
|
|
172067
|
+
userPubkey: record.userPubkey.toBase58()
|
|
171910
172068
|
};
|
|
171911
172069
|
}
|
|
171912
172070
|
async function makeCreateQuestionIx(connection, caller, question, answer, deadlineSeconds, difficulty = 1, options) {
|
|
@@ -171933,7 +172091,7 @@ async function initializeQuest(connection, wallet, options) {
|
|
|
171933
172091
|
const ix = await program3.methods.initialize().accounts({ authority: wallet.publicKey }).instruction();
|
|
171934
172092
|
return sendTx(connection, wallet, [ix]);
|
|
171935
172093
|
}
|
|
171936
|
-
async function setRewardConfig(connection, wallet, minRewardCount, maxRewardCount, freeStakeMultiplier, options) {
|
|
172094
|
+
async function setRewardConfig(connection, wallet, minRewardCount, maxRewardCount, freeStakeMultiplier = 1, options) {
|
|
171937
172095
|
const program3 = createProgram2(connection, wallet, options?.programId);
|
|
171938
172096
|
const ix = await program3.methods.setRewardConfig(minRewardCount, maxRewardCount, freeStakeMultiplier).accounts({ authority: wallet.publicKey }).instruction();
|
|
171939
172097
|
return sendTx(connection, wallet, [ix]);
|
|
@@ -171988,8 +172146,7 @@ async function getQuestConfig(connection, options) {
|
|
|
171988
172146
|
extraReward: Number(config2.extraReward.toString()),
|
|
171989
172147
|
stakeAuthority: config2.stakeAuthority,
|
|
171990
172148
|
airdropAmount: Number(config2.airdropAmount.toString()),
|
|
171991
|
-
maxAirdropCount: config2.maxAirdropCount
|
|
171992
|
-
freeStakeMultiplier: config2.freeStakeMultiplier
|
|
172149
|
+
maxAirdropCount: config2.maxAirdropCount
|
|
171993
172150
|
};
|
|
171994
172151
|
}
|
|
171995
172152
|
async function setStakeAuthority(connection, wallet, newStakeAuthority, options) {
|
|
@@ -171997,12 +172154,12 @@ async function setStakeAuthority(connection, wallet, newStakeAuthority, options)
|
|
|
171997
172154
|
const ix = await program3.methods.setStakeAuthority(newStakeAuthority).accounts({ authority: wallet.publicKey }).instruction();
|
|
171998
172155
|
return sendTx(connection, wallet, [ix]);
|
|
171999
172156
|
}
|
|
172000
|
-
async function
|
|
172157
|
+
async function makeAdjustBoostCreditsIx(connection, caller, user, delta, reason, options) {
|
|
172001
172158
|
const program3 = createProgram2(connection, import_web396.Keypair.generate(), options?.programId);
|
|
172002
172159
|
return program3.methods.adjustFreeStake(delta, reason).accounts({ user, caller }).instruction();
|
|
172003
172160
|
}
|
|
172004
|
-
async function
|
|
172005
|
-
const ix = await
|
|
172161
|
+
async function adjustBoostCredits(connection, wallet, user, delta, reason, options) {
|
|
172162
|
+
const ix = await makeAdjustBoostCreditsIx(connection, wallet.publicKey, user, delta, reason, options);
|
|
172006
172163
|
return sendTx(connection, wallet, [ix]);
|
|
172007
172164
|
}
|
|
172008
172165
|
async function claimAirdrop(connection, wallet, user, proof, options) {
|
|
@@ -172018,7 +172175,7 @@ async function setAirdropConfig(connection, wallet, airdropAmount, maxAirdropCou
|
|
|
172018
172175
|
}
|
|
172019
172176
|
var import_web396, anchor2, import_anchor2, import_bn2, import_meta, BN254_FIELD, WSOL_MINT;
|
|
172020
172177
|
var init_quest = __esm({
|
|
172021
|
-
"node_modules/.pnpm/nara-sdk@1.0.
|
|
172178
|
+
"node_modules/.pnpm/nara-sdk@1.0.85_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0.22_typescript@5.9.3_utf-8-validate@6.0.6/node_modules/nara-sdk/src/quest.ts"() {
|
|
172022
172179
|
import_web396 = __toESM(require_index_cjs(), 1);
|
|
172023
172180
|
init_esm4();
|
|
172024
172181
|
anchor2 = __toESM(require_cjs2(), 1);
|
|
@@ -266528,143 +266685,9 @@ var import_ed25519_hd_key = __toESM(require_dist3());
|
|
|
266528
266685
|
var import_node_path3 = require("node:path");
|
|
266529
266686
|
var import_node_os3 = require("node:os");
|
|
266530
266687
|
var import_promises = require("node:fs/promises");
|
|
266688
|
+
init_esm6();
|
|
266531
266689
|
|
|
266532
|
-
// node_modules/.pnpm/
|
|
266533
|
-
function base(ALPHABET2) {
|
|
266534
|
-
if (ALPHABET2.length >= 255) {
|
|
266535
|
-
throw new TypeError("Alphabet too long");
|
|
266536
|
-
}
|
|
266537
|
-
const BASE_MAP = new Uint8Array(256);
|
|
266538
|
-
for (let j2 = 0; j2 < BASE_MAP.length; j2++) {
|
|
266539
|
-
BASE_MAP[j2] = 255;
|
|
266540
|
-
}
|
|
266541
|
-
for (let i = 0; i < ALPHABET2.length; i++) {
|
|
266542
|
-
const x3 = ALPHABET2.charAt(i);
|
|
266543
|
-
const xc = x3.charCodeAt(0);
|
|
266544
|
-
if (BASE_MAP[xc] !== 255) {
|
|
266545
|
-
throw new TypeError(x3 + " is ambiguous");
|
|
266546
|
-
}
|
|
266547
|
-
BASE_MAP[xc] = i;
|
|
266548
|
-
}
|
|
266549
|
-
const BASE3 = ALPHABET2.length;
|
|
266550
|
-
const LEADER = ALPHABET2.charAt(0);
|
|
266551
|
-
const FACTOR = Math.log(BASE3) / Math.log(256);
|
|
266552
|
-
const iFACTOR = Math.log(256) / Math.log(BASE3);
|
|
266553
|
-
function encode(source) {
|
|
266554
|
-
if (source instanceof Uint8Array) {
|
|
266555
|
-
} else if (ArrayBuffer.isView(source)) {
|
|
266556
|
-
source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
|
|
266557
|
-
} else if (Array.isArray(source)) {
|
|
266558
|
-
source = Uint8Array.from(source);
|
|
266559
|
-
}
|
|
266560
|
-
if (!(source instanceof Uint8Array)) {
|
|
266561
|
-
throw new TypeError("Expected Uint8Array");
|
|
266562
|
-
}
|
|
266563
|
-
if (source.length === 0) {
|
|
266564
|
-
return "";
|
|
266565
|
-
}
|
|
266566
|
-
let zeroes = 0;
|
|
266567
|
-
let length = 0;
|
|
266568
|
-
let pbegin = 0;
|
|
266569
|
-
const pend = source.length;
|
|
266570
|
-
while (pbegin !== pend && source[pbegin] === 0) {
|
|
266571
|
-
pbegin++;
|
|
266572
|
-
zeroes++;
|
|
266573
|
-
}
|
|
266574
|
-
const size = (pend - pbegin) * iFACTOR + 1 >>> 0;
|
|
266575
|
-
const b58 = new Uint8Array(size);
|
|
266576
|
-
while (pbegin !== pend) {
|
|
266577
|
-
let carry = source[pbegin];
|
|
266578
|
-
let i = 0;
|
|
266579
|
-
for (let it1 = size - 1; (carry !== 0 || i < length) && it1 !== -1; it1--, i++) {
|
|
266580
|
-
carry += 256 * b58[it1] >>> 0;
|
|
266581
|
-
b58[it1] = carry % BASE3 >>> 0;
|
|
266582
|
-
carry = carry / BASE3 >>> 0;
|
|
266583
|
-
}
|
|
266584
|
-
if (carry !== 0) {
|
|
266585
|
-
throw new Error("Non-zero carry");
|
|
266586
|
-
}
|
|
266587
|
-
length = i;
|
|
266588
|
-
pbegin++;
|
|
266589
|
-
}
|
|
266590
|
-
let it2 = size - length;
|
|
266591
|
-
while (it2 !== size && b58[it2] === 0) {
|
|
266592
|
-
it2++;
|
|
266593
|
-
}
|
|
266594
|
-
let str = LEADER.repeat(zeroes);
|
|
266595
|
-
for (; it2 < size; ++it2) {
|
|
266596
|
-
str += ALPHABET2.charAt(b58[it2]);
|
|
266597
|
-
}
|
|
266598
|
-
return str;
|
|
266599
|
-
}
|
|
266600
|
-
function decodeUnsafe(source) {
|
|
266601
|
-
if (typeof source !== "string") {
|
|
266602
|
-
throw new TypeError("Expected String");
|
|
266603
|
-
}
|
|
266604
|
-
if (source.length === 0) {
|
|
266605
|
-
return new Uint8Array();
|
|
266606
|
-
}
|
|
266607
|
-
let psz = 0;
|
|
266608
|
-
let zeroes = 0;
|
|
266609
|
-
let length = 0;
|
|
266610
|
-
while (source[psz] === LEADER) {
|
|
266611
|
-
zeroes++;
|
|
266612
|
-
psz++;
|
|
266613
|
-
}
|
|
266614
|
-
const size = (source.length - psz) * FACTOR + 1 >>> 0;
|
|
266615
|
-
const b256 = new Uint8Array(size);
|
|
266616
|
-
while (psz < source.length) {
|
|
266617
|
-
const charCode = source.charCodeAt(psz);
|
|
266618
|
-
if (charCode > 255) {
|
|
266619
|
-
return;
|
|
266620
|
-
}
|
|
266621
|
-
let carry = BASE_MAP[charCode];
|
|
266622
|
-
if (carry === 255) {
|
|
266623
|
-
return;
|
|
266624
|
-
}
|
|
266625
|
-
let i = 0;
|
|
266626
|
-
for (let it3 = size - 1; (carry !== 0 || i < length) && it3 !== -1; it3--, i++) {
|
|
266627
|
-
carry += BASE3 * b256[it3] >>> 0;
|
|
266628
|
-
b256[it3] = carry % 256 >>> 0;
|
|
266629
|
-
carry = carry / 256 >>> 0;
|
|
266630
|
-
}
|
|
266631
|
-
if (carry !== 0) {
|
|
266632
|
-
throw new Error("Non-zero carry");
|
|
266633
|
-
}
|
|
266634
|
-
length = i;
|
|
266635
|
-
psz++;
|
|
266636
|
-
}
|
|
266637
|
-
let it4 = size - length;
|
|
266638
|
-
while (it4 !== size && b256[it4] === 0) {
|
|
266639
|
-
it4++;
|
|
266640
|
-
}
|
|
266641
|
-
const vch = new Uint8Array(zeroes + (size - it4));
|
|
266642
|
-
let j2 = zeroes;
|
|
266643
|
-
while (it4 !== size) {
|
|
266644
|
-
vch[j2++] = b256[it4++];
|
|
266645
|
-
}
|
|
266646
|
-
return vch;
|
|
266647
|
-
}
|
|
266648
|
-
function decode(string2) {
|
|
266649
|
-
const buffer = decodeUnsafe(string2);
|
|
266650
|
-
if (buffer) {
|
|
266651
|
-
return buffer;
|
|
266652
|
-
}
|
|
266653
|
-
throw new Error("Non-base" + BASE3 + " character");
|
|
266654
|
-
}
|
|
266655
|
-
return {
|
|
266656
|
-
encode,
|
|
266657
|
-
decodeUnsafe,
|
|
266658
|
-
decode
|
|
266659
|
-
};
|
|
266660
|
-
}
|
|
266661
|
-
var esm_default = base;
|
|
266662
|
-
|
|
266663
|
-
// node_modules/.pnpm/bs58@6.0.0/node_modules/bs58/src/esm/index.js
|
|
266664
|
-
var ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
266665
|
-
var esm_default2 = esm_default(ALPHABET);
|
|
266666
|
-
|
|
266667
|
-
// node_modules/.pnpm/nara-sdk@1.0.84_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0.22_typescript@5.9.3_utf-8-validate@6.0.6/node_modules/nara-sdk/src/client.ts
|
|
266690
|
+
// node_modules/.pnpm/nara-sdk@1.0.85_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0.22_typescript@5.9.3_utf-8-validate@6.0.6/node_modules/nara-sdk/src/client.ts
|
|
266668
266691
|
var import_web393 = __toESM(require_index_cjs(), 1);
|
|
266669
266692
|
var NaraSDK = class {
|
|
266670
266693
|
connection;
|
|
@@ -266679,11 +266702,12 @@ var NaraSDK = class {
|
|
|
266679
266702
|
}
|
|
266680
266703
|
};
|
|
266681
266704
|
|
|
266682
|
-
// node_modules/.pnpm/nara-sdk@1.0.
|
|
266705
|
+
// node_modules/.pnpm/nara-sdk@1.0.85_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0.22_typescript@5.9.3_utf-8-validate@6.0.6/node_modules/nara-sdk/index.ts
|
|
266683
266706
|
init_constants2();
|
|
266684
266707
|
|
|
266685
|
-
// node_modules/.pnpm/nara-sdk@1.0.
|
|
266708
|
+
// node_modules/.pnpm/nara-sdk@1.0.85_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0.22_typescript@5.9.3_utf-8-validate@6.0.6/node_modules/nara-sdk/src/sign.ts
|
|
266686
266709
|
var import_tweetnacl = __toESM(require_nacl_fast(), 1);
|
|
266710
|
+
init_esm6();
|
|
266687
266711
|
function buildSignMessage(params) {
|
|
266688
266712
|
return Object.keys(params).filter((k2) => k2 !== "sign").sort().map((k2) => `${k2}=${params[k2]}`).join("&");
|
|
266689
266713
|
}
|
|
@@ -266710,17 +266734,17 @@ function signUrl(baseUrl, wallet, params) {
|
|
|
266710
266734
|
return url.toString();
|
|
266711
266735
|
}
|
|
266712
266736
|
|
|
266713
|
-
// node_modules/.pnpm/nara-sdk@1.0.
|
|
266737
|
+
// node_modules/.pnpm/nara-sdk@1.0.85_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0.22_typescript@5.9.3_utf-8-validate@6.0.6/node_modules/nara-sdk/index.ts
|
|
266714
266738
|
init_tx();
|
|
266715
266739
|
init_quest();
|
|
266716
266740
|
|
|
266717
|
-
// node_modules/.pnpm/nara-sdk@1.0.
|
|
266741
|
+
// node_modules/.pnpm/nara-sdk@1.0.85_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0.22_typescript@5.9.3_utf-8-validate@6.0.6/node_modules/nara-sdk/src/skills.ts
|
|
266718
266742
|
var import_web397 = __toESM(require_index_cjs(), 1);
|
|
266719
266743
|
var anchor3 = __toESM(require_cjs2(), 1);
|
|
266720
266744
|
var import_anchor3 = __toESM(require_cjs2(), 1);
|
|
266721
266745
|
init_constants2();
|
|
266722
266746
|
|
|
266723
|
-
// node_modules/.pnpm/nara-sdk@1.0.
|
|
266747
|
+
// node_modules/.pnpm/nara-sdk@1.0.85_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0.22_typescript@5.9.3_utf-8-validate@6.0.6/node_modules/nara-sdk/src/idls/nara_skills_hub.json
|
|
266724
266748
|
var nara_skills_hub_default = {
|
|
266725
266749
|
address: "SkiLLHub11111111111111111111111111111111111",
|
|
266726
266750
|
metadata: {
|
|
@@ -268118,7 +268142,7 @@ var nara_skills_hub_default = {
|
|
|
268118
268142
|
]
|
|
268119
268143
|
};
|
|
268120
268144
|
|
|
268121
|
-
// node_modules/.pnpm/nara-sdk@1.0.
|
|
268145
|
+
// node_modules/.pnpm/nara-sdk@1.0.85_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0.22_typescript@5.9.3_utf-8-validate@6.0.6/node_modules/nara-sdk/src/skills.ts
|
|
268122
268146
|
init_tx();
|
|
268123
268147
|
var DEFAULT_CHUNK_SIZE2 = 800;
|
|
268124
268148
|
var BUFFER_HEADER_SIZE2 = 144;
|
|
@@ -268348,7 +268372,7 @@ async function uploadSkillContent(connection, wallet, name, content, options) {
|
|
|
268348
268372
|
}
|
|
268349
268373
|
}
|
|
268350
268374
|
|
|
268351
|
-
// node_modules/.pnpm/nara-sdk@1.0.
|
|
268375
|
+
// node_modules/.pnpm/nara-sdk@1.0.85_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0.22_typescript@5.9.3_utf-8-validate@6.0.6/node_modules/nara-sdk/src/zkid.ts
|
|
268352
268376
|
var import_web398 = __toESM(require_index_cjs(), 1);
|
|
268353
268377
|
var anchor4 = __toESM(require_cjs2(), 1);
|
|
268354
268378
|
var import_anchor4 = __toESM(require_cjs2(), 1);
|
|
@@ -268358,7 +268382,7 @@ var import_bn3 = __toESM(require_bn(), 1);
|
|
|
268358
268382
|
init_constants2();
|
|
268359
268383
|
init_tx();
|
|
268360
268384
|
|
|
268361
|
-
// node_modules/.pnpm/nara-sdk@1.0.
|
|
268385
|
+
// node_modules/.pnpm/nara-sdk@1.0.85_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0.22_typescript@5.9.3_utf-8-validate@6.0.6/node_modules/nara-sdk/src/idls/nara_zk.json
|
|
268362
268386
|
var nara_zk_default = {
|
|
268363
268387
|
address: "ZKidentity111111111111111111111111111111111",
|
|
268364
268388
|
metadata: {
|
|
@@ -269569,7 +269593,7 @@ var nara_zk_default = {
|
|
|
269569
269593
|
]
|
|
269570
269594
|
};
|
|
269571
269595
|
|
|
269572
|
-
// node_modules/.pnpm/nara-sdk@1.0.
|
|
269596
|
+
// node_modules/.pnpm/nara-sdk@1.0.85_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0.22_typescript@5.9.3_utf-8-validate@6.0.6/node_modules/nara-sdk/src/zkid.ts
|
|
269573
269597
|
var import_meta2 = {};
|
|
269574
269598
|
var BN254_PRIME = 21888242871839275222246405745257275088696311157297823662689037894645226208583n;
|
|
269575
269599
|
var MERKLE_LEVELS = 64;
|
|
@@ -269931,10 +269955,10 @@ async function transferZkIdByCommitment(connection, payer, name, currentIdSecret
|
|
|
269931
269955
|
return sendTx(connection, payer, [ix]);
|
|
269932
269956
|
}
|
|
269933
269957
|
|
|
269934
|
-
// node_modules/.pnpm/nara-sdk@1.0.
|
|
269958
|
+
// node_modules/.pnpm/nara-sdk@1.0.85_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0.22_typescript@5.9.3_utf-8-validate@6.0.6/node_modules/nara-sdk/index.ts
|
|
269935
269959
|
init_agent_registry();
|
|
269936
269960
|
|
|
269937
|
-
// node_modules/.pnpm/nara-sdk@1.0.
|
|
269961
|
+
// node_modules/.pnpm/nara-sdk@1.0.85_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0.22_typescript@5.9.3_utf-8-validate@6.0.6/node_modules/nara-sdk/src/bridge.ts
|
|
269938
269962
|
var import_web399 = __toESM(require_index_cjs(), 1);
|
|
269939
269963
|
init_esm4();
|
|
269940
269964
|
init_constants2();
|
|
@@ -270426,7 +270450,7 @@ async function scanValidator(folder, messageId, maxScan) {
|
|
|
270426
270450
|
};
|
|
270427
270451
|
}
|
|
270428
270452
|
|
|
270429
|
-
// node_modules/.pnpm/nara-sdk@1.0.
|
|
270453
|
+
// node_modules/.pnpm/nara-sdk@1.0.85_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0.22_typescript@5.9.3_utf-8-validate@6.0.6/node_modules/nara-sdk/src/tx_parser.ts
|
|
270430
270454
|
var import_web3100 = __toESM(require_index_cjs(), 1);
|
|
270431
270455
|
init_esm4();
|
|
270432
270456
|
init_constants2();
|
|
@@ -270550,7 +270574,7 @@ function buildAnchorDiscriminators() {
|
|
|
270550
270574
|
}
|
|
270551
270575
|
var anchorDiscs = buildAnchorDiscriminators();
|
|
270552
270576
|
|
|
270553
|
-
// node_modules/.pnpm/nara-sdk@1.0.
|
|
270577
|
+
// node_modules/.pnpm/nara-sdk@1.0.85_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0.22_typescript@5.9.3_utf-8-validate@6.0.6/node_modules/nara-sdk/index.ts
|
|
270554
270578
|
var import_web3101 = __toESM(require_index_cjs(), 1);
|
|
270555
270579
|
var import_bn4 = __toESM(require_bn(), 1);
|
|
270556
270580
|
|
|
@@ -271335,7 +271359,8 @@ var QUEST_ERRORS = {
|
|
|
271335
271359
|
6008: "invalidMinRewardCount",
|
|
271336
271360
|
6009: "invalidMaxRewardCount",
|
|
271337
271361
|
6010: "unstakeNotReady",
|
|
271338
|
-
6011: "insufficientStakeBalance"
|
|
271362
|
+
6011: "insufficientStakeBalance",
|
|
271363
|
+
6024: "noCredits"
|
|
271339
271364
|
};
|
|
271340
271365
|
function anchorErrorCode(err) {
|
|
271341
271366
|
const code = err?.error?.errorCode?.code;
|
|
@@ -271345,6 +271370,7 @@ function anchorErrorCode(err) {
|
|
|
271345
271370
|
if (m) return QUEST_ERRORS[parseInt(m[1])] ?? "";
|
|
271346
271371
|
return "";
|
|
271347
271372
|
}
|
|
271373
|
+
var STAKE_DEPRECATION_NOTICE = "PoMI has been upgraded to Boost PoMI \u2014 mining is now gated by boost credits, not stake. The stake channel is being phased out; please unstake your NARA soon.";
|
|
271348
271374
|
function formatTimeRemaining(seconds) {
|
|
271349
271375
|
if (seconds <= 0) return "expired";
|
|
271350
271376
|
const m = Math.floor(seconds / 60);
|
|
@@ -271375,12 +271401,11 @@ async function handleQuestGet(options) {
|
|
|
271375
271401
|
}
|
|
271376
271402
|
return;
|
|
271377
271403
|
}
|
|
271378
|
-
|
|
271379
|
-
let freeCredits = 0;
|
|
271404
|
+
let boostCredits = 0;
|
|
271380
271405
|
try {
|
|
271381
271406
|
const stakeInfo = await getStakeInfo(connection, wallet.publicKey);
|
|
271382
271407
|
if (stakeInfo) {
|
|
271383
|
-
|
|
271408
|
+
boostCredits = stakeInfo.boostCredits;
|
|
271384
271409
|
}
|
|
271385
271410
|
} catch {
|
|
271386
271411
|
}
|
|
@@ -271389,21 +271414,13 @@ async function handleQuestGet(options) {
|
|
|
271389
271414
|
question: quest.question,
|
|
271390
271415
|
difficulty: quest.difficulty,
|
|
271391
271416
|
totalReward: `${quest.totalReward} NARA`,
|
|
271392
|
-
|
|
271393
|
-
|
|
271394
|
-
|
|
271395
|
-
creditRewardPerWinner: `${quest.creditRewardPerWinner} NARA`,
|
|
271396
|
-
creditRewardSlots: `${quest.creditWinnerCount}/${quest.creditRewardCount}`,
|
|
271397
|
-
creditRemainingSlots: quest.creditRemainingSlots,
|
|
271417
|
+
rewardPerWinner: `${quest.stakeRewardPerWinner} NARA`,
|
|
271418
|
+
rewardSlots: `${quest.stakeWinnerCount}/${quest.stakeRewardCount}`,
|
|
271419
|
+
remainingSlots: quest.stakeRemainingSlots,
|
|
271398
271420
|
deadline: new Date(quest.deadline * 1e3).toLocaleString(),
|
|
271399
271421
|
timeRemaining: formatTimeRemaining(quest.timeRemaining),
|
|
271400
271422
|
expired: quest.expired,
|
|
271401
|
-
|
|
271402
|
-
stakeRequirement: stakeRequired ? `${quest.effectiveStakeRequirement.toFixed(9).replace(/\.?0+$/, "")} NARA` : "0 NARA",
|
|
271403
|
-
stakeHigh: `${quest.stakeHigh} NARA`,
|
|
271404
|
-
stakeLow: `${quest.stakeLow} NARA`,
|
|
271405
|
-
avgParticipantStake: `${quest.avgParticipantStake} NARA`,
|
|
271406
|
-
freeCredits
|
|
271423
|
+
boostCredits
|
|
271407
271424
|
};
|
|
271408
271425
|
if (options.json) {
|
|
271409
271426
|
formatOutput(data, true);
|
|
@@ -271414,19 +271431,9 @@ async function handleQuestGet(options) {
|
|
|
271414
271431
|
console.log(` Difficulty: ${quest.difficulty}`);
|
|
271415
271432
|
console.log(` Total reward: ${quest.totalReward} NARA`);
|
|
271416
271433
|
console.log(
|
|
271417
|
-
`
|
|
271434
|
+
` Boost PoMI reward: ${quest.stakeRewardPerWinner} NARA/winner, ${quest.stakeWinnerCount}/${quest.stakeRewardCount} (${quest.stakeRemainingSlots} remaining)`
|
|
271418
271435
|
);
|
|
271419
|
-
console.log(
|
|
271420
|
-
` Boost reward: ${quest.creditRewardPerWinner} NARA/winner, ${quest.creditWinnerCount}/${quest.creditRewardCount} (${quest.creditRemainingSlots} remaining)`
|
|
271421
|
-
);
|
|
271422
|
-
if (stakeRequired) {
|
|
271423
|
-
console.log(` Stake requirement: ${quest.effectiveStakeRequirement.toFixed(9).replace(/\.?0+$/, "")} NARA (decays ${quest.stakeHigh} \u2192 ${quest.stakeLow})`);
|
|
271424
|
-
} else if (options.verbose) {
|
|
271425
|
-
console.log(` Stake requirement: none (${quest.effectiveStakeRequirement.toFixed(9).replace(/\.?0+$/, "")} NARA, decays ${quest.stakeHigh} \u2192 ${quest.stakeLow})`);
|
|
271426
|
-
} else {
|
|
271427
|
-
console.log(` Stake requirement: none`);
|
|
271428
|
-
}
|
|
271429
|
-
console.log(` Boost credits: ${freeCredits}`);
|
|
271436
|
+
console.log(` Boost credits: ${boostCredits}${boostCredits === 0 ? " (required to answer \u2014 acquire credits first)" : ""}`);
|
|
271430
271437
|
console.log(` Deadline: ${new Date(quest.deadline * 1e3).toLocaleString()}`);
|
|
271431
271438
|
if (quest.timeRemaining > 0) {
|
|
271432
271439
|
console.log(` Time remaining: ${formatTimeRemaining(quest.timeRemaining)}`);
|
|
@@ -271462,8 +271469,7 @@ async function handleQuestConfig(options) {
|
|
|
271462
271469
|
stakeBpsHigh,
|
|
271463
271470
|
stakeBpsLow,
|
|
271464
271471
|
decayMs: config2.decayMs,
|
|
271465
|
-
minQuestInterval: config2.minQuestInterval
|
|
271466
|
-
freeStakeMultiplier: config2.freeStakeMultiplier
|
|
271472
|
+
minQuestInterval: config2.minQuestInterval
|
|
271467
271473
|
};
|
|
271468
271474
|
if (options.json) {
|
|
271469
271475
|
formatOutput(data, true);
|
|
@@ -271477,7 +271483,6 @@ async function handleQuestConfig(options) {
|
|
|
271477
271483
|
console.log(` Stake BPS Low: ${stakeBpsLow / 100}% (${stakeBpsLow} BPS)`);
|
|
271478
271484
|
console.log(` Decay (ms): ${data.decayMs}`);
|
|
271479
271485
|
console.log(` Min Quest Interval: ${data.minQuestInterval}s`);
|
|
271480
|
-
console.log(` Free Stake Multiplier: ${data.freeStakeMultiplier}x`);
|
|
271481
271486
|
console.log("");
|
|
271482
271487
|
}
|
|
271483
271488
|
}
|
|
@@ -271551,8 +271556,7 @@ async function handleQuestAnswer(answer, options) {
|
|
|
271551
271556
|
if (configAgentId) {
|
|
271552
271557
|
activityLog = { agentId: configAgentId, activity: "PoMI", model, log: "", referralAgentId: referral };
|
|
271553
271558
|
}
|
|
271554
|
-
const
|
|
271555
|
-
const result = await submitAnswer(connection, wallet, proof.solana, agent, model, stakeOpt !== void 0 ? { stake: stakeOpt } : void 0, activityLog);
|
|
271559
|
+
const result = await submitAnswer(connection, wallet, proof.solana, agent, model, void 0, activityLog);
|
|
271556
271560
|
printSuccess("Answer submitted!");
|
|
271557
271561
|
console.log(` Transaction: ${result.signature}`);
|
|
271558
271562
|
await handleReward(connection, result.signature, options);
|
|
@@ -271570,11 +271574,12 @@ async function handleQuestStake(amount, options) {
|
|
|
271570
271574
|
printError("Amount must be a positive number");
|
|
271571
271575
|
process.exit(1);
|
|
271572
271576
|
}
|
|
271577
|
+
if (!options.json) printWarning(STAKE_DEPRECATION_NOTICE);
|
|
271573
271578
|
if (!options.json) printInfo(`Staking ${n} NARA...`);
|
|
271574
271579
|
const signature = await stake(connection, wallet, n);
|
|
271575
271580
|
if (!options.json) printSuccess(`Staked ${n} NARA!`);
|
|
271576
271581
|
if (options.json) {
|
|
271577
|
-
formatOutput({ amount: n, signature }, true);
|
|
271582
|
+
formatOutput({ amount: n, signature, notice: STAKE_DEPRECATION_NOTICE }, true);
|
|
271578
271583
|
} else {
|
|
271579
271584
|
console.log(` Transaction: ${signature}`);
|
|
271580
271585
|
}
|
|
@@ -271588,11 +271593,12 @@ async function handleQuestUnstake(amount, options) {
|
|
|
271588
271593
|
printError("Amount must be a positive number");
|
|
271589
271594
|
process.exit(1);
|
|
271590
271595
|
}
|
|
271596
|
+
if (!options.json) printWarning(STAKE_DEPRECATION_NOTICE);
|
|
271591
271597
|
if (!options.json) printInfo(`Unstaking ${n} NARA...`);
|
|
271592
271598
|
const signature = await unstake(connection, wallet, n);
|
|
271593
271599
|
if (!options.json) printSuccess(`Unstaked ${n} NARA!`);
|
|
271594
271600
|
if (options.json) {
|
|
271595
|
-
formatOutput({ amount: n, signature }, true);
|
|
271601
|
+
formatOutput({ amount: n, signature, notice: STAKE_DEPRECATION_NOTICE }, true);
|
|
271596
271602
|
} else {
|
|
271597
271603
|
console.log(` Transaction: ${signature}`);
|
|
271598
271604
|
}
|
|
@@ -271611,12 +271617,20 @@ async function handleQuestStakeInfo(options) {
|
|
|
271611
271617
|
return;
|
|
271612
271618
|
}
|
|
271613
271619
|
if (options.json) {
|
|
271614
|
-
formatOutput({
|
|
271620
|
+
formatOutput({
|
|
271621
|
+
staked: true,
|
|
271622
|
+
amount: stakeInfo.amount,
|
|
271623
|
+
stakeRound: stakeInfo.stakeRound,
|
|
271624
|
+
boostCredits: stakeInfo.boostCredits,
|
|
271625
|
+
notice: stakeInfo.amount > 0 ? STAKE_DEPRECATION_NOTICE : void 0
|
|
271626
|
+
}, true);
|
|
271615
271627
|
} else {
|
|
271616
271628
|
console.log("");
|
|
271617
271629
|
console.log(` Staked: ${stakeInfo.amount} NARA`);
|
|
271618
271630
|
console.log(` Stake round: ${stakeInfo.stakeRound}`);
|
|
271631
|
+
console.log(` Boost credits: ${stakeInfo.boostCredits}`);
|
|
271619
271632
|
console.log("");
|
|
271633
|
+
if (stakeInfo.amount > 0) printWarning(STAKE_DEPRECATION_NOTICE);
|
|
271620
271634
|
}
|
|
271621
271635
|
}
|
|
271622
271636
|
async function handleReward(connection, txSignature, options) {
|
|
@@ -271676,6 +271690,9 @@ function handleSubmitError(err) {
|
|
|
271676
271690
|
case "insufficientStakeBalance":
|
|
271677
271691
|
printError("Unstake amount exceeds staked balance");
|
|
271678
271692
|
break;
|
|
271693
|
+
case "noCredits":
|
|
271694
|
+
printError("Boost PoMI requires boost credits. Acquire credits before submitting an answer.");
|
|
271695
|
+
break;
|
|
271679
271696
|
default:
|
|
271680
271697
|
printError(`Failed to submit answer: ${err.message ?? String(err)}`);
|
|
271681
271698
|
if (err.logs) {
|
|
@@ -271687,27 +271704,26 @@ function handleSubmitError(err) {
|
|
|
271687
271704
|
}
|
|
271688
271705
|
function registerQuestCommands(program3) {
|
|
271689
271706
|
const quest = program3.command("quest").description("PoMI quest commands \u2014 mine NARA by answering on-chain quests with ZK proofs");
|
|
271690
|
-
quest.command("get").description("Get current quest info (question, deadline, difficulty,
|
|
271707
|
+
quest.command("get").description("Get current quest info (question, deadline, difficulty, boost credits)").action(async (_opts, cmd) => {
|
|
271691
271708
|
try {
|
|
271692
271709
|
const globalOpts = cmd.optsWithGlobals();
|
|
271693
|
-
await handleQuestGet(
|
|
271710
|
+
await handleQuestGet(globalOpts);
|
|
271694
271711
|
} catch (error) {
|
|
271695
271712
|
printError(error.message);
|
|
271696
271713
|
process.exit(1);
|
|
271697
271714
|
}
|
|
271698
271715
|
});
|
|
271699
|
-
quest.command("answer <answer>").description("Submit a quest answer with ZK proof.
|
|
271716
|
+
quest.command("answer <answer>").description("Submit a quest answer with ZK proof. Requires boost credits. Use --relay when balance is 0 (gasless). Always pass --agent and --model for reward tracking.").option("--relay [url]", `Submit via gasless relay (default: ${DEFAULT_QUEST_RELAY_URL2}, backup: https://quest2-api.nara.build/)`).option("--agent <name>", "Agent/platform type: claude-code, cursor, chatgpt, openclaw, etc. (default: naracli)").option("--model <name>", "AI model used: claude-opus-4-6, claude-sonnet-4-6, gpt-4o, etc.").option("--referral <agent-id>", "Referral agent ID for earning referral points").action(async (answer, opts, cmd) => {
|
|
271700
271717
|
try {
|
|
271701
271718
|
const globalOpts = cmd.optsWithGlobals();
|
|
271702
271719
|
const relayUrl = opts.relay === true ? DEFAULT_QUEST_RELAY_URL2 : opts.relay;
|
|
271703
|
-
|
|
271704
|
-
await handleQuestAnswer(answer, { ...globalOpts, relay: relayUrl, agent: opts.agent, model: opts.model, referral: opts.referral, stake: stakeVal });
|
|
271720
|
+
await handleQuestAnswer(answer, { ...globalOpts, relay: relayUrl, agent: opts.agent, model: opts.model, referral: opts.referral });
|
|
271705
271721
|
} catch (error) {
|
|
271706
271722
|
printError(error.message);
|
|
271707
271723
|
process.exit(1);
|
|
271708
271724
|
}
|
|
271709
271725
|
});
|
|
271710
|
-
quest.command("config").description("Show quest program config (reward counts,
|
|
271726
|
+
quest.command("config").description("Show quest program config (reward counts, decay, intervals)").action(async (_opts, cmd) => {
|
|
271711
271727
|
try {
|
|
271712
271728
|
const globalOpts = cmd.optsWithGlobals();
|
|
271713
271729
|
await handleQuestConfig(globalOpts);
|
|
@@ -271734,7 +271750,7 @@ function registerQuestCommands(program3) {
|
|
|
271734
271750
|
process.exit(1);
|
|
271735
271751
|
}
|
|
271736
271752
|
});
|
|
271737
|
-
quest.command("stake-info").description("Get your current quest stake info").action(async (_opts, cmd) => {
|
|
271753
|
+
quest.command("stake-info").description("Get your current quest stake info (stake balance + boost credits)").action(async (_opts, cmd) => {
|
|
271738
271754
|
try {
|
|
271739
271755
|
const globalOpts = cmd.optsWithGlobals();
|
|
271740
271756
|
await handleQuestStakeInfo(globalOpts);
|
|
@@ -274527,6 +274543,29 @@ async function handleAgentRecover(agentId, options) {
|
|
|
274527
274543
|
printSuccess(`Agent ID "${agentId}" saved to local config.`);
|
|
274528
274544
|
}
|
|
274529
274545
|
}
|
|
274546
|
+
async function handleAgentList(options) {
|
|
274547
|
+
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
274548
|
+
const wallet = await loadWallet(options.wallet);
|
|
274549
|
+
const connection = new import_web3111.Connection(rpcUrl, "confirmed");
|
|
274550
|
+
const agentIds = await listAgentsByAuthority(connection, wallet.publicKey);
|
|
274551
|
+
if (options.json) {
|
|
274552
|
+
formatOutput({ authority: wallet.publicKey.toBase58(), count: agentIds.length, agentIds }, true);
|
|
274553
|
+
return;
|
|
274554
|
+
}
|
|
274555
|
+
if (agentIds.length === 0) {
|
|
274556
|
+
printWarning(`No agents found for ${wallet.publicKey.toBase58()}`);
|
|
274557
|
+
return;
|
|
274558
|
+
}
|
|
274559
|
+
const networkConfig = loadNetworkConfig(rpcUrl, wallet.publicKey.toBase58());
|
|
274560
|
+
const savedId = networkConfig.agent_id;
|
|
274561
|
+
console.log("");
|
|
274562
|
+
console.log(` Authority: ${wallet.publicKey.toBase58()}`);
|
|
274563
|
+
console.log(` Agents (${agentIds.length}):`);
|
|
274564
|
+
for (const id of agentIds) {
|
|
274565
|
+
console.log(` - ${id}${id === savedId ? " (saved locally)" : ""}`);
|
|
274566
|
+
}
|
|
274567
|
+
console.log("");
|
|
274568
|
+
}
|
|
274530
274569
|
async function handleAgentClear(options) {
|
|
274531
274570
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
274532
274571
|
let pubkey;
|
|
@@ -274607,6 +274646,11 @@ async function handleAgentSubmitTweet(agentId, tweetId, tweetUrl, options) {
|
|
|
274607
274646
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
274608
274647
|
const connection = new import_web3111.Connection(rpcUrl, "confirmed");
|
|
274609
274648
|
const wallet = await loadWallet(options.wallet);
|
|
274649
|
+
const twitter = await getAgentTwitter(connection, agentId).catch(() => null);
|
|
274650
|
+
if (!twitter) {
|
|
274651
|
+
printError(`Agent "${agentId}" has not bound a Twitter account yet. Run "npx naracli agent bind-twitter" first.`);
|
|
274652
|
+
process.exit(1);
|
|
274653
|
+
}
|
|
274610
274654
|
const existing = await getTweetRecord(connection, tweetId);
|
|
274611
274655
|
if (existing) {
|
|
274612
274656
|
printError(`This tweet has already been submitted and approved. Please use a different tweet.`);
|
|
@@ -274804,6 +274848,15 @@ function registerAgentCommands(program3) {
|
|
|
274804
274848
|
process.exit(1);
|
|
274805
274849
|
}
|
|
274806
274850
|
});
|
|
274851
|
+
agent.command("list").description("List all agent IDs registered to this wallet's authority").action(async (_opts, cmd) => {
|
|
274852
|
+
try {
|
|
274853
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
274854
|
+
await handleAgentList(globalOpts);
|
|
274855
|
+
} catch (error) {
|
|
274856
|
+
printError(error.message);
|
|
274857
|
+
process.exit(1);
|
|
274858
|
+
}
|
|
274859
|
+
});
|
|
274807
274860
|
agent.command("clear").description("Clear saved agent ID from local config (does not delete on-chain)").action(async (_opts, cmd) => {
|
|
274808
274861
|
try {
|
|
274809
274862
|
const globalOpts = cmd.optsWithGlobals();
|
|
@@ -276979,7 +277032,7 @@ function registerCommands(program3) {
|
|
|
276979
277032
|
}
|
|
276980
277033
|
|
|
276981
277034
|
// bin/nara-cli.ts
|
|
276982
|
-
var version2 = true ? "1.0.
|
|
277035
|
+
var version2 = true ? "1.0.95" : "dev";
|
|
276983
277036
|
var program2 = new Command();
|
|
276984
277037
|
program2.name("naracli").description("CLI for the Nara chain. Native coin is NARA (not SOL). Mine NARA for free via PoMI quests, manage wallets, register agents, and more. Run 'naracli <command> --help' for details on any command.").version(version2);
|
|
276985
277038
|
program2.option("-r, --rpc-url <url>", "RPC endpoint (default: https://mainnet-api.nara.build/)").option("-w, --wallet <path>", "Path to wallet keypair JSON file (default: ~/.config/nara/id.json)").option("-j, --json", "Output in JSON format");
|