naracli 1.0.17 → 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.
Files changed (41) hide show
  1. package/README.md +101 -114
  2. package/bin/nara-cli.ts +0 -20
  3. package/dist/nara-cli.mjs +49930 -2222
  4. package/index.ts +10 -58
  5. package/package.json +7 -6
  6. package/src/cli/commands/quest.ts +8 -7
  7. package/src/cli/commands/skills.ts +491 -0
  8. package/src/cli/commands/skillsInstall.ts +793 -0
  9. package/src/cli/commands/wallet.ts +13 -114
  10. package/src/cli/commands/zkid.ts +410 -0
  11. package/src/cli/index.ts +215 -9
  12. package/src/cli/prompts/searchMultiselect.ts +297 -0
  13. package/src/cli/types.ts +0 -138
  14. package/src/cli/utils/transaction.ts +1 -1
  15. package/src/cli/utils/validation.ts +0 -40
  16. package/src/cli/utils/wallet.ts +3 -1
  17. package/src/tests/helpers.ts +78 -0
  18. package/src/tests/skills.e2e.test.ts +126 -0
  19. package/src/tests/skills.test.ts +192 -0
  20. package/src/tests/test_skill.md +18 -0
  21. package/src/tests/zkid.e2e.test.ts +128 -0
  22. package/src/tests/zkid.test.ts +153 -0
  23. package/src/types/snarkjs.d.ts +4 -1
  24. package/dist/quest/nara_quest.json +0 -534
  25. package/dist/zk/answer_proof.wasm +0 -0
  26. package/dist/zk/answer_proof_final.zkey +0 -0
  27. package/src/cli/commands/config.ts +0 -125
  28. package/src/cli/commands/migrate.ts +0 -270
  29. package/src/cli/commands/pool.ts +0 -364
  30. package/src/cli/commands/swap.ts +0 -349
  31. package/src/cli/quest/nara_quest.json +0 -534
  32. package/src/cli/quest/nara_quest_types.ts +0 -540
  33. package/src/cli/zk/answer_proof.wasm +0 -0
  34. package/src/cli/zk/answer_proof_final.zkey +0 -0
  35. package/src/client.ts +0 -96
  36. package/src/config.ts +0 -132
  37. package/src/constants.ts +0 -35
  38. package/src/migrate.ts +0 -222
  39. package/src/pool.ts +0 -259
  40. package/src/quest.ts +0 -387
  41. package/src/swap.ts +0 -608
package/README.md CHANGED
@@ -1,108 +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
- ├── Meteora DBC SDK ── Dynamic Bonding Curve pools & swaps
11
- ├── Meteora CP-AMM SDK ── Post-graduation concentrated liquidity
12
- ├── snarkjs (Groth16) ── Zero-knowledge proof generation
13
- └── BIP39 + ed25519-hd-key ── Wallet derivation (m/44'/501'/0'/0')
14
- ```
15
-
16
- ### Wallet
17
-
18
- Standard Solana-compatible wallet using BIP39 mnemonics and ed25519 key derivation. Supports NSO transfers, SPL token transfers, and balance queries.
19
-
20
- ### Quest (Answer-to-Earn with ZK Proofs)
21
-
22
- On-chain quiz system where correct answers earn NSO rewards:
23
-
24
- 1. Fetch the current question from the Anchor program
25
- 2. Compute the answer locally and generate a **Groth16 ZK proof** proving `Poseidon(answer) == answer_hash` without revealing the answer
26
- 3. Proof also binds to the user's public key (pubkey_lo/hi) to prevent replay attacks
27
- 4. Submit proof on-chain (directly or via gasless relay). The program verifies the proof and distributes rewards to winners
28
-
29
- Circuit files: `answer_proof.wasm` + `answer_proof_final.zkey` (BN254 curve).
30
-
31
- ### Token Lifecycle (DBC)
32
-
33
- 1. **Config** - Create bonding curve parameters (supply, initial/migration market cap, fees) via Meteora's `DynamicBondingCurveClient`
34
- 2. **Pool** - Launch a token pool with the bonding curve config, optionally with an initial buy
35
- 3. **Swap** - Buy/sell tokens on the bonding curve. Supports three modes: exact-in, partial-fill, exact-out
36
- 4. **Migrate** - When curve reaches 100%, graduate the pool to Meteora DAMM V2 (Concentrated Position AMM). Requires two Position NFT keypairs for liquidity positions
3
+ Command-line interface for the Nara chain (Solana-compatible). Built on [nara-sdk](https://www.npmjs.com/package/nara-sdk).
37
4
 
38
5
  ## Installation
39
6
 
40
7
  ```bash
41
- npm install naracli
8
+ npx naracli --help
42
9
  ```
43
10
 
44
- ## SDK Usage
45
-
46
- ```typescript
47
- import { NaraSDK } from "naracli";
48
-
49
- const sdk = new NaraSDK({
50
- rpcUrl: "https://mainnet-api.nara.build/",
51
- commitment: "confirmed",
52
- });
53
- ```
54
-
55
- ### Quest SDK
56
-
57
- ```typescript
58
- import {
59
- getQuestInfo,
60
- hasAnswered,
61
- generateProof,
62
- submitAnswer,
63
- submitAnswerViaRelay,
64
- parseQuestReward,
65
- Keypair,
66
- } from "naracli";
67
- import { Connection } from "@solana/web3.js";
68
-
69
- const connection = new Connection("https://mainnet-api.nara.build/", "confirmed");
70
- const wallet = Keypair.fromSecretKey(/* your secret key */);
71
-
72
- // 1. Fetch current quest
73
- const quest = await getQuestInfo(connection);
74
- console.log(quest.question, quest.remainingSlots, quest.timeRemaining);
75
-
76
- // 2. Check if already answered this round
77
- if (await hasAnswered(connection, wallet)) {
78
- console.log("Already answered");
79
- }
80
-
81
- // 3. Generate ZK proof (throws if answer is wrong)
82
- const proof = await generateProof("your-answer", quest.answerHash, wallet.publicKey);
83
-
84
- // 4a. Submit on-chain (requires gas)
85
- const { signature } = await submitAnswer(connection, wallet, proof.solana);
86
-
87
- // 4b. Or submit via gasless relay
88
- const { txHash } = await submitAnswerViaRelay(
89
- "https://quest-api.nara.build/",
90
- wallet.publicKey,
91
- proof.hex
92
- );
93
-
94
- // 5. Parse reward from transaction
95
- const reward = await parseQuestReward(connection, signature);
96
- if (reward.rewarded) {
97
- console.log(`${reward.rewardNso} NSO (winner ${reward.winner})`);
98
- }
99
- ```
100
-
101
- See [examples/](examples/) for complete SDK usage examples.
102
-
103
- ## CLI
104
-
105
- ### Setup
11
+ ## Setup
106
12
 
107
13
  ```bash
108
14
  # Create a new wallet
@@ -115,18 +21,76 @@ npx naracli wallet import -k "your-private-key"
115
21
 
116
22
  Wallet is saved to `~/.config/nara/id.json` by default.
117
23
 
118
- ### Commands
119
-
120
- ```text
121
- wallet Wallet management (create, import, balance, transfer)
122
- config Create bonding curve configurations
123
- pool Create and query token pools
124
- swap Buy / sell tokens, get quotes
125
- migrate Check migration eligibility and launch to DAMM V2
126
- quest On-chain quiz with ZK proof verification
127
- ```
128
-
129
- Run `npx naracli <command> --help` for details on each command.
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 |
92
+
93
+ Run `npx naracli <command> --help` for details.
130
94
 
131
95
  ### Global Options
132
96
 
@@ -136,18 +100,41 @@ Run `npx naracli <command> --help` for details on each command.
136
100
  | `-w, --wallet <path>` | Path to wallet keypair JSON |
137
101
  | `-j, --json` | Output in JSON format |
138
102
 
139
- ### Quick Example
103
+ ## Quick Example
140
104
 
141
105
  ```bash
142
106
  # Check balance
143
- npx naracli wallet balance
144
-
145
- # Buy tokens
146
- npx naracli swap buy <TOKEN_ADDRESS> 0.1
107
+ npx naracli balance
147
108
 
148
109
  # Answer a quest
149
110
  npx naracli quest get
150
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
151
138
  ```
152
139
 
153
140
  ## License
package/bin/nara-cli.ts CHANGED
@@ -4,7 +4,6 @@
4
4
 
5
5
  import { Command } from "commander";
6
6
  import { registerCommands } from "../src/cli/index";
7
- import { loadWallet } from "../src/cli/utils/wallet";
8
7
  import { createRequire } from "node:module";
9
8
 
10
9
  const require = createRequire(import.meta.url);
@@ -25,25 +24,6 @@ program
25
24
  .option("-w, --wallet <path>", "Path to wallet keypair JSON file")
26
25
  .option("-j, --json", "Output in JSON format");
27
26
 
28
- // Top-level address shortcut
29
- program
30
- .command("address")
31
- .description("Show wallet address")
32
- .action(async () => {
33
- const opts = program.opts();
34
- try {
35
- const wallet = await loadWallet(opts.wallet);
36
- if (opts.json) {
37
- console.log(JSON.stringify({ address: wallet.publicKey.toBase58() }, null, 2));
38
- } else {
39
- console.log(wallet.publicKey.toBase58());
40
- }
41
- } catch (error: any) {
42
- console.error(`Error: ${error.message}`);
43
- process.exit(1);
44
- }
45
- });
46
-
47
27
  // Register all command modules
48
28
  registerCommands(program);
49
29