naracli 1.0.68 → 1.0.70
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/dist/nara-cli-bundle.cjs +16 -16
- package/package.json +1 -1
- package/src/cli/commands/agent.ts +5 -5
- package/src/cli/commands/wallet.ts +13 -13
- package/src/cli/index.ts +4 -4
- package/src/cli/types.ts +3 -3
package/dist/nara-cli-bundle.cjs
CHANGED
|
@@ -169166,18 +169166,18 @@ async function handleWalletBalance(address, options) {
|
|
|
169166
169166
|
}
|
|
169167
169167
|
printInfo(`Checking balance for: ${pubkey.toBase58()}`);
|
|
169168
169168
|
const balance = await connection.getBalance(pubkey);
|
|
169169
|
-
const
|
|
169169
|
+
const balanceNara = balance / import_web398.LAMPORTS_PER_SOL;
|
|
169170
169170
|
if (options.json) {
|
|
169171
169171
|
const output = {
|
|
169172
169172
|
address: pubkey.toBase58(),
|
|
169173
|
-
balance:
|
|
169173
|
+
balance: balanceNara,
|
|
169174
169174
|
lamports: balance
|
|
169175
169175
|
};
|
|
169176
169176
|
console.log(JSON.stringify(output, null, 2));
|
|
169177
169177
|
} else {
|
|
169178
169178
|
console.log(`
|
|
169179
169179
|
Wallet: ${pubkey.toBase58()}`);
|
|
169180
|
-
console.log(`Balance: ${
|
|
169180
|
+
console.log(`Balance: ${balanceNara.toFixed(4)} NARA (${balance.toLocaleString()} lamports)`);
|
|
169181
169181
|
}
|
|
169182
169182
|
}
|
|
169183
169183
|
async function handleTokenBalance(tokenAddress, options) {
|
|
@@ -169309,16 +169309,16 @@ View on explorer: https://explorer.nara.build/tx/${signature}`
|
|
|
169309
169309
|
);
|
|
169310
169310
|
}
|
|
169311
169311
|
}
|
|
169312
|
-
async function
|
|
169312
|
+
async function handleTransferNara(to, amount, options) {
|
|
169313
169313
|
const wallet = await loadWallet(options.wallet);
|
|
169314
169314
|
const rpcUrl = getRpcUrl(options.rpcUrl);
|
|
169315
169315
|
printInfo(`Using RPC: ${rpcUrl}`);
|
|
169316
169316
|
printInfo(`From: ${wallet.publicKey.toBase58()}`);
|
|
169317
169317
|
const recipient = validatePublicKey(to);
|
|
169318
|
-
const
|
|
169319
|
-
const lamports = Math.floor(
|
|
169318
|
+
const amountNara = validatePositiveNumber(amount, "amount");
|
|
169319
|
+
const lamports = Math.floor(amountNara * import_web398.LAMPORTS_PER_SOL);
|
|
169320
169320
|
printInfo(`To: ${recipient.toBase58()}`);
|
|
169321
|
-
printInfo(`Amount: ${
|
|
169321
|
+
printInfo(`Amount: ${amountNara} NARA`);
|
|
169322
169322
|
const sdk = new NaraSDK({
|
|
169323
169323
|
rpcUrl,
|
|
169324
169324
|
commitment: "confirmed"
|
|
@@ -169343,7 +169343,7 @@ async function handleTransferSol(to, amount, options) {
|
|
|
169343
169343
|
const output = {
|
|
169344
169344
|
from: wallet.publicKey.toBase58(),
|
|
169345
169345
|
to: recipient.toBase58(),
|
|
169346
|
-
amount:
|
|
169346
|
+
amount: amountNara,
|
|
169347
169347
|
lamports,
|
|
169348
169348
|
...txResult.signature && { signature: txResult.signature },
|
|
169349
169349
|
...txResult.base64 && { transaction: txResult.base64 }
|
|
@@ -169354,7 +169354,7 @@ async function handleTransferSol(to, amount, options) {
|
|
|
169354
169354
|
Transfer Details:`);
|
|
169355
169355
|
console.log(` From: ${wallet.publicKey.toBase58()}`);
|
|
169356
169356
|
console.log(` To: ${recipient.toBase58()}`);
|
|
169357
|
-
console.log(` Amount: ${
|
|
169357
|
+
console.log(` Amount: ${amountNara} NARA`);
|
|
169358
169358
|
printTransactionResult(txResult, false);
|
|
169359
169359
|
}
|
|
169360
169360
|
}
|
|
@@ -172305,7 +172305,7 @@ async function resolveAgentId(options) {
|
|
|
172305
172305
|
const pubkey = await tryGetWalletPubkey(options.wallet);
|
|
172306
172306
|
const networkConfig = loadNetworkConfig(rpcUrl, pubkey);
|
|
172307
172307
|
if (!networkConfig.agent_id) {
|
|
172308
|
-
printError('No agent ID
|
|
172308
|
+
printError('No agent ID registered for this wallet. Run "agent register <id>" to create one, or use --agent-id to query another agent.');
|
|
172309
172309
|
process.exit(1);
|
|
172310
172310
|
}
|
|
172311
172311
|
return networkConfig.agent_id;
|
|
@@ -172412,10 +172412,10 @@ async function handleAgentGet(agentId, options) {
|
|
|
172412
172412
|
console.log(` Tip: Submit a tweet to earn stake-free PoMI mining credits!`);
|
|
172413
172413
|
}
|
|
172414
172414
|
console.log(` npx naracli agent submit-tweet <tweet-url>`);
|
|
172415
|
-
console.log(`
|
|
172415
|
+
console.log(` Tweet must include #NaraChain. Credits are based on likes, bookmarks, retweets, and quotes.`);
|
|
172416
172416
|
console.log("");
|
|
172417
172417
|
} else {
|
|
172418
|
-
const tweetText = `Claiming my AI agent ${agentId} on NaraChain @NaraBuildAI`;
|
|
172418
|
+
const tweetText = `Claiming my AI agent ${agentId} on #NaraChain @NaraBuildAI`;
|
|
172419
172419
|
const tweetIntent = `https://x.com/intent/tweet?text=${tweetText.replace(/ /g, "%20")}`;
|
|
172420
172420
|
console.log(` Tip: Bind your Twitter to get stake-free PoMI mining credits!`);
|
|
172421
172421
|
console.log(` 1. Post a tweet: ${tweetIntent}`);
|
|
@@ -172843,7 +172843,7 @@ function registerAgentCommands(program3) {
|
|
|
172843
172843
|
});
|
|
172844
172844
|
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", `
|
|
172845
172845
|
Tweet content (replace <agent-id> with yours):
|
|
172846
|
-
Claiming my AI agent "<agent-id>" on NaraChain @NaraBuildAI
|
|
172846
|
+
Claiming my AI agent "<agent-id>" on #NaraChain @NaraBuildAI
|
|
172847
172847
|
|
|
172848
172848
|
Tweet URL format:
|
|
172849
172849
|
https://x.com/<username>/status/<id>
|
|
@@ -172869,7 +172869,7 @@ Example:
|
|
|
172869
172869
|
}
|
|
172870
172870
|
} catch {
|
|
172871
172871
|
}
|
|
172872
|
-
const tweetText = `Claiming my AI agent ${agentId} on NaraChain @NaraBuildAI`;
|
|
172872
|
+
const tweetText = `Claiming my AI agent ${agentId} on #NaraChain @NaraBuildAI`;
|
|
172873
172873
|
const tweetIntent = `https://x.com/intent/tweet?text=${tweetText.replace(/ /g, "%20")}`;
|
|
172874
172874
|
console.log("");
|
|
172875
172875
|
console.log(` Bind your Twitter to get stake-free PoMI mining credits!`);
|
|
@@ -173103,7 +173103,7 @@ function registerCommands(program3) {
|
|
|
173103
173103
|
program3.command("transfer <to> <amount>").description("Transfer NARA to another wallet").option("-e, --export-tx", "Export unsigned transaction", false).action(async (to, amount, options) => {
|
|
173104
173104
|
const opts = program3.opts();
|
|
173105
173105
|
try {
|
|
173106
|
-
await
|
|
173106
|
+
await handleTransferNara(to, amount, { ...opts, ...options });
|
|
173107
173107
|
} catch (error) {
|
|
173108
173108
|
printError(error.message);
|
|
173109
173109
|
process.exit(1);
|
|
@@ -173190,7 +173190,7 @@ function registerCommands(program3) {
|
|
|
173190
173190
|
}
|
|
173191
173191
|
|
|
173192
173192
|
// bin/nara-cli.ts
|
|
173193
|
-
var version2 = true ? "1.0.
|
|
173193
|
+
var version2 = true ? "1.0.70" : "dev";
|
|
173194
173194
|
var program2 = new Command();
|
|
173195
173195
|
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);
|
|
173196
173196
|
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
|
@@ -58,7 +58,7 @@ async function resolveAgentId(options: GlobalOptions & { agentId?: string }): Pr
|
|
|
58
58
|
const pubkey = await tryGetWalletPubkey(options.wallet);
|
|
59
59
|
const networkConfig = loadNetworkConfig(rpcUrl, pubkey);
|
|
60
60
|
if (!networkConfig.agent_id) {
|
|
61
|
-
printError('No agent ID
|
|
61
|
+
printError('No agent ID registered for this wallet. Run "agent register <id>" to create one, or use --agent-id to query another agent.');
|
|
62
62
|
process.exit(1);
|
|
63
63
|
}
|
|
64
64
|
return networkConfig.agent_id;
|
|
@@ -188,11 +188,11 @@ async function handleAgentGet(agentId: string, options: GlobalOptions) {
|
|
|
188
188
|
console.log(` Tip: Submit a tweet to earn stake-free PoMI mining credits!`);
|
|
189
189
|
}
|
|
190
190
|
console.log(` npx naracli agent submit-tweet <tweet-url>`);
|
|
191
|
-
console.log(`
|
|
191
|
+
console.log(` Tweet must include #NaraChain. Credits are based on likes, bookmarks, retweets, and quotes.`);
|
|
192
192
|
console.log("");
|
|
193
193
|
} else {
|
|
194
194
|
// Not bound — show bind tip
|
|
195
|
-
const tweetText = `Claiming my AI agent ${agentId} on NaraChain @NaraBuildAI`;
|
|
195
|
+
const tweetText = `Claiming my AI agent ${agentId} on #NaraChain @NaraBuildAI`;
|
|
196
196
|
const tweetIntent = `https://x.com/intent/tweet?text=${tweetText.replace(/ /g, "%20")}`;
|
|
197
197
|
console.log(` Tip: Bind your Twitter to get stake-free PoMI mining credits!`);
|
|
198
198
|
console.log(` 1. Post a tweet: ${tweetIntent}`);
|
|
@@ -794,7 +794,7 @@ export function registerAgentCommands(program: Command): void {
|
|
|
794
794
|
.option("--agent-id <id>", "Agent ID (defaults to saved myid)")
|
|
795
795
|
.addHelpText("after", `
|
|
796
796
|
Tweet content (replace <agent-id> with yours):
|
|
797
|
-
Claiming my AI agent "<agent-id>" on NaraChain @NaraBuildAI
|
|
797
|
+
Claiming my AI agent "<agent-id>" on #NaraChain @NaraBuildAI
|
|
798
798
|
|
|
799
799
|
Tweet URL format:
|
|
800
800
|
https://x.com/<username>/status/<id>
|
|
@@ -824,7 +824,7 @@ Example:
|
|
|
824
824
|
} catch {
|
|
825
825
|
// No binding found
|
|
826
826
|
}
|
|
827
|
-
const tweetText = `Claiming my AI agent ${agentId} on NaraChain @NaraBuildAI`;
|
|
827
|
+
const tweetText = `Claiming my AI agent ${agentId} on #NaraChain @NaraBuildAI`;
|
|
828
828
|
const tweetIntent = `https://x.com/intent/tweet?text=${tweetText.replace(/ /g, "%20")}`;
|
|
829
829
|
console.log("");
|
|
830
830
|
console.log(` Bind your Twitter to get stake-free PoMI mining credits!`);
|
|
@@ -37,7 +37,7 @@ import type {
|
|
|
37
37
|
WalletBalanceOptions,
|
|
38
38
|
TokenBalanceOptions,
|
|
39
39
|
TxStatusOptions,
|
|
40
|
-
|
|
40
|
+
TransferNaraOptions,
|
|
41
41
|
TransferTokenOptions,
|
|
42
42
|
} from "../types";
|
|
43
43
|
|
|
@@ -124,19 +124,19 @@ export async function handleWalletBalance(
|
|
|
124
124
|
|
|
125
125
|
// Get balance
|
|
126
126
|
const balance = await connection.getBalance(pubkey);
|
|
127
|
-
const
|
|
127
|
+
const balanceNara = balance / LAMPORTS_PER_SOL;
|
|
128
128
|
|
|
129
129
|
// Output result
|
|
130
130
|
if (options.json) {
|
|
131
131
|
const output = {
|
|
132
132
|
address: pubkey.toBase58(),
|
|
133
|
-
balance:
|
|
133
|
+
balance: balanceNara,
|
|
134
134
|
lamports: balance,
|
|
135
135
|
};
|
|
136
136
|
console.log(JSON.stringify(output, null, 2));
|
|
137
137
|
} else {
|
|
138
138
|
console.log(`\nWallet: ${pubkey.toBase58()}`);
|
|
139
|
-
console.log(`Balance: ${
|
|
139
|
+
console.log(`Balance: ${balanceNara.toFixed(4)} NARA (${balance.toLocaleString()} lamports)`);
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
|
|
@@ -320,15 +320,15 @@ export async function handleTxStatus(
|
|
|
320
320
|
}
|
|
321
321
|
|
|
322
322
|
/**
|
|
323
|
-
* Handle transfer
|
|
323
|
+
* Handle transfer NARA command
|
|
324
324
|
* @param to Recipient address
|
|
325
|
-
* @param amount Amount in
|
|
325
|
+
* @param amount Amount in NARA
|
|
326
326
|
* @param options Command options
|
|
327
327
|
*/
|
|
328
|
-
export async function
|
|
328
|
+
export async function handleTransferNara(
|
|
329
329
|
to: string,
|
|
330
330
|
amount: string,
|
|
331
|
-
options: Omit<
|
|
331
|
+
options: Omit<TransferNaraOptions, "to" | "amount">
|
|
332
332
|
): Promise<void> {
|
|
333
333
|
// Load wallet
|
|
334
334
|
const wallet = await loadWallet(options.wallet);
|
|
@@ -339,11 +339,11 @@ export async function handleTransferSol(
|
|
|
339
339
|
|
|
340
340
|
// Validate inputs
|
|
341
341
|
const recipient = validatePublicKey(to);
|
|
342
|
-
const
|
|
343
|
-
const lamports = Math.floor(
|
|
342
|
+
const amountNara = validatePositiveNumber(amount, "amount");
|
|
343
|
+
const lamports = Math.floor(amountNara * LAMPORTS_PER_SOL);
|
|
344
344
|
|
|
345
345
|
printInfo(`To: ${recipient.toBase58()}`);
|
|
346
|
-
printInfo(`Amount: ${
|
|
346
|
+
printInfo(`Amount: ${amountNara} NARA`);
|
|
347
347
|
|
|
348
348
|
// Initialize SDK
|
|
349
349
|
const sdk = new NaraSDK({
|
|
@@ -381,7 +381,7 @@ export async function handleTransferSol(
|
|
|
381
381
|
const output = {
|
|
382
382
|
from: wallet.publicKey.toBase58(),
|
|
383
383
|
to: recipient.toBase58(),
|
|
384
|
-
amount:
|
|
384
|
+
amount: amountNara,
|
|
385
385
|
lamports,
|
|
386
386
|
...(txResult.signature && { signature: txResult.signature }),
|
|
387
387
|
...(txResult.base64 && { transaction: txResult.base64 }),
|
|
@@ -391,7 +391,7 @@ export async function handleTransferSol(
|
|
|
391
391
|
console.log(`\nTransfer Details:`);
|
|
392
392
|
console.log(` From: ${wallet.publicKey.toBase58()}`);
|
|
393
393
|
console.log(` To: ${recipient.toBase58()}`);
|
|
394
|
-
console.log(` Amount: ${
|
|
394
|
+
console.log(` Amount: ${amountNara} NARA`);
|
|
395
395
|
printTransactionResult(txResult, false);
|
|
396
396
|
}
|
|
397
397
|
}
|
package/src/cli/index.ts
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
handleWalletBalance,
|
|
19
19
|
handleTokenBalance,
|
|
20
20
|
handleTxStatus,
|
|
21
|
-
|
|
21
|
+
handleTransferNara,
|
|
22
22
|
handleTransferToken,
|
|
23
23
|
} from "./commands/wallet";
|
|
24
24
|
import { loadWallet, getRpcUrl } from "./utils/wallet";
|
|
@@ -29,7 +29,7 @@ import type {
|
|
|
29
29
|
WalletBalanceOptions,
|
|
30
30
|
TokenBalanceOptions,
|
|
31
31
|
TxStatusOptions,
|
|
32
|
-
|
|
32
|
+
TransferNaraOptions,
|
|
33
33
|
TransferTokenOptions,
|
|
34
34
|
} from "./types";
|
|
35
35
|
|
|
@@ -186,9 +186,9 @@ export function registerCommands(program: Command): void {
|
|
|
186
186
|
.description("Transfer NARA to another wallet")
|
|
187
187
|
.option("-e, --export-tx", "Export unsigned transaction", false)
|
|
188
188
|
.action(async (to: string, amount: string, options: { exportTx?: boolean }) => {
|
|
189
|
-
const opts = program.opts() as
|
|
189
|
+
const opts = program.opts() as TransferNaraOptions;
|
|
190
190
|
try {
|
|
191
|
-
await
|
|
191
|
+
await handleTransferNara(to, amount, { ...opts, ...options });
|
|
192
192
|
} catch (error: any) {
|
|
193
193
|
printError(error.message);
|
|
194
194
|
process.exit(1);
|
package/src/cli/types.ts
CHANGED
|
@@ -41,12 +41,12 @@ export interface TxStatusOptions extends GlobalOptions {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
|
-
* Transfer
|
|
44
|
+
* Transfer NARA command options
|
|
45
45
|
*/
|
|
46
|
-
export interface
|
|
46
|
+
export interface TransferNaraOptions extends GlobalOptions {
|
|
47
47
|
/** Recipient address */
|
|
48
48
|
to: string;
|
|
49
|
-
/** Amount in
|
|
49
|
+
/** Amount in NARA */
|
|
50
50
|
amount: number;
|
|
51
51
|
/** Export unsigned transaction */
|
|
52
52
|
exportTx?: boolean;
|