@jellylegsai/aether-cli 1.8.0

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 (62) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +110 -0
  3. package/aether-cli-1.0.0.tgz +0 -0
  4. package/aether-cli-1.8.0.tgz +0 -0
  5. package/aether-hub-1.0.5.tgz +0 -0
  6. package/aether-hub-1.1.8.tgz +0 -0
  7. package/aether-hub-1.2.1.tgz +0 -0
  8. package/commands/account.js +280 -0
  9. package/commands/apy.js +499 -0
  10. package/commands/balance.js +241 -0
  11. package/commands/blockhash.js +181 -0
  12. package/commands/broadcast.js +387 -0
  13. package/commands/claim.js +490 -0
  14. package/commands/config.js +851 -0
  15. package/commands/delegations.js +582 -0
  16. package/commands/doctor.js +769 -0
  17. package/commands/emergency.js +667 -0
  18. package/commands/epoch.js +275 -0
  19. package/commands/fees.js +276 -0
  20. package/commands/index.js +78 -0
  21. package/commands/info.js +495 -0
  22. package/commands/init.js +816 -0
  23. package/commands/install.js +666 -0
  24. package/commands/kyc.js +272 -0
  25. package/commands/logs.js +315 -0
  26. package/commands/monitor.js +431 -0
  27. package/commands/multisig.js +701 -0
  28. package/commands/network.js +429 -0
  29. package/commands/nft.js +857 -0
  30. package/commands/ping.js +266 -0
  31. package/commands/price.js +253 -0
  32. package/commands/rewards.js +931 -0
  33. package/commands/sdk-test.js +477 -0
  34. package/commands/sdk.js +656 -0
  35. package/commands/slot.js +155 -0
  36. package/commands/snapshot.js +470 -0
  37. package/commands/stake-info.js +139 -0
  38. package/commands/stake-positions.js +205 -0
  39. package/commands/stake.js +516 -0
  40. package/commands/stats.js +396 -0
  41. package/commands/status.js +327 -0
  42. package/commands/supply.js +391 -0
  43. package/commands/tps.js +238 -0
  44. package/commands/transfer.js +495 -0
  45. package/commands/tx-history.js +346 -0
  46. package/commands/unstake.js +597 -0
  47. package/commands/validator-info.js +657 -0
  48. package/commands/validator-register.js +593 -0
  49. package/commands/validator-start.js +323 -0
  50. package/commands/validator-status.js +227 -0
  51. package/commands/validators.js +626 -0
  52. package/commands/wallet.js +1570 -0
  53. package/index.js +593 -0
  54. package/lib/errors.js +398 -0
  55. package/package.json +76 -0
  56. package/sdk/README.md +210 -0
  57. package/sdk/index.js +1639 -0
  58. package/sdk/package.json +34 -0
  59. package/sdk/rpc.js +254 -0
  60. package/sdk/test.js +85 -0
  61. package/test/doctor.test.js +76 -0
  62. package/validator-identity.json +4 -0
@@ -0,0 +1,656 @@
1
+ /**
2
+ * aether-cli sdk
3
+ *
4
+ * Provides download links and install instructions for the Aether SDK,
5
+ * Aether JS client, and FLUX/ATH token libraries.
6
+ *
7
+ * Usage:
8
+ * aether-cli sdk # Show all SDK options
9
+ * aether-cli sdk js # Aether JS client
10
+ * aether-cli sdk rust # Aether Rust SDK
11
+ * aether-cli sdk tokens # FLUX/ATH token libraries
12
+ * aether-cli sdk types # TypeScript/Rust type definitions for TX payloads
13
+ */
14
+
15
+ const os = require('os');
16
+
17
+ // ANSI colors
18
+ const colors = {
19
+ reset: '\x1b[0m',
20
+ bright: '\x1b[1m',
21
+ green: '\x1b[32m',
22
+ yellow: '\x1b[33m',
23
+ cyan: '\x1b[36m',
24
+ red: '\x1b[31m',
25
+ dim: '\x1b[2m',
26
+ magenta: '\x1b[35m',
27
+ blue: '\x1b[34m',
28
+ };
29
+
30
+ /**
31
+ * Print the SDK banner
32
+ */
33
+ function printBanner() {
34
+ console.log(`
35
+ ${colors.cyan}╔═══════════════════════════════════════════════════════════════╗
36
+ ${colors.cyan}║ ║
37
+ ${colors.cyan}║ ${colors.bright}AETHER SDK${colors.reset}${colors.cyan} ║
38
+ ${colors.cyan}║ ${colors.bright}Developer Tools & Libraries${colors.reset}${colors.cyan} ║
39
+ ${colors.cyan}║ ║
40
+ ${colors.cyan}╚═══════════════════════════════════════════════════════════════╝${colors.reset}
41
+ `);
42
+ }
43
+
44
+ /**
45
+ * Print a section header
46
+ */
47
+ function printSection(title, icon = '📦') {
48
+ console.log();
49
+ console.log(`${colors.bright}${colors.cyan}${'═'.repeat(60)}${colors.reset}`);
50
+ console.log(`${colors.bright} ${icon} ${title}${colors.reset}`);
51
+ console.log(`${colors.bright}${colors.cyan}${'═'.repeat(60)}${colors.reset}`);
52
+ console.log();
53
+ }
54
+
55
+ /**
56
+ * Print a code block
57
+ */
58
+ function printCode(code, lang = 'bash') {
59
+ console.log(` ${colors.dim}[ ${lang} ]${colors.reset}`);
60
+ console.log(` ${colors.bright}${code}${colors.reset}`);
61
+ console.log();
62
+ }
63
+
64
+ /**
65
+ * Print a link
66
+ */
67
+ function printLink(label, url) {
68
+ console.log(` ${colors.cyan}🔗 ${label}:${colors.reset}`);
69
+ console.log(` ${colors.blue}${url}${colors.reset}`);
70
+ console.log();
71
+ }
72
+
73
+ /**
74
+ * Show all SDK options
75
+ */
76
+ function showAllSdks() {
77
+ printBanner();
78
+
79
+ console.log(` ${colors.bright}Available SDKs and Libraries:${colors.reset}\n`);
80
+
81
+ console.log(` ${colors.green}npm${colors.reset} aether-cli sdk install - Install @jellylegsai/aether-sdk ← NEW!`);
82
+ console.log(` ${colors.yellow}npm${colors.reset} aether-cli sdk js - JavaScript/TypeScript client`);
83
+ console.log(` ${colors.yellow}npm${colors.reset} aether-cli sdk rust - Rust SDK for native development`);
84
+ console.log(` ${colors.yellow}npm${colors.reset} aether-cli sdk tokens - FLUX/ATH token libraries`);
85
+ console.log(` ${colors.yellow}npm${colors.reset} aether-cli sdk docs - Documentation portal`);
86
+ console.log(` ${colors.yellow}npm${colors.reset} aether-cli sdk types - TypeScript/Rust type definitions`);
87
+ console.log();
88
+
89
+ // Quick start
90
+ printSection('⚡ Quick Start', '🚀');
91
+ console.log(' Get started with Aether development in 3 steps:\n');
92
+ console.log(` 1. ${colors.bright}Install the SDK:${colors.reset}`);
93
+ printCode('npx aether-cli sdk install');
94
+ console.log(` 2. ${colors.bright}Initialize your connection:${colors.reset}`);
95
+ printCode("const aether = require('@jellylegsai/aether-sdk');\nconst client = new aether.AetherClient({ rpcUrl: 'http://localhost:8899' });");
96
+ console.log(` 3. ${colors.bright}Start building!${colors.reset}`);
97
+ console.log(` ${colors.dim}See docs for full API reference${colors.reset}`);
98
+ console.log();
99
+
100
+ printLink('Documentation', 'https://docs.aether.network');
101
+ printLink('GitHub Organization', 'https://github.com/aether-network');
102
+ printLink('Discord Community', 'https://discord.gg/aether');
103
+ }
104
+
105
+ /**
106
+ * Show JavaScript SDK info
107
+ */
108
+ function showJsSdk() {
109
+ printSection('Aether JavaScript Client', '📜');
110
+
111
+ console.log(` ${colors.bright}The official Aether JavaScript/TypeScript client library.${colors.reset}`);
112
+ console.log(` Provides a simple API for interacting with the Aether blockchain.${colors.reset}\n`);
113
+
114
+ console.log(` ${colors.green}✓ Stable Release${colors.reset}`);
115
+ console.log(` ${colors.dim}Version: 1.2.0${colors.reset}`);
116
+ console.log();
117
+
118
+ printSection('Transaction Types');
119
+ console.log(` ${colors.cyan}Transfer${colors.reset} — ${colors.dim}Send AETH to another address${colors.reset}`);
120
+ console.log(` { recipient: string, amount: u64, nonce: u64 }`);
121
+ console.log();
122
+ console.log(` ${colors.cyan}Stake${colors.reset} — ${colors.dim}Delegate tokens to a validator${colors.reset}`);
123
+ console.log(` { validator: string, amount: u64 }`);
124
+ console.log();
125
+ console.log(` ${colors.cyan}Unstake${colors.reset} — ${colors.dim}Request withdrawal of staked tokens${colors.reset}`);
126
+ console.log(` { stake_account: string, amount: u64 }`);
127
+ console.log();
128
+ console.log(` ${colors.cyan}ClaimRewards${colors.reset} — ${colors.dim}Claim accumulated staking rewards${colors.reset}`);
129
+ console.log(` { stake_account: string }`);
130
+ console.log();
131
+ console.log(` ${colors.cyan}CreateNFT${colors.reset} — ${colors.dim}Create a new NFT on-chain${colors.reset}`);
132
+ console.log(` { metadata_url: string, royalties: u16 }`);
133
+ console.log();
134
+ console.log(` ${colors.cyan}MintNFT${colors.reset} — ${colors.dim}Mint additional supply of an existing NFT${colors.reset}`);
135
+ console.log(` { nft_id: string, amount: u64 }`);
136
+ console.log();
137
+ console.log(` ${colors.cyan}TransferNFT${colors.reset} — ${colors.dim}Transfer an NFT to another address${colors.reset}`);
138
+ console.log(` { nft_id: string, recipient: string }`);
139
+ console.log();
140
+ console.log(` ${colors.cyan}UpdateMetadata${colors.reset} — ${colors.dim}Update NFT metadata URL${colors.reset}`);
141
+ console.log(` { nft_id: string, metadata_url: string }`);
142
+ console.log();
143
+
144
+ printSection('Installation');
145
+ printCode('npm install @aether-network/client');
146
+ console.log(' or');
147
+ printCode('yarn add @aether-network/client');
148
+ console.log(' or');
149
+ printCode('pnpm add @aether-network/client');
150
+
151
+ printSection('Usage Example');
152
+ const example = `const aether = require('@aether-network/client');
153
+
154
+ // Initialize client
155
+ const client = new aether.Client({
156
+ rpcUrl: 'http://localhost:8899',
157
+ wsUrl: 'ws://localhost:8900',
158
+ });
159
+
160
+ // Get slot info
161
+ const slot = await client.getSlot();
162
+ console.log('Current slot:', slot);
163
+
164
+ // Get account info (includes balance)
165
+ const account = await client.getAccountInfo(pubkey);
166
+ console.log('Balance:', account.lamports, 'lamports');
167
+
168
+ // Send Transfer transaction
169
+ const tx = await client.sendTransaction({
170
+ type: 'Transfer',
171
+ payload: {
172
+ recipient: 'ATH...',
173
+ amount: 1000000000, // 1 AETH in lamports
174
+ nonce: 0,
175
+ },
176
+ });
177
+ console.log('Transaction signature:', tx.signature);`;
178
+
179
+ console.log(` ${colors.dim}[ javascript ]${colors.reset}`);
180
+ example.split('\n').forEach(line => {
181
+ console.log(` ${colors.bright}${line}${colors.reset}`);
182
+ });
183
+ console.log();
184
+
185
+ printSection('RPC API Reference');
186
+ console.log(` ${colors.cyan}GET /v1/account/<addr>${colors.reset} — ${colors.dim}Fetch account info + lamports balance${colors.reset}`);
187
+ console.log(` ${colors.cyan}GET /v1/slot${colors.reset} — ${colors.dim}Get current slot number${colors.reset}`);
188
+ console.log(` ${colors.cyan}GET /v1/validators${colors.reset} — ${colors.dim}List active validators${colors.reset}`);
189
+ console.log(` ${colors.cyan}POST /v1/tx${colors.reset} — ${colors.dim}Submit signed transaction${colors.reset}`);
190
+ console.log(` ${colors.cyan}GET /v1/tx/<signature>${colors.reset} — ${colors.dim}Get transaction receipt${colors.reset}`);
191
+ console.log();
192
+
193
+ printLink('NPM Package', 'https://www.npmjs.com/package/@aether-network/client');
194
+ printLink('TypeScript Docs', 'https://docs.aether.network/sdk/js');
195
+ printLink('GitHub Repo', 'https://github.com/aether-network/aether-js');
196
+ }
197
+
198
+ /**
199
+ * Show Rust SDK info
200
+ */
201
+ function showRustSdk() {
202
+ printSection('Aether Rust SDK', '🦀');
203
+
204
+ console.log(` ${colors.bright}Native Rust SDK for building Aether programs and clients.${colors.reset}`);
205
+ console.log(` Use this for validator plugins, custom programs, and high-performance tools.${colors.reset}\n`);
206
+
207
+ console.log(` ${colors.green}✓ Stable Release${colors.reset}`);
208
+ console.log(` ${colors.dim}Version: 1.2.0${colors.reset}`);
209
+ console.log();
210
+
211
+ printSection('Installation');
212
+ printCode('cargo add aether-sdk');
213
+ console.log(' or add to your Cargo.toml:');
214
+ console.log();
215
+ console.log(` ${colors.dim}${colors.bgRed}toml${colors.reset}`);
216
+ console.log(` ${colors.bright}[dependencies]${colors.reset}`);
217
+ console.log(` ${colors.bright}aether-sdk = "1.2"${colors.reset}`);
218
+ console.log();
219
+
220
+ printSection('Usage Example');
221
+ const rustExample = `use aether_sdk::{client::Client, pubkey::Pubkey};
222
+
223
+ #[tokio::main]
224
+ async fn main() -> Result<(), Box<dyn std::error::Error>> {
225
+ // Initialize client
226
+ let client = Client::new("http://localhost:8899");
227
+
228
+ // Get slot
229
+ let slot = client.get_slot().await?;
230
+ println!("Current slot: {}", slot);
231
+
232
+ // Get balance
233
+ let pubkey = Pubkey::from_str("...")?;
234
+ let balance = client.get_balance(&pubkey).await?;
235
+ println!("Balance: {} lamports", balance);
236
+
237
+ Ok(())
238
+ }`;
239
+
240
+ console.log(` ${colors.dim}${colors.bgRed}rust${colors.reset}`);
241
+ rustExample.split('\n').forEach(line => {
242
+ console.log(` ${colors.bright}${line}${colors.reset}`);
243
+ });
244
+ console.log();
245
+
246
+ printSection('Features');
247
+ console.log(` ${colors.cyan}• Full RPC client${colors.reset}`);
248
+ console.log(` ${colors.cyan}• Program development framework${colors.reset}`);
249
+ console.log(` ${colors.cyan}• Account serialization/deserialization${colors.reset}`);
250
+ console.log(` ${colors.cyan}• Transaction building and signing${colors.reset}`);
251
+ console.log(` ${colors.cyan}• Async runtime support (tokio)${colors.reset}`);
252
+ console.log();
253
+
254
+ printLink('Crates.io', 'https://crates.io/crates/aether-sdk');
255
+ printLink('API Docs', 'https://docs.rs/aether-sdk');
256
+ printLink('GitHub Repo', 'https://github.com/aether-network/aether-rust');
257
+ }
258
+
259
+ /**
260
+ * Show token libraries info
261
+ */
262
+ function showTokensSdk() {
263
+ printSection('FLUX / ATH Token Libraries', '🪙');
264
+
265
+ console.log(` ${colors.bright}Token libraries for FLUX (utility) and ATH (governance) tokens.${colors.reset}`);
266
+ console.log(` Use these to integrate Aether tokens into your applications.${colors.reset}\n`);
267
+
268
+ console.log(` ${colors.yellow}⚠ Beta Release${colors.reset}`);
269
+ console.log(` ${colors.dim}Version: 0.9.0 (testnet only)${colors.reset}`);
270
+ console.log();
271
+
272
+ printSection('Installation');
273
+ console.log(` ${colors.bright}JavaScript:${colors.reset}`);
274
+ printCode('npm install @aether-network/tokens');
275
+ console.log();
276
+ console.log(` ${colors.bright}Rust:${colors.reset}`);
277
+ printCode('cargo add aether-tokens');
278
+
279
+ printSection('Supported Tokens');
280
+ console.log();
281
+ console.log(` ${colors.magenta}FLUX${colors.reset} - Utility Token`);
282
+ console.log(` • Purpose: Transaction fees, staking rewards`);
283
+ console.log(` • Decimals: 9`);
284
+ console.log(` • Mint: ${colors.dim}flux7x... (testnet)${colors.reset}`);
285
+ console.log();
286
+ console.log(` ${colors.blue}ATH${colors.reset} - Governance Token`);
287
+ console.log(` • Purpose: Voting, protocol upgrades`);
288
+ console.log(` • Decimals: 6`);
289
+ console.log(` • Mint: ${colors.dim}athgov... (testnet)${colors.reset}`);
290
+ console.log();
291
+
292
+ printSection('Usage Example (JavaScript)');
293
+ const tokenExample = `const { TokenClient, TOKENS } = require('@aether-network/tokens');
294
+
295
+ const client = new TokenClient(rpcUrl);
296
+
297
+ // Get FLUX balance
298
+ const fluxBalance = await client.getTokenBalance(pubkey, TOKENS.FLUX);
299
+ console.log('FLUX:', fluxBalance);
300
+
301
+ // Transfer FLUX
302
+ const tx = await client.transfer({
303
+ mint: TOKENS.FLUX,
304
+ from: senderPubkey,
305
+ to: recipientPubkey,
306
+ amount: 1000,
307
+ });`;
308
+
309
+ console.log(` ${colors.dim}${colors.bgRed}javascript${colors.reset}`);
310
+ tokenExample.split('\n').forEach(line => {
311
+ console.log(` ${colors.bright}${line}${colors.reset}`);
312
+ });
313
+ console.log();
314
+
315
+ printLink('Token Documentation', 'https://docs.aether.network/tokens');
316
+ printLink('Token Registry', 'https://github.com/aether-network/token-registry');
317
+ printLink('Testnet Faucet', 'https://faucet.aether.network');
318
+ }
319
+
320
+ /**
321
+ * Show install instructions + run npm install for the user
322
+ */
323
+ function showInstall() {
324
+ printSection('Install Aether SDK', '📦');
325
+
326
+ console.log(` ${colors.bright}The @jellylegsai/aether-sdk package lets you:${colors.reset}`);
327
+ console.log(` ${colors.cyan}•${colors.reset} Query the Aether blockchain (balances, accounts, validators)`);
328
+ console.log(` ${colors.cyan}•${colors.reset} Submit real transactions (transfer, stake, unstake, claim)`);
329
+ console.log(` ${colors.cyan}•${colors.reset} Build DApps and automation scripts on top of Aether`);
330
+ console.log();
331
+
332
+ console.log(` ${colors.bright}Installation options:${colors.reset}\n`);
333
+ console.log(` ${colors.green}1)${colors.reset} ${colors.cyan}Install all SDK packages (recommended):${colors.reset}`);
334
+ console.log(` ${colors.dim}npm install @jellylegsai/aether-sdk${colors.reset}`);
335
+ console.log();
336
+
337
+ printSection('Quick Install');
338
+
339
+ console.log(` ${colors.dim}The CLI can run the install command for you in your project directory.${colors.reset}`);
340
+ console.log();
341
+
342
+ const installCmd = 'npm install @jellylegsai/aether-sdk';
343
+ console.log(` ${colors.bright}Running:${colors.reset} ${colors.cyan}${installCmd}${colors.reset}`);
344
+ console.log();
345
+ }
346
+
347
+ /**
348
+ * Execute `npm install @jellylegsai/aether-sdk` in the user's project directory.
349
+ * Detects the target directory from the nearest package.json, or uses cwd.
350
+ */
351
+ async function runInstall(args) {
352
+ const { exec } = require('child_process');
353
+ const fs = require('fs');
354
+ const path = require('path');
355
+
356
+ // Detect install target: nearest package.json up from cwd, else cwd
357
+ let targetDir = process.cwd();
358
+ let searchDir = targetDir;
359
+ for (let i = 0; i < 10; i++) {
360
+ if (fs.existsSync(path.join(searchDir, 'package.json'))) {
361
+ targetDir = searchDir;
362
+ break;
363
+ }
364
+ const parent = path.dirname(searchDir);
365
+ if (parent === searchDir) break;
366
+ searchDir = parent;
367
+ }
368
+
369
+ const isCoreOnly = args.includes('--core');
370
+
371
+ let pkgToInstall = '@jellylegsai/aether-sdk';
372
+
373
+ const installCmd = `npm install ${pkgToInstall}`;
374
+
375
+ printBanner();
376
+ printSection('Installing Aether SDK', '📦');
377
+
378
+ console.log(` ${colors.bright}Target directory:${colors.reset} ${colors.cyan}${targetDir}${colors.reset}`);
379
+ console.log(` ${colors.bright}Package:${colors.reset} ${colors.cyan}${pkgToInstall}${colors.reset}`);
380
+ console.log(` ${colors.dim}Registry:${colors.reset} ${colors.blue}https://registry.npmjs.org${colors.reset}`);
381
+ console.log();
382
+ console.log(` ${colors.dim}Running: ${installCmd}${colors.reset}`);
383
+ console.log();
384
+ console.log(` ${colors.yellow}This may take a moment...${colors.reset}\n`);
385
+
386
+ return new Promise((resolve) => {
387
+ const child = exec(installCmd, { cwd: targetDir }, (err, stdout, stderr) => {
388
+ if (err) {
389
+ console.log(` ${colors.red}✗ Install failed:${colors.reset} ${err.message}`);
390
+ if (stderr) console.log(` ${colors.dim}${stderr}${colors.reset}`);
391
+ console.log();
392
+ console.log(` ${colors.dim}You can try manually:${colors.reset}`);
393
+ console.log(` ${colors.cyan}cd ${targetDir} && npm install @jellylegsai/aether-sdk${colors.reset}`);
394
+ resolve({ success: false, error: err.message });
395
+ } else {
396
+ console.log(` ${colors.green}✓ Install succeeded!${colors.reset}`);
397
+ if (stdout) {
398
+ const lines = stdout.split('\n').filter(l => l.trim());
399
+ for (const line of lines.slice(-5)) {
400
+ console.log(` ${colors.dim}${line}${colors.reset}`);
401
+ }
402
+ }
403
+ console.log();
404
+ console.log(` ${colors.bright}Next steps:${colors.reset}`);
405
+ console.log(` ${colors.dim}1. Import in your code:${colors.reset}`);
406
+ console.log(` ${colors.cyan}const aether = require('@jellylegsai/aether-sdk');${colors.reset}`);
407
+ console.log();
408
+ console.log(` ${colors.dim}2. Initialize the client:${colors.reset}`);
409
+ console.log(` ${colors.cyan}const client = new aether.AetherClient({ rpcUrl: 'http://localhost:8899' });${colors.reset}`);
410
+ console.log();
411
+ console.log(` ${colors.dim}3. Query the chain:${colors.reset}`);
412
+ console.log(` ${colors.cyan}const slot = await client.getSlot();${colors.reset}`);
413
+ console.log(` ${colors.cyan}console.log('Current slot:', slot);${colors.reset}`);
414
+ console.log();
415
+ console.log(` ${colors.bright}Docs:${colors.reset} ${colors.blue}https://docs.aether.network/sdk/js${colors.reset}`);
416
+ console.log();
417
+ resolve({ success: true, targetDir, pkg: pkgToInstall });
418
+ }
419
+ });
420
+
421
+ child.stdout?.on('data', (chunk) => {
422
+ const line = chunk.toString().trim();
423
+ if (line) process.stdout.write(` ${colors.dim}${line}${colors.reset}\n`);
424
+ });
425
+ child.stderr?.on('data', (chunk) => {
426
+ const line = chunk.toString().trim();
427
+ if (line && !line.includes('npm warn')) process.stdout.write(` ${colors.dim}${line}${colors.reset}\n`);
428
+ });
429
+ });
430
+ }
431
+
432
+ /**
433
+ * Show TypeScript/Rust type definitions for Aether transactions
434
+ */
435
+ function showTypes() {
436
+ printSection('Aether Transaction Type Definitions', '🏷️');
437
+
438
+ console.log(` ${colors.bright}Exported from ${colors.cyan}@aether-network/client${colors.reset} and ${colors.cyan}aether-sdk${colors.reset}\n`);
439
+
440
+ printSection('TransactionPayload (Rust enum — serde JSON tag)');
441
+
442
+ const tsTypes = `// TypeScript / JavaScript
443
+ // Import from @aether-network/client
444
+
445
+ // TransactionPayload — discriminated union via 'type' field
446
+ type TransferPayload = { type: 'Transfer'; data: { recipient: string; amount: u64; nonce: u64 } };
447
+ type StakePayload = { type: 'Stake'; data: { validator: string; amount: u64 } };
448
+ type UnstakePayload = { type: 'Unstake'; data: { stake_account: string; amount: u64 } };
449
+ type ClaimRewardsPayload = { type: 'ClaimRewards'; data: { stake_account: string } };
450
+ type CreateNFTPayload = { type: 'CreateNFT'; data: { metadata_url: string; royalties: u16 } };
451
+ type MintNFTPayload = { type: 'MintNFT'; data: { nft_id: string; amount: u64 } };
452
+ type TransferNFTPayload = { type: 'TransferNFT'; data: { nft_id: string; recipient: string } };
453
+ type UpdateMetadataPayload = { type: 'UpdateMetadata'; data: { nft_id: string; metadata_url: string } };
454
+
455
+ type TransactionPayload =
456
+ | TransferPayload | StakePayload | UnstakePayload | ClaimRewardsPayload
457
+ | CreateNFTPayload | MintNFTPayload | TransferNFTPayload | UpdateMetadataPayload;
458
+
459
+ // Full AetherTransaction
460
+ interface AetherTransaction {
461
+ signature: string; // base58 of [u8; 64]
462
+ signer: string; // base58 of [u8; 32]
463
+ tx_type: string; // e.g. "Transfer", "Stake"
464
+ payload: TransactionPayload;
465
+ fee: u64;
466
+ slot: u64;
467
+ timestamp: u64;
468
+ }
469
+
470
+ // Account response from GET /v1/account/<addr>
471
+ interface Account {
472
+ lamports: u64;
473
+ owner: string; // base58 of [u8; 32]
474
+ data: Uint8Array;
475
+ rent_epoch: u64;
476
+ }`;
477
+
478
+ console.log(` ${colors.dim}[ typescript ]${colors.reset}`);
479
+ tsTypes.split('\n').forEach(line => {
480
+ console.log(` ${line}`);
481
+ });
482
+ console.log();
483
+
484
+ printSection('Rust struct definitions (from crates/aether-core/src/types.rs)');
485
+
486
+ const rustTypes = `// Rust — use aether_sdk::types;
487
+
488
+ use serde::{Deserialize, Serialize};
489
+
490
+ #[derive(Debug, Clone, Serialize, Deserialize)]
491
+ pub enum TransactionPayload {
492
+ #[serde(tag = "type", content = "data")]
493
+ Transfer { recipient: String, amount: u64, nonce: u64 },
494
+ #[serde(tag = "type", content = "data")]
495
+ Stake { validator: String, amount: u64 },
496
+ #[serde(tag = "type", content = "data")]
497
+ Unstake { stake_account: String, amount: u64 },
498
+ #[serde(tag = "type", content = "data")]
499
+ ClaimRewards { stake_account: String },
500
+ #[serde(tag = "type", content = "data")]
501
+ CreateNFT { metadata_url: String, royalties: u16 },
502
+ #[serde(tag = "type", content = "data")]
503
+ MintNFT { nft_id: String, amount: u64 },
504
+ #[serde(tag = "type", content = "data")]
505
+ TransferNFT { nft_id: String, recipient: String },
506
+ #[serde(tag = "type", content = "data")]
507
+ UpdateMetadata { nft_id: String, metadata_url: String },
508
+ }
509
+
510
+ #[derive(Debug, Clone, Serialize, Deserialize)]
511
+ pub struct AetherTransaction {
512
+ #[serde(with = "serde_bytes_64")]
513
+ pub signature: [u8; 64],
514
+ #[serde(with = "serde_bytes_32")]
515
+ pub signer: [u8; 32],
516
+ pub tx_type: TransactionType,
517
+ pub payload: TransactionPayload,
518
+ pub fee: u64,
519
+ pub slot: u64,
520
+ pub timestamp: u64,
521
+ }
522
+
523
+ pub type Address = [u8; 32];
524
+
525
+ #[derive(Debug, Clone, Serialize, Deserialize)]
526
+ pub struct Account {
527
+ pub lamports: u64,
528
+ pub owner: [u8; 32],
529
+ pub data: Vec<u8>,
530
+ pub rent_epoch: u64,
531
+ }`;
532
+
533
+ console.log(` ${colors.dim}[ rust ]${colors.reset}`);
534
+ rustTypes.split('\n').forEach(line => {
535
+ console.log(` ${line}`);
536
+ });
537
+ console.log();
538
+
539
+ printSection('TransactionType enum');
540
+ console.log(` ${colors.cyan}Transfer${colors.reset} — Send AETH`);
541
+ console.log(` ${colors.cyan}Stake${colors.reset} — Delegate to validator`);
542
+ console.log(` ${colors.cyan}Unstake${colors.reset} — Request withdrawal`);
543
+ console.log(` ${colors.cyan}ClaimRewards${colors.reset} — Claim staking rewards`);
544
+ console.log(` ${colors.cyan}CreateNFT${colors.reset} — Create on-chain NFT`);
545
+ console.log(` ${colors.cyan}MintNFT${colors.reset} — Mint additional NFT supply`);
546
+ console.log(` ${colors.cyan}TransferNFT${colors.reset} — Transfer NFT to another address`);
547
+ console.log(` ${colors.cyan}UpdateMetadata${colors.reset} — Update NFT metadata URL`);
548
+ console.log();
549
+ }
550
+
551
+ /**
552
+ * Show documentation portal info
553
+ */
554
+ function showDocs() {
555
+ printSection('Aether Documentation', '📚');
556
+
557
+ console.log(` ${colors.bright}Comprehensive documentation for Aether developers.${colors.reset}\n`);
558
+
559
+ console.log(` ${colors.cyan}📖 Documentation Portal:${colors.reset}`);
560
+ console.log(` ${colors.blue}https://docs.aether.network${colors.reset}`);
561
+ console.log();
562
+
563
+ console.log(` ${colors.cyan}Sections:${colors.reset}`);
564
+ console.log(` • Getting Started - Quick start guides`);
565
+ console.log(` • Core Concepts - Accounts, programs, transactions`);
566
+ console.log(` • SDK Reference - Full API docs for JS and Rust`);
567
+ console.log(` • Tutorials - Step-by-step projects`);
568
+ console.log(` • Validator Guide - Running and maintaining validators`);
569
+ console.log(` • Economics - Staking, rewards, fees`);
570
+ console.log();
571
+
572
+ printLink('Main Docs', 'https://docs.aether.network');
573
+ printLink('API Reference', 'https://docs.aether.network/api');
574
+ printLink('Tutorials', 'https://docs.aether.network/tutorials');
575
+ printLink('Validator Docs', 'https://docs.aether.network/validators');
576
+ }
577
+
578
+ /**
579
+ * Parse command line args
580
+ */
581
+ function parseArgs() {
582
+ const args = process.argv.slice(3); // Skip 'aether-cli sdk'
583
+
584
+ if (args.length === 0 || args.includes('--help') || args.includes('-h')) {
585
+ return 'all';
586
+ }
587
+
588
+ const subcmd = args[0].toLowerCase();
589
+
590
+ switch (subcmd) {
591
+ case 'js':
592
+ case 'javascript':
593
+ case 'node':
594
+ return 'js';
595
+ case 'rust':
596
+ case 'rs':
597
+ return 'rust';
598
+ case 'tokens':
599
+ case 'token':
600
+ case 'flux':
601
+ case 'ath':
602
+ return 'tokens';
603
+ case 'docs':
604
+ case 'doc':
605
+ case 'documentation':
606
+ return 'docs';
607
+ case 'types':
608
+ case 'type':
609
+ case 'typedef':
610
+ case 'typedefs':
611
+ return 'types';
612
+ case 'install':
613
+ case 'i':
614
+ return 'install';
615
+ default:
616
+ return 'all';
617
+ }
618
+ }
619
+
620
+ /**
621
+ * Main SDK command
622
+ */
623
+ async function sdkCommand() {
624
+ const subcmd = parseArgs();
625
+
626
+ switch (subcmd) {
627
+ case 'js':
628
+ showJsSdk();
629
+ break;
630
+ case 'rust':
631
+ showRustSdk();
632
+ break;
633
+ case 'tokens':
634
+ showTokensSdk();
635
+ break;
636
+ case 'docs':
637
+ showDocs();
638
+ break;
639
+ case 'types':
640
+ showTypes();
641
+ break;
642
+ case 'install':
643
+ await runInstall(process.argv.slice(4));
644
+ break;
645
+ default:
646
+ showAllSdks();
647
+ }
648
+ }
649
+
650
+ // Export for use as module
651
+ module.exports = { sdkCommand };
652
+
653
+ // Run if called directly
654
+ if (require.main === module) {
655
+ sdkCommand();
656
+ }