naracli 1.0.72 → 1.0.74

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.
@@ -26782,7 +26782,7 @@ Missing signature for public key${sigErrors.missing.length === 1 ? "" : "(s)"} [
26782
26782
  });
26783
26783
  }
26784
26784
  };
26785
- var VersionedTransaction4 = class _VersionedTransaction {
26785
+ var VersionedTransaction5 = class _VersionedTransaction {
26786
26786
  get version() {
26787
26787
  return this.message.version;
26788
26788
  }
@@ -34187,7 +34187,7 @@ Message: ${transactionMessage}.
34187
34187
  exports2.VOTE_PROGRAM_ID = VOTE_PROGRAM_ID;
34188
34188
  exports2.ValidatorInfo = ValidatorInfo;
34189
34189
  exports2.VersionedMessage = VersionedMessage;
34190
- exports2.VersionedTransaction = VersionedTransaction4;
34190
+ exports2.VersionedTransaction = VersionedTransaction5;
34191
34191
  exports2.VoteAccount = VoteAccount;
34192
34192
  exports2.VoteAuthorizationLayout = VoteAuthorizationLayout;
34193
34193
  exports2.VoteInit = VoteInit;
@@ -60956,10 +60956,10 @@ var init_esm4 = __esm({
60956
60956
  }
60957
60957
  });
60958
60958
 
60959
- // node_modules/.pnpm/nara-sdk@1.0.67_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
60959
+ // node_modules/.pnpm/nara-sdk@1.0.69_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
60960
60960
  var import_web387, NaraSDK;
60961
60961
  var init_client = __esm({
60962
- "node_modules/.pnpm/nara-sdk@1.0.67_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"() {
60962
+ "node_modules/.pnpm/nara-sdk@1.0.69_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"() {
60963
60963
  import_web387 = __toESM(require_index_cjs(), 1);
60964
60964
  NaraSDK = class {
60965
60965
  connection;
@@ -60976,10 +60976,10 @@ var init_client = __esm({
60976
60976
  }
60977
60977
  });
60978
60978
 
60979
- // node_modules/.pnpm/nara-sdk@1.0.67_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
60979
+ // node_modules/.pnpm/nara-sdk@1.0.69_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
60980
60980
  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;
60981
60981
  var init_constants2 = __esm({
60982
- "node_modules/.pnpm/nara-sdk@1.0.67_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"() {
60982
+ "node_modules/.pnpm/nara-sdk@1.0.69_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"() {
60983
60983
  DEFAULT_RPC_URL = process.env.RPC_URL || "https://mainnet-api.nara.build/";
60984
60984
  DEFAULT_QUEST_RELAY_URL = process.env.QUEST_RELAY_URL || "https://quest-api.nara.build/";
60985
60985
  DEFAULT_QUEST_PROGRAM_ID = process.env.QUEST_PROGRAM_ID || "Quest11111111111111111111111111111111111111";
@@ -60990,7 +60990,7 @@ var init_constants2 = __esm({
60990
60990
  }
60991
60991
  });
60992
60992
 
60993
- // node_modules/.pnpm/nara-sdk@1.0.67_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
60993
+ // node_modules/.pnpm/nara-sdk@1.0.69_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
60994
60994
  function buildSignMessage(params) {
60995
60995
  return Object.keys(params).filter((k2) => k2 !== "sign").sort().map((k2) => `${k2}=${params[k2]}`).join("&");
60996
60996
  }
@@ -61018,13 +61018,13 @@ function signUrl(baseUrl, wallet, params) {
61018
61018
  }
61019
61019
  var import_tweetnacl;
61020
61020
  var init_sign = __esm({
61021
- "node_modules/.pnpm/nara-sdk@1.0.67_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"() {
61021
+ "node_modules/.pnpm/nara-sdk@1.0.69_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"() {
61022
61022
  import_tweetnacl = __toESM(require_nacl_fast(), 1);
61023
61023
  init_esm4();
61024
61024
  }
61025
61025
  });
61026
61026
 
61027
- // node_modules/.pnpm/nara-sdk@1.0.67_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
61027
+ // node_modules/.pnpm/nara-sdk@1.0.69_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
61028
61028
  function setSkipPreflight(value) {
61029
61029
  _globalSkipPreflight = value;
61030
61030
  }
@@ -61167,7 +61167,7 @@ async function sendTx(connection, payer, instructions, signers, opts) {
61167
61167
  }
61168
61168
  var import_web388, _cachedAlts, _cachedAltKey, _overrideAltAddresses, _globalSkipPreflight;
61169
61169
  var init_tx = __esm({
61170
- "node_modules/.pnpm/nara-sdk@1.0.67_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"() {
61170
+ "node_modules/.pnpm/nara-sdk@1.0.69_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"() {
61171
61171
  import_web388 = __toESM(require_index_cjs(), 1);
61172
61172
  init_constants2();
61173
61173
  _cachedAlts = [];
@@ -77422,10 +77422,10 @@ var require_cjs2 = __commonJS({
77422
77422
  }
77423
77423
  });
77424
77424
 
77425
- // node_modules/.pnpm/nara-sdk@1.0.67_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
77425
+ // node_modules/.pnpm/nara-sdk@1.0.69_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
77426
77426
  var nara_quest_default;
77427
77427
  var init_nara_quest = __esm({
77428
- "node_modules/.pnpm/nara-sdk@1.0.67_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"() {
77428
+ "node_modules/.pnpm/nara-sdk@1.0.69_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"() {
77429
77429
  nara_quest_default = {
77430
77430
  address: "Quest11111111111111111111111111111111111111",
77431
77431
  metadata: {
@@ -79579,10 +79579,10 @@ var init_nara_quest = __esm({
79579
79579
  }
79580
79580
  });
79581
79581
 
79582
- // node_modules/.pnpm/nara-sdk@1.0.67_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
79582
+ // node_modules/.pnpm/nara-sdk@1.0.69_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
79583
79583
  var nara_agent_registry_default;
79584
79584
  var init_nara_agent_registry = __esm({
79585
- "node_modules/.pnpm/nara-sdk@1.0.67_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"() {
79585
+ "node_modules/.pnpm/nara-sdk@1.0.69_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"() {
79586
79586
  nara_agent_registry_default = {
79587
79587
  address: "AgentRegistry111111111111111111111111111111",
79588
79588
  metadata: {
@@ -81162,10 +81162,14 @@ var init_nara_agent_registry = __esm({
81162
81162
  ],
81163
81163
  accounts: [
81164
81164
  {
81165
- name: "authority",
81165
+ name: "payer",
81166
81166
  writable: true,
81167
81167
  signer: true
81168
81168
  },
81169
+ {
81170
+ name: "authority",
81171
+ signer: true
81172
+ },
81169
81173
  {
81170
81174
  name: "agent",
81171
81175
  writable: true,
@@ -81254,10 +81258,14 @@ var init_nara_agent_registry = __esm({
81254
81258
  ],
81255
81259
  accounts: [
81256
81260
  {
81257
- name: "authority",
81261
+ name: "payer",
81258
81262
  writable: true,
81259
81263
  signer: true
81260
81264
  },
81265
+ {
81266
+ name: "authority",
81267
+ signer: true
81268
+ },
81261
81269
  {
81262
81270
  name: "agent",
81263
81271
  writable: true,
@@ -82097,8 +82105,12 @@ var init_nara_agent_registry = __esm({
82097
82105
  ],
82098
82106
  accounts: [
82099
82107
  {
82100
- name: "authority",
82108
+ name: "payer",
82101
82109
  writable: true,
82110
+ signer: true
82111
+ },
82112
+ {
82113
+ name: "authority",
82102
82114
  signer: true,
82103
82115
  relations: [
82104
82116
  "agent"
@@ -82260,8 +82272,12 @@ var init_nara_agent_registry = __esm({
82260
82272
  ],
82261
82273
  accounts: [
82262
82274
  {
82263
- name: "authority",
82275
+ name: "payer",
82264
82276
  writable: true,
82277
+ signer: true
82278
+ },
82279
+ {
82280
+ name: "authority",
82265
82281
  signer: true,
82266
82282
  relations: [
82267
82283
  "agent"
@@ -84640,7 +84656,7 @@ var init_nara_agent_registry = __esm({
84640
84656
  }
84641
84657
  });
84642
84658
 
84643
- // node_modules/.pnpm/nara-sdk@1.0.67_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
84659
+ // node_modules/.pnpm/nara-sdk@1.0.69_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
84644
84660
  var agent_registry_exports = {};
84645
84661
  __export(agent_registry_exports, {
84646
84662
  approveTweet: () => approveTweet,
@@ -84661,6 +84677,10 @@ __export(agent_registry_exports, {
84661
84677
  logActivityWithReferral: () => logActivityWithReferral,
84662
84678
  makeLogActivityIx: () => makeLogActivityIx,
84663
84679
  makeLogActivityWithReferralIx: () => makeLogActivityWithReferralIx,
84680
+ makeRegisterAgentIx: () => makeRegisterAgentIx,
84681
+ makeRegisterAgentWithReferralIx: () => makeRegisterAgentWithReferralIx,
84682
+ makeSetTwitterIx: () => makeSetTwitterIx,
84683
+ makeSubmitTweetIx: () => makeSubmitTweetIx,
84664
84684
  registerAgent: () => registerAgent,
84665
84685
  registerAgentWithReferral: () => registerAgentWithReferral,
84666
84686
  rejectTweet: () => rejectTweet,
@@ -84944,23 +84964,65 @@ async function getConfig(connection, options) {
84944
84964
  const registerFee5 = Number(buf.readBigUInt64LE(offset));
84945
84965
  return { admin, feeVault, pointMint, refereeMint, refereeActivityMint, registerFee, pointsSelf, pointsReferral, referralDiscountBps, referralShareBps, referralRegisterPoints, activityReward, referralActivityReward, twitterVerifier, twitterVerificationFee, twitterVerificationReward, twitterVerificationPoints, tweetVerifyReward, tweetVerifyPoints, registerFee7, registerFee6, registerFee5 };
84946
84966
  }
84947
- async function registerAgent(connection, wallet, agentId, options) {
84967
+ async function makeRegisterAgentIx(connection, payer, authority, agentId, options) {
84948
84968
  if (/[A-Z]/.test(agentId)) {
84949
84969
  throw new Error(`Agent ID must not contain uppercase letters: "${agentId}"`);
84950
84970
  }
84951
- const program3 = createProgram(connection, wallet, options?.programId);
84971
+ const program3 = createProgram(connection, import_web389.Keypair.generate(), options?.programId);
84972
+ return program3.methods.registerAgent(agentId).accounts({ payer, authority }).instruction();
84973
+ }
84974
+ async function makeRegisterAgentWithReferralIx(connection, payer, authority, agentId, referralAgentId, options) {
84975
+ if (/[A-Z]/.test(agentId)) {
84976
+ throw new Error(`Agent ID must not contain uppercase letters: "${agentId}"`);
84977
+ }
84978
+ const program3 = createProgram(connection, import_web389.Keypair.generate(), options?.programId);
84979
+ const pointMint = getPointMintPda(program3.programId);
84980
+ const { referralAgent, referralAuthority, referralPointAccount } = await resolveReferralAccounts(connection, referralAgentId, program3.programId, pointMint);
84981
+ const refereeMint = getRefereeMintPda(program3.programId);
84982
+ const referralRefereeAccount = getAssociatedTokenAddressSync(
84983
+ refereeMint,
84984
+ referralAuthority,
84985
+ true,
84986
+ TOKEN_2022_PROGRAM_ID
84987
+ );
84988
+ return program3.methods.registerAgentWithReferral(agentId).accounts({
84989
+ payer,
84990
+ authority,
84991
+ referralAgent,
84992
+ referralAuthority,
84993
+ referralPointAccount,
84994
+ referralRefereeAccount
84995
+ }).instruction();
84996
+ }
84997
+ async function makeSetTwitterIx(connection, payer, authority, agentId, username, tweetUrl, options) {
84998
+ const program3 = createProgram(connection, import_web389.Keypair.generate(), options?.programId);
84999
+ return program3.methods.setTwitter(agentId, username, tweetUrl).accounts({ payer, authority }).instruction();
85000
+ }
85001
+ async function makeSubmitTweetIx(connection, payer, authority, agentId, tweetId, options) {
85002
+ const program3 = createProgram(connection, import_web389.Keypair.generate(), options?.programId);
85003
+ return program3.methods.submitTweet(agentId, new import_bn.default(tweetId.toString())).accounts({ payer, authority }).instruction();
85004
+ }
85005
+ async function registerAgent(connection, wallet, agentId, options, payer) {
85006
+ if (/[A-Z]/.test(agentId)) {
85007
+ throw new Error(`Agent ID must not contain uppercase letters: "${agentId}"`);
85008
+ }
85009
+ const payerKp = payer ?? wallet;
85010
+ const program3 = createProgram(connection, payerKp, options?.programId);
84952
85011
  const ix = await program3.methods.registerAgent(agentId).accounts({
85012
+ payer: payerKp.publicKey,
84953
85013
  authority: wallet.publicKey
84954
85014
  }).instruction();
84955
- const signature = await sendTx(connection, wallet, [ix]);
85015
+ const signers = payer && !payer.publicKey.equals(wallet.publicKey) ? [wallet] : [];
85016
+ const signature = await sendTx(connection, payerKp, [ix], signers);
84956
85017
  const agentPubkey = getAgentPda(program3.programId, agentId);
84957
85018
  return { signature, agentPubkey };
84958
85019
  }
84959
- async function registerAgentWithReferral(connection, wallet, agentId, referralAgentId, options) {
85020
+ async function registerAgentWithReferral(connection, wallet, agentId, referralAgentId, options, payer) {
84960
85021
  if (/[A-Z]/.test(agentId)) {
84961
85022
  throw new Error(`Agent ID must not contain uppercase letters: "${agentId}"`);
84962
85023
  }
84963
- const program3 = createProgram(connection, wallet, options?.programId);
85024
+ const payerKp = payer ?? wallet;
85025
+ const program3 = createProgram(connection, payerKp, options?.programId);
84964
85026
  const pointMint = getPointMintPda(program3.programId);
84965
85027
  const { referralAgent, referralAuthority, referralPointAccount } = await resolveReferralAccounts(connection, referralAgentId, program3.programId, pointMint);
84966
85028
  const refereeMint = getRefereeMintPda(program3.programId);
@@ -84971,13 +85033,15 @@ async function registerAgentWithReferral(connection, wallet, agentId, referralAg
84971
85033
  TOKEN_2022_PROGRAM_ID
84972
85034
  );
84973
85035
  const ix = await program3.methods.registerAgentWithReferral(agentId).accounts({
85036
+ payer: payerKp.publicKey,
84974
85037
  authority: wallet.publicKey,
84975
85038
  referralAgent,
84976
85039
  referralAuthority,
84977
85040
  referralPointAccount,
84978
85041
  referralRefereeAccount
84979
85042
  }).instruction();
84980
- const signature = await sendTx(connection, wallet, [ix]);
85043
+ const signers = payer && !payer.publicKey.equals(wallet.publicKey) ? [wallet] : [];
85044
+ const signature = await sendTx(connection, payerKp, [ix], signers);
84981
85045
  const agentPubkey = getAgentPda(program3.programId, agentId);
84982
85046
  return { signature, agentPubkey };
84983
85047
  }
@@ -85375,15 +85439,19 @@ async function getPendingTweetVerifications(connection, options) {
85375
85439
  }
85376
85440
  return results;
85377
85441
  }
85378
- async function setTwitter(connection, wallet, agentId, username, tweetUrl, options) {
85379
- const program3 = createProgram(connection, wallet, options?.programId);
85380
- const ix = await program3.methods.setTwitter(agentId, username, tweetUrl).accounts({ authority: wallet.publicKey }).instruction();
85381
- return sendTx(connection, wallet, [ix]);
85442
+ async function setTwitter(connection, wallet, agentId, username, tweetUrl, options, payer) {
85443
+ const payerKp = payer ?? wallet;
85444
+ const program3 = createProgram(connection, payerKp, options?.programId);
85445
+ const ix = await program3.methods.setTwitter(agentId, username, tweetUrl).accounts({ payer: payerKp.publicKey, authority: wallet.publicKey }).instruction();
85446
+ const signers = payer && !payer.publicKey.equals(wallet.publicKey) ? [wallet] : [];
85447
+ return sendTx(connection, payerKp, [ix], signers);
85382
85448
  }
85383
- async function submitTweet(connection, wallet, agentId, tweetId, options) {
85384
- const program3 = createProgram(connection, wallet, options?.programId);
85385
- const ix = await program3.methods.submitTweet(agentId, new import_bn.default(tweetId.toString())).accounts({ authority: wallet.publicKey }).instruction();
85386
- return sendTx(connection, wallet, [ix]);
85449
+ async function submitTweet(connection, wallet, agentId, tweetId, options, payer) {
85450
+ const payerKp = payer ?? wallet;
85451
+ const program3 = createProgram(connection, payerKp, options?.programId);
85452
+ const ix = await program3.methods.submitTweet(agentId, new import_bn.default(tweetId.toString())).accounts({ payer: payerKp.publicKey, authority: wallet.publicKey }).instruction();
85453
+ const signers = payer && !payer.publicKey.equals(wallet.publicKey) ? [wallet] : [];
85454
+ return sendTx(connection, payerKp, [ix], signers);
85387
85455
  }
85388
85456
  async function unbindTwitter(connection, wallet, agentId, username, options) {
85389
85457
  const program3 = createProgram(connection, wallet, options?.programId);
@@ -85466,7 +85534,7 @@ async function rejectTweet(connection, wallet, agentId, options) {
85466
85534
  }
85467
85535
  var import_web389, anchor, import_anchor, import_bn, DEFAULT_CHUNK_SIZE, BUFFER_HEADER_SIZE, MEMORY_HEADER_SIZE, BIO_META_HEADER_SIZE;
85468
85536
  var init_agent_registry = __esm({
85469
- "node_modules/.pnpm/nara-sdk@1.0.67_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"() {
85537
+ "node_modules/.pnpm/nara-sdk@1.0.69_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"() {
85470
85538
  import_web389 = __toESM(require_index_cjs(), 1);
85471
85539
  anchor = __toESM(require_cjs2(), 1);
85472
85540
  import_anchor = __toESM(require_cjs2(), 1);
@@ -165227,7 +165295,7 @@ var init_main3 = __esm({
165227
165295
  }
165228
165296
  });
165229
165297
 
165230
- // node_modules/.pnpm/nara-sdk@1.0.67_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
165298
+ // node_modules/.pnpm/nara-sdk@1.0.69_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
165231
165299
  var quest_exports = {};
165232
165300
  __export(quest_exports, {
165233
165301
  adjustFreeStake: () => adjustFreeStake,
@@ -165731,7 +165799,7 @@ async function setAirdropConfig(connection, wallet, airdropAmount, maxAirdropCou
165731
165799
  }
165732
165800
  var import_web390, anchor2, import_anchor2, import_bn2, import_meta, BN254_FIELD, WSOL_MINT;
165733
165801
  var init_quest = __esm({
165734
- "node_modules/.pnpm/nara-sdk@1.0.67_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"() {
165802
+ "node_modules/.pnpm/nara-sdk@1.0.69_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"() {
165735
165803
  import_web390 = __toESM(require_index_cjs(), 1);
165736
165804
  init_esm2();
165737
165805
  anchor2 = __toESM(require_cjs2(), 1);
@@ -165746,10 +165814,10 @@ var init_quest = __esm({
165746
165814
  }
165747
165815
  });
165748
165816
 
165749
- // node_modules/.pnpm/nara-sdk@1.0.67_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
165817
+ // node_modules/.pnpm/nara-sdk@1.0.69_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
165750
165818
  var nara_skills_hub_default;
165751
165819
  var init_nara_skills_hub = __esm({
165752
- "node_modules/.pnpm/nara-sdk@1.0.67_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"() {
165820
+ "node_modules/.pnpm/nara-sdk@1.0.69_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"() {
165753
165821
  nara_skills_hub_default = {
165754
165822
  address: "SkiLLHub11111111111111111111111111111111111",
165755
165823
  metadata: {
@@ -167149,7 +167217,7 @@ var init_nara_skills_hub = __esm({
167149
167217
  }
167150
167218
  });
167151
167219
 
167152
- // node_modules/.pnpm/nara-sdk@1.0.67_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
167220
+ // node_modules/.pnpm/nara-sdk@1.0.69_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
167153
167221
  function createProgram3(connection, wallet, programId) {
167154
167222
  const idl = nara_skills_hub_default;
167155
167223
  const pid = programId ?? DEFAULT_SKILLS_PROGRAM_ID;
@@ -167426,7 +167494,7 @@ async function updateRegisterFee2(connection, wallet, newFee, options) {
167426
167494
  }
167427
167495
  var import_web391, anchor3, import_anchor3, DEFAULT_CHUNK_SIZE2, BUFFER_HEADER_SIZE2, CONTENT_HEADER_SIZE;
167428
167496
  var init_skills = __esm({
167429
- "node_modules/.pnpm/nara-sdk@1.0.67_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"() {
167497
+ "node_modules/.pnpm/nara-sdk@1.0.69_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"() {
167430
167498
  import_web391 = __toESM(require_index_cjs(), 1);
167431
167499
  anchor3 = __toESM(require_cjs2(), 1);
167432
167500
  import_anchor3 = __toESM(require_cjs2(), 1);
@@ -167439,10 +167507,10 @@ var init_skills = __esm({
167439
167507
  }
167440
167508
  });
167441
167509
 
167442
- // node_modules/.pnpm/nara-sdk@1.0.67_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
167510
+ // node_modules/.pnpm/nara-sdk@1.0.69_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
167443
167511
  var nara_zk_default;
167444
167512
  var init_nara_zk = __esm({
167445
- "node_modules/.pnpm/nara-sdk@1.0.67_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"() {
167513
+ "node_modules/.pnpm/nara-sdk@1.0.69_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"() {
167446
167514
  nara_zk_default = {
167447
167515
  address: "ZKidentity111111111111111111111111111111111",
167448
167516
  metadata: {
@@ -168655,7 +168723,7 @@ var init_nara_zk = __esm({
168655
168723
  }
168656
168724
  });
168657
168725
 
168658
- // node_modules/.pnpm/nara-sdk@1.0.67_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
168726
+ // node_modules/.pnpm/nara-sdk@1.0.69_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
168659
168727
  async function resolveDefaultZkPaths2() {
168660
168728
  const { fileURLToPath } = await import("url");
168661
168729
  const { dirname: dirname2, join: join6 } = await import("path");
@@ -169119,7 +169187,7 @@ async function withdrawFees3(connection, wallet, amount, options) {
169119
169187
  }
169120
169188
  var import_web392, anchor4, import_anchor4, import_tweetnacl2, import_bn3, import_meta2, BN254_PRIME, MERKLE_LEVELS, ZKID_DENOMINATIONS, _poseidon;
169121
169189
  var init_zkid = __esm({
169122
- "node_modules/.pnpm/nara-sdk@1.0.67_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"() {
169190
+ "node_modules/.pnpm/nara-sdk@1.0.69_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"() {
169123
169191
  import_web392 = __toESM(require_index_cjs(), 1);
169124
169192
  anchor4 = __toESM(require_cjs2(), 1);
169125
169193
  import_anchor4 = __toESM(require_cjs2(), 1);
@@ -169144,7 +169212,7 @@ var init_zkid = __esm({
169144
169212
  }
169145
169213
  });
169146
169214
 
169147
- // node_modules/.pnpm/nara-sdk@1.0.67_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0.22_typescript@5.9.3_utf-8-validate@6.0.6/node_modules/nara-sdk/index.ts
169215
+ // node_modules/.pnpm/nara-sdk@1.0.69_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0.22_typescript@5.9.3_utf-8-validate@6.0.6/node_modules/nara-sdk/index.ts
169148
169216
  var nara_sdk_exports = {};
169149
169217
  __export(nara_sdk_exports, {
169150
169218
  BN: () => import_bn4.default,
@@ -169212,6 +169280,10 @@ __export(nara_sdk_exports, {
169212
169280
  makeCreateQuestionIx: () => makeCreateQuestionIx,
169213
169281
  makeLogActivityIx: () => makeLogActivityIx,
169214
169282
  makeLogActivityWithReferralIx: () => makeLogActivityWithReferralIx,
169283
+ makeRegisterAgentIx: () => makeRegisterAgentIx,
169284
+ makeRegisterAgentWithReferralIx: () => makeRegisterAgentWithReferralIx,
169285
+ makeSetTwitterIx: () => makeSetTwitterIx,
169286
+ makeSubmitTweetIx: () => makeSubmitTweetIx,
169215
169287
  makeWithdrawIx: () => makeWithdrawIx,
169216
169288
  parseQuestReward: () => parseQuestReward,
169217
169289
  registerAgent: () => registerAgent,
@@ -169271,7 +169343,7 @@ __export(nara_sdk_exports, {
169271
169343
  });
169272
169344
  var import_web393, import_bn4;
169273
169345
  var init_nara_sdk = __esm({
169274
- "node_modules/.pnpm/nara-sdk@1.0.67_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0.22_typescript@5.9.3_utf-8-validate@6.0.6/node_modules/nara-sdk/index.ts"() {
169346
+ "node_modules/.pnpm/nara-sdk@1.0.69_bufferutil@4.1.0_fastestsmallesttextencoderdecoder@1.0.22_typescript@5.9.3_utf-8-validate@6.0.6/node_modules/nara-sdk/index.ts"() {
169275
169347
  init_client();
169276
169348
  init_constants2();
169277
169349
  init_sign();
@@ -172987,6 +173059,22 @@ function registerZkIdCommands(program3) {
172987
173059
  var import_web3103 = __toESM(require_index_cjs(), 1);
172988
173060
  init_nara_sdk();
172989
173061
  var import_node_fs3 = require("node:fs");
173062
+ var DEFAULT_RELAY_URL = process.env.QUEST_RELAY_URL || "https://quest-api.nara.build/";
173063
+ async function relaySignAndSend(connection, wallet, relayUrl, endpoint, body) {
173064
+ const url = relayUrl.replace(/\/+$/, "") + endpoint;
173065
+ const res = await fetch(url, {
173066
+ method: "POST",
173067
+ headers: { "Content-Type": "application/json" },
173068
+ body: JSON.stringify(body)
173069
+ });
173070
+ const data = await res.json();
173071
+ if (data.error) throw new Error(data.error);
173072
+ const txBuf = Buffer.from(data.transaction, "base64");
173073
+ const tx = import_web3103.VersionedTransaction.deserialize(new Uint8Array(txBuf));
173074
+ tx.sign([wallet]);
173075
+ const sig = await connection.sendTransaction(tx, { maxRetries: 3 });
173076
+ return sig;
173077
+ }
172990
173078
  async function tryGetWalletPubkey(walletPath) {
172991
173079
  try {
172992
173080
  const wallet = await loadWallet(walletPath);
@@ -173018,14 +173106,22 @@ async function handleAgentRegister(agentId, options) {
173018
173106
  }
173019
173107
  const connection = new import_web3103.Connection(rpcUrl, "confirmed");
173020
173108
  if (!options.json) printInfo(`Registering agent "${agentId}"...`);
173021
- const result = options.referral ? await registerAgentWithReferral(connection, wallet, agentId, options.referral) : await registerAgent(connection, wallet, agentId);
173109
+ let signature;
173110
+ if (options.relay) {
173111
+ const relayUrl = options.relay === "true" || options.relay === "" ? DEFAULT_RELAY_URL : options.relay;
173112
+ const body = { authority: pubkey, agentId };
173113
+ if (options.referral) body.referralAgentId = options.referral;
173114
+ signature = await relaySignAndSend(connection, wallet, relayUrl, "/register-agent", body);
173115
+ } else {
173116
+ const result = options.referral ? await registerAgentWithReferral(connection, wallet, agentId, options.referral) : await registerAgent(connection, wallet, agentId);
173117
+ signature = result.signature;
173118
+ }
173022
173119
  if (!options.json) printSuccess(`Agent "${agentId}" registered!`);
173023
173120
  setAgentId(agentId, rpcUrl, pubkey);
173024
173121
  if (options.json) {
173025
- formatOutput({ agentId, referral: options.referral ?? null, signature: result.signature, agentPubkey: result.agentPubkey.toBase58() }, true);
173122
+ formatOutput({ agentId, referral: options.referral ?? null, signature }, true);
173026
173123
  } else {
173027
- console.log(` Transaction: ${result.signature}`);
173028
- console.log(` Agent PDA: ${result.agentPubkey.toBase58()}`);
173124
+ console.log(` Transaction: ${signature}`);
173029
173125
  if (options.referral) console.log(` Referral: ${options.referral}`);
173030
173126
  }
173031
173127
  }
@@ -173112,7 +173208,7 @@ async function handleAgentGet(agentId, options) {
173112
173208
  console.log("");
173113
173209
  } else {
173114
173210
  const tweetText = `Claiming my AI agent ${agentId} on #NaraChain @NaraBuildAI`;
173115
- const tweetIntent = `https://x.com/intent/tweet?text=${tweetText.replace(/ /g, "%20")}`;
173211
+ const tweetIntent = `https://x.com/intent/tweet?text=${tweetText.replace(/ /g, "%20").replace(/#/g, "%23")}`;
173116
173212
  console.log(` Tip: Bind your Twitter to get stake-free PoMI mining credits!`);
173117
173213
  console.log(` 1. Post a tweet: ${tweetIntent}`);
173118
173214
  console.log(` 2. Then run: npx naracli agent bind-twitter <tweet-url>`);
@@ -173306,7 +173402,18 @@ async function handleAgentTwitterSet(agentId, username, tweetUrl, options) {
173306
173402
  const connection = new import_web3103.Connection(rpcUrl, "confirmed");
173307
173403
  const wallet = await loadWallet(options.wallet);
173308
173404
  if (!options.json) printInfo(`Binding @${username} to agent "${agentId}"...`);
173309
- const signature = await setTwitter(connection, wallet, agentId, username, tweetUrl);
173405
+ let signature;
173406
+ if (options.relay) {
173407
+ const relayUrl = options.relay === "true" || options.relay === "" ? DEFAULT_RELAY_URL : options.relay;
173408
+ signature = await relaySignAndSend(connection, wallet, relayUrl, "/set-twitter", {
173409
+ authority: wallet.publicKey.toBase58(),
173410
+ agentId,
173411
+ username,
173412
+ tweetUrl
173413
+ });
173414
+ } else {
173415
+ signature = await setTwitter(connection, wallet, agentId, username, tweetUrl);
173416
+ }
173310
173417
  if (!options.json) printSuccess(`Twitter @${username} submitted for verification!`);
173311
173418
  if (options.json) {
173312
173419
  formatOutput({ agentId, username, tweetUrl, signature }, true);
@@ -173337,7 +173444,17 @@ async function handleAgentSubmitTweet(agentId, tweetId, tweetUrl, options) {
173337
173444
  process.exit(1);
173338
173445
  }
173339
173446
  if (!options.json) printInfo(`Submitting tweet for verification...`);
173340
- const signature = await submitTweet(connection, wallet, agentId, tweetId);
173447
+ let signature;
173448
+ if (options.relay) {
173449
+ const relayUrl = options.relay === "true" || options.relay === "" ? DEFAULT_RELAY_URL : options.relay;
173450
+ signature = await relaySignAndSend(connection, wallet, relayUrl, "/submit-tweet", {
173451
+ authority: wallet.publicKey.toBase58(),
173452
+ agentId,
173453
+ tweetId: tweetId.toString()
173454
+ });
173455
+ } else {
173456
+ signature = await submitTweet(connection, wallet, agentId, tweetId);
173457
+ }
173341
173458
  if (!options.json) printSuccess(`Tweet submitted for verification!`);
173342
173459
  if (options.json) {
173343
173460
  formatOutput({ agentId, tweetId: tweetId.toString(), tweetUrl, signature }, true);
@@ -173393,10 +173510,11 @@ async function handleAgentConfig(options) {
173393
173510
  }
173394
173511
  function registerAgentCommands(program3) {
173395
173512
  const agent = program3.command("agent").description("Agent Registry \u2014 register an on-chain AI agent identity to earn extra rewards and points from PoMI mining");
173396
- agent.command("register <agent-id>").description("Register a new agent on-chain (free for 8+ char IDs, shorter IDs cost NARA, 50% off with referral \u2014 see 'agent config'). Lowercase alphanumeric with hyphens.").option("--referral <agent-id>", "Referral agent ID \u2014 saves 50% on registration fee").action(async (agentId, opts, cmd) => {
173513
+ agent.command("register <agent-id>").description("Register a new agent on-chain (free for 8+ char IDs, shorter IDs cost NARA, 50% off with referral \u2014 see 'agent config'). Lowercase alphanumeric with hyphens.").option("--referral <agent-id>", "Referral agent ID \u2014 saves 50% on registration fee").option("--relay [url]", "Submit via gasless relay (relay pays gas)").action(async (agentId, opts, cmd) => {
173397
173514
  try {
173398
173515
  const globalOpts = cmd.optsWithGlobals();
173399
- await handleAgentRegister(agentId, { ...globalOpts, ...opts });
173516
+ const relay = opts.relay === true ? "true" : opts.relay;
173517
+ await handleAgentRegister(agentId, { ...globalOpts, referral: opts.referral, relay });
173400
173518
  } catch (error) {
173401
173519
  printError(error.message);
173402
173520
  process.exit(1);
@@ -173537,7 +173655,7 @@ function registerAgentCommands(program3) {
173537
173655
  process.exit(1);
173538
173656
  }
173539
173657
  });
173540
- agent.command("bind-twitter [tweet-url]").description("Bind twitter to your agent for stake-free PoMI credits").option("--agent-id <id>", "Agent ID (defaults to saved myid)").addHelpText("after", `
173658
+ agent.command("bind-twitter [tweet-url]").description("Bind twitter to your agent for stake-free PoMI credits").option("--agent-id <id>", "Agent ID (defaults to saved myid)").option("--relay [url]", "Submit via gasless relay (relay pays gas)").addHelpText("after", `
173541
173659
  Tweet content (replace <agent-id> with yours):
173542
173660
  Claiming my AI agent "<agent-id>" on #NaraChain @NaraBuildAI
173543
173661
 
@@ -173566,7 +173684,7 @@ Example:
173566
173684
  } catch {
173567
173685
  }
173568
173686
  const tweetText = `Claiming my AI agent ${agentId} on #NaraChain @NaraBuildAI`;
173569
- const tweetIntent = `https://x.com/intent/tweet?text=${tweetText.replace(/ /g, "%20")}`;
173687
+ const tweetIntent = `https://x.com/intent/tweet?text=${tweetText.replace(/ /g, "%20").replace(/#/g, "%23")}`;
173570
173688
  console.log("");
173571
173689
  console.log(` Bind your Twitter to get stake-free PoMI mining credits!`);
173572
173690
  console.log(` 1. Post a tweet: ${tweetIntent}`);
@@ -173575,7 +173693,8 @@ Example:
173575
173693
  return;
173576
173694
  }
173577
173695
  const { username } = parseTweetUrl(tweetUrl);
173578
- await handleAgentTwitterSet(agentId, username, tweetUrl, globalOpts);
173696
+ const relay = opts.relay === true ? "true" : opts.relay;
173697
+ await handleAgentTwitterSet(agentId, username, tweetUrl, { ...globalOpts, relay });
173579
173698
  } catch (error) {
173580
173699
  printError(error.message);
173581
173700
  process.exit(1);
@@ -173591,12 +173710,13 @@ Example:
173591
173710
  process.exit(1);
173592
173711
  }
173593
173712
  });
173594
- agent.command("submit-tweet <tweet-url>").description("Submit a tweet for verification and earn rewards (charges verification fee)").option("--agent-id <id>", "Agent ID (defaults to saved myid)").action(async (tweetUrl, opts, cmd) => {
173713
+ agent.command("submit-tweet <tweet-url>").description("Submit a tweet for verification and earn rewards (charges verification fee)").option("--agent-id <id>", "Agent ID (defaults to saved myid)").option("--relay [url]", "Submit via gasless relay (relay pays gas)").action(async (tweetUrl, opts, cmd) => {
173595
173714
  try {
173596
173715
  const globalOpts = cmd.optsWithGlobals();
173597
173716
  const agentId = await resolveAgentId({ ...globalOpts, agentId: opts.agentId });
173598
173717
  const { tweetId } = parseTweetUrl(tweetUrl);
173599
- await handleAgentSubmitTweet(agentId, tweetId, tweetUrl, globalOpts);
173718
+ const relay = opts.relay === true ? "true" : opts.relay;
173719
+ await handleAgentSubmitTweet(agentId, tweetId, tweetUrl, { ...globalOpts, relay });
173600
173720
  } catch (error) {
173601
173721
  printError(error.message);
173602
173722
  process.exit(1);
@@ -173944,7 +174064,7 @@ function registerCommands(program3) {
173944
174064
  }
173945
174065
 
173946
174066
  // bin/nara-cli.ts
173947
- var version2 = true ? "1.0.72" : "dev";
174067
+ var version2 = true ? "1.0.74" : "dev";
173948
174068
  var program2 = new Command();
173949
174069
  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);
173950
174070
  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");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "naracli",
3
- "version": "1.0.72",
3
+ "version": "1.0.74",
4
4
  "description": "CLI for the Nara chain (Solana-compatible)",
5
5
  "homepage": "https://nara.build",
6
6
  "repository": {
@@ -63,7 +63,7 @@
63
63
  "bs58": "^6.0.0",
64
64
  "commander": "^12.1.0",
65
65
  "ed25519-hd-key": "^1.3.0",
66
- "nara-sdk": "^1.0.67",
66
+ "nara-sdk": "^1.0.69",
67
67
  "picocolors": "^1.1.1"
68
68
  },
69
69
  "packageManager": "pnpm@10.27.0+sha512.72d699da16b1179c14ba9e64dc71c9a40988cbdc65c264cb0e489db7de917f20dcf4d64d8723625f2969ba52d4b7e2a1170682d9ac2a5dcaeaab732b7e16f04a"
@@ -3,7 +3,7 @@
3
3
  */
4
4
 
5
5
  import { Command } from "commander";
6
- import { Connection, PublicKey } from "@solana/web3.js";
6
+ import { Connection, PublicKey, VersionedTransaction } from "@solana/web3.js";
7
7
  import { loadWallet, getRpcUrl } from "../utils/wallet";
8
8
  import {
9
9
  printError,
@@ -39,8 +39,37 @@ import { readFileSync } from "node:fs";
39
39
  import { loadNetworkConfig, setAgentId, clearAgentId } from "../utils/agent-config";
40
40
  import { validateName } from "../utils/validation";
41
41
 
42
+ const DEFAULT_RELAY_URL = process.env.QUEST_RELAY_URL || "https://quest-api.nara.build/";
43
+
42
44
  // ─── Helpers ─────────────────────────────────────────────────────
43
45
 
46
+ /**
47
+ * Call a relay endpoint, get partial-signed tx, sign locally, send to RPC.
48
+ * @returns transaction signature
49
+ */
50
+ async function relaySignAndSend(
51
+ connection: Connection,
52
+ wallet: import("@solana/web3.js").Keypair,
53
+ relayUrl: string,
54
+ endpoint: string,
55
+ body: Record<string, any>,
56
+ ): Promise<string> {
57
+ const url = relayUrl.replace(/\/+$/, "") + endpoint;
58
+ const res = await fetch(url, {
59
+ method: "POST",
60
+ headers: { "Content-Type": "application/json" },
61
+ body: JSON.stringify(body),
62
+ });
63
+ const data = await res.json() as any;
64
+ if (data.error) throw new Error(data.error);
65
+
66
+ const txBuf = Buffer.from(data.transaction, "base64");
67
+ const tx = VersionedTransaction.deserialize(new Uint8Array(txBuf));
68
+ tx.sign([wallet]);
69
+ const sig = await connection.sendTransaction(tx, { maxRetries: 3 });
70
+ return sig;
71
+ }
72
+
44
73
  /** Try to get wallet pubkey without failing. */
45
74
  async function tryGetWalletPubkey(walletPath?: string): Promise<string | undefined> {
46
75
  try {
@@ -66,7 +95,7 @@ async function resolveAgentId(options: GlobalOptions & { agentId?: string }): Pr
66
95
 
67
96
  // ─── Command handlers ────────────────────────────────────────────
68
97
 
69
- async function handleAgentRegister(agentId: string, options: GlobalOptions & { referral?: string }) {
98
+ async function handleAgentRegister(agentId: string, options: GlobalOptions & { referral?: string; relay?: string }) {
70
99
  validateName(agentId, "Agent ID");
71
100
  const rpcUrl = getRpcUrl(options.rpcUrl);
72
101
  const wallet = await loadWallet(options.wallet);
@@ -82,17 +111,27 @@ async function handleAgentRegister(agentId: string, options: GlobalOptions & { r
82
111
  const connection = new Connection(rpcUrl, "confirmed");
83
112
 
84
113
  if (!options.json) printInfo(`Registering agent "${agentId}"...`);
85
- const result = options.referral
86
- ? await registerAgentWithReferral(connection, wallet, agentId, options.referral)
87
- : await registerAgent(connection, wallet, agentId);
114
+
115
+ let signature: string;
116
+ if (options.relay) {
117
+ const relayUrl = options.relay === "true" || options.relay === "" ? DEFAULT_RELAY_URL : options.relay;
118
+ const body: Record<string, any> = { authority: pubkey, agentId };
119
+ if (options.referral) body.referralAgentId = options.referral;
120
+ signature = await relaySignAndSend(connection, wallet, relayUrl, "/register-agent", body);
121
+ } else {
122
+ const result = options.referral
123
+ ? await registerAgentWithReferral(connection, wallet, agentId, options.referral)
124
+ : await registerAgent(connection, wallet, agentId);
125
+ signature = result.signature;
126
+ }
127
+
88
128
  if (!options.json) printSuccess(`Agent "${agentId}" registered!`);
89
129
  setAgentId(agentId, rpcUrl, pubkey);
90
130
 
91
131
  if (options.json) {
92
- formatOutput({ agentId, referral: options.referral ?? null, signature: result.signature, agentPubkey: result.agentPubkey.toBase58() }, true);
132
+ formatOutput({ agentId, referral: options.referral ?? null, signature }, true);
93
133
  } else {
94
- console.log(` Transaction: ${result.signature}`);
95
- console.log(` Agent PDA: ${result.agentPubkey.toBase58()}`);
134
+ console.log(` Transaction: ${signature}`);
96
135
  if (options.referral) console.log(` Referral: ${options.referral}`);
97
136
  }
98
137
  }
@@ -193,7 +232,7 @@ async function handleAgentGet(agentId: string, options: GlobalOptions) {
193
232
  } else {
194
233
  // Not bound — show bind tip
195
234
  const tweetText = `Claiming my AI agent ${agentId} on #NaraChain @NaraBuildAI`;
196
- const tweetIntent = `https://x.com/intent/tweet?text=${tweetText.replace(/ /g, "%20")}`;
235
+ const tweetIntent = `https://x.com/intent/tweet?text=${tweetText.replace(/ /g, "%20").replace(/#/g, "%23")}`;
197
236
  console.log(` Tip: Bind your Twitter to get stake-free PoMI mining credits!`);
198
237
  console.log(` 1. Post a tweet: ${tweetIntent}`);
199
238
  console.log(` 2. Then run: npx naracli agent bind-twitter <tweet-url>`);
@@ -428,13 +467,23 @@ function parseTweetUrl(url: string): { username: string; tweetId: bigint; tweetU
428
467
  return { username: m[1], tweetId: BigInt(m[2]), tweetUrl: url };
429
468
  }
430
469
 
431
- async function handleAgentTwitterSet(agentId: string, username: string, tweetUrl: string, options: GlobalOptions) {
470
+ async function handleAgentTwitterSet(agentId: string, username: string, tweetUrl: string, options: GlobalOptions & { relay?: string }) {
432
471
  const rpcUrl = getRpcUrl(options.rpcUrl);
433
472
  const connection = new Connection(rpcUrl, "confirmed");
434
473
  const wallet = await loadWallet(options.wallet);
435
474
 
436
475
  if (!options.json) printInfo(`Binding @${username} to agent "${agentId}"...`);
437
- const signature = await setTwitter(connection, wallet, agentId, username, tweetUrl);
476
+
477
+ let signature: string;
478
+ if (options.relay) {
479
+ const relayUrl = options.relay === "true" || options.relay === "" ? DEFAULT_RELAY_URL : options.relay;
480
+ signature = await relaySignAndSend(connection, wallet, relayUrl, "/set-twitter", {
481
+ authority: wallet.publicKey.toBase58(), agentId, username, tweetUrl,
482
+ });
483
+ } else {
484
+ signature = await setTwitter(connection, wallet, agentId, username, tweetUrl);
485
+ }
486
+
438
487
  if (!options.json) printSuccess(`Twitter @${username} submitted for verification!`);
439
488
 
440
489
  if (options.json) {
@@ -460,7 +509,7 @@ async function handleAgentTwitterUnbind(agentId: string, username: string, optio
460
509
  }
461
510
  }
462
511
 
463
- async function handleAgentSubmitTweet(agentId: string, tweetId: bigint, tweetUrl: string, options: GlobalOptions) {
512
+ async function handleAgentSubmitTweet(agentId: string, tweetId: bigint, tweetUrl: string, options: GlobalOptions & { relay?: string }) {
464
513
  const rpcUrl = getRpcUrl(options.rpcUrl);
465
514
  const connection = new Connection(rpcUrl, "confirmed");
466
515
  const wallet = await loadWallet(options.wallet);
@@ -473,7 +522,16 @@ async function handleAgentSubmitTweet(agentId: string, tweetId: bigint, tweetUrl
473
522
  }
474
523
 
475
524
  if (!options.json) printInfo(`Submitting tweet for verification...`);
476
- const signature = await submitTweet(connection, wallet, agentId, tweetId);
525
+
526
+ let signature: string;
527
+ if (options.relay) {
528
+ const relayUrl = options.relay === "true" || options.relay === "" ? DEFAULT_RELAY_URL : options.relay;
529
+ signature = await relaySignAndSend(connection, wallet, relayUrl, "/submit-tweet", {
530
+ authority: wallet.publicKey.toBase58(), agentId, tweetId: tweetId.toString(),
531
+ });
532
+ } else {
533
+ signature = await submitTweet(connection, wallet, agentId, tweetId);
534
+ }
477
535
  if (!options.json) printSuccess(`Tweet submitted for verification!`);
478
536
 
479
537
  if (options.json) {
@@ -564,10 +622,12 @@ export function registerAgentCommands(program: Command): void {
564
622
  .command("register <agent-id>")
565
623
  .description("Register a new agent on-chain (free for 8+ char IDs, shorter IDs cost NARA, 50% off with referral — see 'agent config'). Lowercase alphanumeric with hyphens.")
566
624
  .option("--referral <agent-id>", "Referral agent ID — saves 50% on registration fee")
567
- .action(async (agentId: string, opts: { referral?: string }, cmd: Command) => {
625
+ .option("--relay [url]", "Submit via gasless relay (relay pays gas)")
626
+ .action(async (agentId: string, opts: { referral?: string; relay?: string }, cmd: Command) => {
568
627
  try {
569
628
  const globalOpts = cmd.optsWithGlobals() as GlobalOptions;
570
- await handleAgentRegister(agentId, { ...globalOpts, ...opts });
629
+ const relay = opts.relay === true ? "true" : opts.relay;
630
+ await handleAgentRegister(agentId, { ...globalOpts, referral: opts.referral, relay });
571
631
  } catch (error: any) {
572
632
  printError(error.message);
573
633
  process.exit(1);
@@ -792,6 +852,7 @@ export function registerAgentCommands(program: Command): void {
792
852
  .command("bind-twitter [tweet-url]")
793
853
  .description("Bind twitter to your agent for stake-free PoMI credits")
794
854
  .option("--agent-id <id>", "Agent ID (defaults to saved myid)")
855
+ .option("--relay [url]", "Submit via gasless relay (relay pays gas)")
795
856
  .addHelpText("after", `
796
857
  Tweet content (replace <agent-id> with yours):
797
858
  Claiming my AI agent "<agent-id>" on #NaraChain @NaraBuildAI
@@ -825,7 +886,7 @@ Example:
825
886
  // No binding found
826
887
  }
827
888
  const tweetText = `Claiming my AI agent ${agentId} on #NaraChain @NaraBuildAI`;
828
- const tweetIntent = `https://x.com/intent/tweet?text=${tweetText.replace(/ /g, "%20")}`;
889
+ const tweetIntent = `https://x.com/intent/tweet?text=${tweetText.replace(/ /g, "%20").replace(/#/g, "%23")}`;
829
890
  console.log("");
830
891
  console.log(` Bind your Twitter to get stake-free PoMI mining credits!`);
831
892
  console.log(` 1. Post a tweet: ${tweetIntent}`);
@@ -835,7 +896,8 @@ Example:
835
896
  }
836
897
 
837
898
  const { username } = parseTweetUrl(tweetUrl);
838
- await handleAgentTwitterSet(agentId, username, tweetUrl, globalOpts);
899
+ const relay = opts.relay === true ? "true" : opts.relay;
900
+ await handleAgentTwitterSet(agentId, username, tweetUrl, { ...globalOpts, relay });
839
901
  } catch (error: any) {
840
902
  printError(error.message);
841
903
  process.exit(1);
@@ -863,12 +925,14 @@ Example:
863
925
  .command("submit-tweet <tweet-url>")
864
926
  .description("Submit a tweet for verification and earn rewards (charges verification fee)")
865
927
  .option("--agent-id <id>", "Agent ID (defaults to saved myid)")
928
+ .option("--relay [url]", "Submit via gasless relay (relay pays gas)")
866
929
  .action(async (tweetUrl: string, opts: any, cmd: Command) => {
867
930
  try {
868
931
  const globalOpts = cmd.optsWithGlobals() as GlobalOptions;
869
932
  const agentId = await resolveAgentId({ ...globalOpts, agentId: opts.agentId });
870
933
  const { tweetId } = parseTweetUrl(tweetUrl);
871
- await handleAgentSubmitTweet(agentId, tweetId, tweetUrl, globalOpts);
934
+ const relay = opts.relay === true ? "true" : opts.relay;
935
+ await handleAgentSubmitTweet(agentId, tweetId, tweetUrl, { ...globalOpts, relay });
872
936
  } catch (error: any) {
873
937
  printError(error.message);
874
938
  process.exit(1);