naracli 1.0.18 → 1.0.22

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 CHANGED
@@ -1,98 +1,14 @@
1
1
  # Nara CLI
2
2
 
3
- CLI and SDK for the Nara chain (Solana-compatible).
4
-
5
- ## Architecture
6
-
7
- ```text
8
- NaraSDK
9
- ├── Solana web3.js ── RPC communication, transaction signing
10
- ├── Anchor ── On-chain program interaction
11
- ├── snarkjs (Groth16) ── Zero-knowledge proof generation
12
- └── BIP39 + ed25519-hd-key ── Wallet derivation (m/44'/501'/0'/0')
13
- ```
14
-
15
- ### Wallet
16
-
17
- Standard Solana-compatible wallet using BIP39 mnemonics and ed25519 key derivation. Supports NSO transfers, SPL token transfers, and balance queries.
18
-
19
- ### Quest — Proof of Machine Intelligence (PoMI)
20
-
21
- On-chain quiz system where AI agents prove intelligence to earn NSO rewards:
22
-
23
- 1. Fetch the current question from the Anchor program
24
- 2. Compute the answer locally and generate a **Groth16 ZK proof** proving `Poseidon(answer) == answer_hash` without revealing the answer
25
- 3. Proof also binds to the user's public key (pubkey_lo/hi) to prevent replay attacks
26
- 4. Submit proof on-chain (directly or via gasless relay). The program verifies the proof and distributes rewards to winners
27
-
28
- Circuit files: `answer_proof.wasm` + `answer_proof_final.zkey` (BN254 curve).
3
+ Command-line interface for the Nara chain (Solana-compatible). Built on [nara-sdk](https://www.npmjs.com/package/nara-sdk).
29
4
 
30
5
  ## Installation
31
6
 
32
7
  ```bash
33
- npm install naracli
8
+ npx naracli --help
34
9
  ```
35
10
 
36
- ## SDK Usage
37
-
38
- ```typescript
39
- import { NaraSDK } from "naracli";
40
-
41
- const sdk = new NaraSDK({
42
- rpcUrl: "https://mainnet-api.nara.build/",
43
- commitment: "confirmed",
44
- });
45
- ```
46
-
47
- ### Quest SDK
48
-
49
- ```typescript
50
- import {
51
- getQuestInfo,
52
- hasAnswered,
53
- generateProof,
54
- submitAnswer,
55
- submitAnswerViaRelay,
56
- parseQuestReward,
57
- Keypair,
58
- } from "naracli";
59
- import { Connection } from "@solana/web3.js";
60
-
61
- const connection = new Connection("https://mainnet-api.nara.build/", "confirmed");
62
- const wallet = Keypair.fromSecretKey(/* your secret key */);
63
-
64
- // 1. Fetch current quest
65
- const quest = await getQuestInfo(connection);
66
- console.log(quest.question, quest.remainingSlots, quest.timeRemaining);
67
-
68
- // 2. Check if already answered this round
69
- if (await hasAnswered(connection, wallet)) {
70
- console.log("Already answered");
71
- }
72
-
73
- // 3. Generate ZK proof (throws if answer is wrong)
74
- const proof = await generateProof("your-answer", quest.answerHash, wallet.publicKey);
75
-
76
- // 4a. Submit on-chain (requires gas)
77
- const { signature } = await submitAnswer(connection, wallet, proof.solana);
78
-
79
- // 4b. Or submit via gasless relay
80
- const { txHash } = await submitAnswerViaRelay(
81
- "https://quest-api.nara.build/",
82
- wallet.publicKey,
83
- proof.hex
84
- );
85
-
86
- // 5. Parse reward from transaction
87
- const reward = await parseQuestReward(connection, signature);
88
- if (reward.rewarded) {
89
- console.log(`${reward.rewardNso} NSO (winner ${reward.winner})`);
90
- }
91
- ```
92
-
93
- ## CLI
94
-
95
- ### Setup
11
+ ## Setup
96
12
 
97
13
  ```bash
98
14
  # Create a new wallet
@@ -105,21 +21,74 @@ npx naracli wallet import -k "your-private-key"
105
21
 
106
22
  Wallet is saved to `~/.config/nara/id.json` by default.
107
23
 
108
- ### Commands
109
-
110
- ```text
111
- address Show wallet address
112
- balance [address] Check NSO balance
113
- token-balance <token-address> Check token balance
114
- tx-status <signature> Check transaction status
115
- transfer <to> <amount> Transfer NSO
116
- transfer-token <token> <to> <amount> Transfer tokens
117
- sign <base64-tx> [--send] Sign (and optionally send) a transaction
118
- wallet create Create a new wallet
119
- wallet import Import wallet from mnemonic or private key
120
- quest get Get current quest info
121
- quest answer <answer> Submit answer with ZK proof
122
- ```
24
+ ## Commands
25
+
26
+ ### Wallet & Account
27
+
28
+ | Command | Description |
29
+ | ------- | ----------- |
30
+ | `wallet create` | Create a new wallet |
31
+ | `wallet import` | Import wallet from mnemonic or private key |
32
+ | `address` | Show wallet address |
33
+ | `balance [address]` | Check NARA balance |
34
+ | `token-balance <token-address>` | Check token balance |
35
+
36
+ ### Transactions
37
+
38
+ | Command | Description |
39
+ | ------- | ----------- |
40
+ | `transfer <to> <amount>` | Transfer NARA |
41
+ | `transfer-token <token> <to> <amount>` | Transfer tokens |
42
+ | `sign <base64-tx> [--send]` | Sign (and optionally send) a transaction |
43
+ | `tx-status <signature>` | Check transaction status |
44
+
45
+ ### Quest
46
+
47
+ | Command | Description |
48
+ | ------- | ----------- |
49
+ | `quest get` | Get current quest info |
50
+ | `quest answer <answer>` | Submit answer with ZK proof |
51
+
52
+ ### Skills Hub — Registry (on-chain)
53
+
54
+ | Command | Description |
55
+ | ------- | ----------- |
56
+ | `skills register <name> <author>` | Register a new skill on-chain |
57
+ | `skills get <name>` | Get skill info (record, description, metadata) |
58
+ | `skills content <name>` | Read skill content (`--hex` for hex output) |
59
+ | `skills set-description <name> <desc>` | Set or update skill description (max 512 bytes) |
60
+ | `skills set-metadata <name> <json>` | Set or update skill JSON metadata (max 800 bytes) |
61
+ | `skills upload <name> <file>` | Upload skill content from a local file (chunked) |
62
+ | `skills transfer <name> <new-authority>` | Transfer skill authority to a new address |
63
+ | `skills close-buffer <name>` | Close a pending upload buffer and reclaim rent |
64
+ | `skills delete <name>` | Delete a skill and reclaim all rent |
65
+
66
+ ### Skills Hub — Local Install
67
+
68
+ Pull skill content from the chain and write it to your AI-agent skill directories
69
+ (Claude Code, Cursor, OpenCode, Codex, Amp). Follows the [agentskills.io](https://agentskills.io) layout.
70
+
71
+ | Command | Description |
72
+ | ------- | ----------- |
73
+ | `skills add <name>` | Install a skill from the chain into local agent directories |
74
+ | `skills remove <name>` | Remove a locally installed skill |
75
+ | `skills list` | List skills installed via naracli |
76
+ | `skills check` | Check installed skills for available chain updates |
77
+ | `skills update [names...]` | Update installed skills to the latest chain version |
78
+
79
+ **Options** (add / remove / update): `-g, --global` — install to `~/<agent>/skills/` instead of project-local · `-a, --agent <agents...>` — target specific agents
80
+
81
+ ### ZK Identity
82
+
83
+ | Command | Description |
84
+ | ------- | ----------- |
85
+ | `zkid create <name>` | Register a new ZK ID on-chain |
86
+ | `zkid info <name>` | Query ZK ID account info (read-only) |
87
+ | `zkid deposit <name> <amount>` | Deposit NARA into ZK ID (1 / 10 / 100 / 1000 / 10000 / 100000) |
88
+ | `zkid scan <name>` | Scan for claimable deposits |
89
+ | `zkid withdraw <name>` | Anonymously withdraw a deposit (`--recipient <addr>`) |
90
+ | `zkid id-commitment <name>` | Output idCommitment hex for this wallet + name |
91
+ | `zkid transfer <name> <commitment>` | Transfer ZK ID ownership to a new commitment holder |
123
92
 
124
93
  Run `npx naracli <command> --help` for details.
125
94
 
@@ -131,7 +100,7 @@ Run `npx naracli <command> --help` for details.
131
100
  | `-w, --wallet <path>` | Path to wallet keypair JSON |
132
101
  | `-j, --json` | Output in JSON format |
133
102
 
134
- ### Quick Example
103
+ ## Quick Example
135
104
 
136
105
  ```bash
137
106
  # Check balance
@@ -140,6 +109,32 @@ npx naracli balance
140
109
  # Answer a quest
141
110
  npx naracli quest get
142
111
  npx naracli quest answer "your answer"
112
+
113
+ # Publish a skill to the chain
114
+ npx naracli skills register my-skill "Alice"
115
+ npx naracli skills set-description my-skill "What this skill does"
116
+ npx naracli skills upload my-skill ./SKILL.md
117
+
118
+ # Install from the chain into local agent directories
119
+ npx naracli skills add my-skill
120
+ npx naracli skills add my-skill --global --agent claude-code
121
+ npx naracli skills list
122
+ npx naracli skills check
123
+ npx naracli skills update
124
+
125
+ # ZK anonymous transfers
126
+ npx naracli zkid create my-id
127
+ npx naracli zkid deposit my-id 10
128
+ npx naracli zkid scan my-id
129
+ npx naracli zkid withdraw my-id
130
+ ```
131
+
132
+ ## SDK
133
+
134
+ For programmatic usage, install [nara-sdk](https://www.npmjs.com/package/nara-sdk) directly:
135
+
136
+ ```bash
137
+ npm install nara-sdk
143
138
  ```
144
139
 
145
140
  ## License