naracli 1.0.54 → 1.0.56
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 +54 -12
- package/dist/nara-cli-bundle.cjs +10 -5
- package/package.json +1 -1
- package/src/cli/commands/quest.ts +1 -1
- package/src/cli/commands/wallet.ts +12 -2
- package/src/cli/utils/transaction.ts +1 -1
package/README.md
CHANGED
|
@@ -16,28 +16,70 @@ Wallet management, PoMI mining, agent registration, and network interaction from
|
|
|
16
16
|
## Install
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
|
-
npm install -g
|
|
19
|
+
npm install -g naracli
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Or run directly with npx:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npx naracli <command>
|
|
20
26
|
```
|
|
21
27
|
|
|
22
28
|
## Commands
|
|
23
29
|
|
|
24
30
|
```
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
address Show wallet address
|
|
32
|
+
balance [address] Check NARA balance
|
|
33
|
+
token-balance <token-address> [--owner <addr>] Check token balance
|
|
34
|
+
tx-status <signature> Check transaction status
|
|
35
|
+
transfer <to> <amount> [-e] Transfer NARA
|
|
36
|
+
transfer-token <token> <to> <amount> [--decimals 6] [-e] Transfer tokens
|
|
37
|
+
sign <base64-tx> [--send] Sign a base64-encoded transaction
|
|
38
|
+
sign-url <url> Sign a URL with wallet keypair
|
|
39
|
+
wallet create [-o <path>] Create new wallet
|
|
40
|
+
wallet import [-m <mnemonic>] [-k <key>] [-o <path>] Import wallet
|
|
41
|
+
quest get Get current quest info
|
|
42
|
+
quest answer <answer> [--relay] [--agent <name>] [--model <name>] [--stake [amount]] Submit answer with ZK proof
|
|
43
|
+
quest stake <amount> Stake NARA for quests
|
|
44
|
+
quest unstake <amount> Unstake NARA
|
|
45
|
+
quest stake-info Get quest stake info
|
|
46
|
+
skills register <name> <author> Register a skill on-chain
|
|
47
|
+
skills get <name> Get skill info
|
|
48
|
+
skills upload <name> <file> Upload skill content
|
|
49
|
+
skills add <name> [-g] [-a <agents...>] Install skill to local agents
|
|
50
|
+
skills remove <name> Remove installed skill
|
|
51
|
+
skills list [-g] List installed skills
|
|
52
|
+
skills check [-g] Check for updates
|
|
53
|
+
skills update [names...] [-g] Update skills
|
|
54
|
+
zkid create <name> Register a ZK ID
|
|
55
|
+
zkid info <name> Get ZK ID info
|
|
56
|
+
zkid deposit <name> <amount> Deposit NARA
|
|
57
|
+
zkid scan [name] [-w] Scan claimable deposits
|
|
58
|
+
zkid withdraw <name> [--recipient <addr>] Withdraw deposit
|
|
59
|
+
agent register <agent-id> [--referral <agent-id>] Register an agent on-chain
|
|
60
|
+
agent get <agent-id> Get agent info
|
|
61
|
+
agent set-bio <agent-id> <bio> Set agent bio
|
|
62
|
+
agent upload-memory <agent-id> <file> Upload agent memory
|
|
63
|
+
agent log <agent-id> <activity> <log> Log activity on-chain
|
|
64
|
+
config get Show current config
|
|
65
|
+
config set <key> <value> Set config value
|
|
66
|
+
config reset [key] Reset config to default
|
|
34
67
|
```
|
|
35
68
|
|
|
69
|
+
## Global Options
|
|
70
|
+
|
|
71
|
+
| Option | Description |
|
|
72
|
+
|---|---|
|
|
73
|
+
| `-r, --rpc-url <url>` | RPC endpoint (default: `https://mainnet-api.nara.build/`) |
|
|
74
|
+
| `-w, --wallet <path>` | Wallet keypair JSON |
|
|
75
|
+
| `-j, --json` | JSON output |
|
|
76
|
+
|
|
36
77
|
## Configuration
|
|
37
78
|
|
|
38
79
|
```bash
|
|
39
|
-
|
|
40
|
-
|
|
80
|
+
naracli config set rpc-url https://mainnet-api.nara.build/
|
|
81
|
+
naracli config get
|
|
82
|
+
naracli config reset
|
|
41
83
|
```
|
|
42
84
|
|
|
43
85
|
## License
|
package/dist/nara-cli-bundle.cjs
CHANGED
|
@@ -130494,7 +130494,7 @@ function printTransactionResult(result, jsonMode = false) {
|
|
|
130494
130494
|
printSuccess("Transaction successful!");
|
|
130495
130495
|
console.log(`Signature: ${result.signature}`);
|
|
130496
130496
|
console.log(
|
|
130497
|
-
`View on
|
|
130497
|
+
`View on explorer: https://explorer.nara.build/tx/${result.signature}`
|
|
130498
130498
|
);
|
|
130499
130499
|
}
|
|
130500
130500
|
} else if (result.base64) {
|
|
@@ -130580,7 +130580,12 @@ async function handleTokenBalance(tokenAddress, options) {
|
|
|
130580
130580
|
}
|
|
130581
130581
|
printInfo(`Owner: ${owner.toBase58()}`);
|
|
130582
130582
|
printInfo(`Token: ${tokenAddress}`);
|
|
130583
|
-
const
|
|
130583
|
+
const mintAccountInfo = await connection.getAccountInfo(tokenMint);
|
|
130584
|
+
if (!mintAccountInfo) {
|
|
130585
|
+
throw new Error(`Token mint ${tokenAddress} not found on chain`);
|
|
130586
|
+
}
|
|
130587
|
+
const tokenProgramId = mintAccountInfo.owner.equals(TOKEN_2022_PROGRAM_ID) ? TOKEN_2022_PROGRAM_ID : TOKEN_PROGRAM_ID;
|
|
130588
|
+
const tokenAccount = await getAssociatedTokenAddress(tokenMint, owner, true, tokenProgramId);
|
|
130584
130589
|
try {
|
|
130585
130590
|
const accountInfo = await connection.getTokenAccountBalance(tokenAccount);
|
|
130586
130591
|
const balance = accountInfo.value;
|
|
@@ -130682,7 +130687,7 @@ Transaction: ${signature}`);
|
|
|
130682
130687
|
}
|
|
130683
130688
|
console.log(
|
|
130684
130689
|
`
|
|
130685
|
-
View on
|
|
130690
|
+
View on explorer: https://explorer.nara.build/tx/${signature}`
|
|
130686
130691
|
);
|
|
130687
130692
|
}
|
|
130688
130693
|
}
|
|
@@ -131144,7 +131149,7 @@ async function handleReward(connection, txSignature, options) {
|
|
|
131144
131149
|
} catch {
|
|
131145
131150
|
printWarning("Failed to fetch transaction details. Please check manually later.");
|
|
131146
131151
|
console.log(
|
|
131147
|
-
` https://
|
|
131152
|
+
` https://explorer.nara.build/tx/${txSignature}`
|
|
131148
131153
|
);
|
|
131149
131154
|
return;
|
|
131150
131155
|
}
|
|
@@ -134169,7 +134174,7 @@ function registerCommands(program3) {
|
|
|
134169
134174
|
}
|
|
134170
134175
|
|
|
134171
134176
|
// bin/nara-cli.ts
|
|
134172
|
-
var version2 = true ? "1.0.
|
|
134177
|
+
var version2 = true ? "1.0.56" : "dev";
|
|
134173
134178
|
var program2 = new Command();
|
|
134174
134179
|
program2.name("naracli").description("CLI for the Nara chain (Solana-compatible)").version(version2);
|
|
134175
134180
|
program2.option("-r, --rpc-url <url>", "RPC endpoint URL").option("-w, --wallet <path>", "Path to wallet keypair JSON file").option("-j, --json", "Output in JSON format");
|
package/package.json
CHANGED
|
@@ -334,7 +334,7 @@ async function handleReward(
|
|
|
334
334
|
} catch {
|
|
335
335
|
printWarning("Failed to fetch transaction details. Please check manually later.");
|
|
336
336
|
console.log(
|
|
337
|
-
` https://
|
|
337
|
+
` https://explorer.nara.build/tx/${txSignature}`
|
|
338
338
|
);
|
|
339
339
|
return;
|
|
340
340
|
}
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
getAssociatedTokenAddress,
|
|
15
15
|
createTransferInstruction,
|
|
16
16
|
TOKEN_PROGRAM_ID,
|
|
17
|
+
TOKEN_2022_PROGRAM_ID,
|
|
17
18
|
} from "@solana/spl-token";
|
|
18
19
|
import * as bip39 from "bip39";
|
|
19
20
|
import { derivePath } from "ed25519-hd-key";
|
|
@@ -176,8 +177,17 @@ export async function handleTokenBalance(
|
|
|
176
177
|
printInfo(`Owner: ${owner.toBase58()}`);
|
|
177
178
|
printInfo(`Token: ${tokenAddress}`);
|
|
178
179
|
|
|
180
|
+
// Detect token program (SPL Token vs Token-2022) by checking mint account owner
|
|
181
|
+
const mintAccountInfo = await connection.getAccountInfo(tokenMint);
|
|
182
|
+
if (!mintAccountInfo) {
|
|
183
|
+
throw new Error(`Token mint ${tokenAddress} not found on chain`);
|
|
184
|
+
}
|
|
185
|
+
const tokenProgramId = mintAccountInfo.owner.equals(TOKEN_2022_PROGRAM_ID)
|
|
186
|
+
? TOKEN_2022_PROGRAM_ID
|
|
187
|
+
: TOKEN_PROGRAM_ID;
|
|
188
|
+
|
|
179
189
|
// Get associated token account
|
|
180
|
-
const tokenAccount = await getAssociatedTokenAddress(tokenMint, owner);
|
|
190
|
+
const tokenAccount = await getAssociatedTokenAddress(tokenMint, owner, true, tokenProgramId);
|
|
181
191
|
|
|
182
192
|
// Get token account balance
|
|
183
193
|
try {
|
|
@@ -304,7 +314,7 @@ export async function handleTxStatus(
|
|
|
304
314
|
console.log(`Error: ${JSON.stringify(output.error)}`);
|
|
305
315
|
}
|
|
306
316
|
console.log(
|
|
307
|
-
`\nView on
|
|
317
|
+
`\nView on explorer: https://explorer.nara.build/tx/${signature}`
|
|
308
318
|
);
|
|
309
319
|
}
|
|
310
320
|
}
|
|
@@ -151,7 +151,7 @@ export function printTransactionResult(
|
|
|
151
151
|
printSuccess("Transaction successful!");
|
|
152
152
|
console.log(`Signature: ${result.signature}`);
|
|
153
153
|
console.log(
|
|
154
|
-
`View on
|
|
154
|
+
`View on explorer: https://explorer.nara.build/tx/${result.signature}`
|
|
155
155
|
);
|
|
156
156
|
}
|
|
157
157
|
} else if (result.base64) {
|