aether-hub 1.0.3 → 1.0.6

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/commands/sdk.js CHANGED
@@ -1,381 +1,537 @@
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
- */
13
-
14
- const os = require('os');
15
-
16
- // ANSI colors
17
- const colors = {
18
- reset: '\x1b[0m',
19
- bright: '\x1b[1m',
20
- green: '\x1b[32m',
21
- yellow: '\x1b[33m',
22
- cyan: '\x1b[36m',
23
- red: '\x1b[31m',
24
- dim: '\x1b[2m',
25
- magenta: '\x1b[35m',
26
- blue: '\x1b[34m',
27
- };
28
-
29
- /**
30
- * Print the SDK banner
31
- */
32
- function printBanner() {
33
- console.log(`
34
- ${colors.cyan}╔═══════════════════════════════════════════════════════════════╗
35
- ${colors.cyan}║ ║
36
- ${colors.cyan}║ ${colors.bright}AETHER SDK${colors.reset}${colors.cyan}
37
- ${colors.cyan}║ ${colors.bright}Developer Tools & Libraries${colors.reset}${colors.cyan}
38
- ${colors.cyan}║
39
- ${colors.cyan}╚═══════════════════════════════════════════════════════════════╝${colors.reset}
40
- `);
41
- }
42
-
43
- /**
44
- * Print a section header
45
- */
46
- function printSection(title, icon = '📦') {
47
- console.log();
48
- console.log(`${colors.bright}${colors.cyan}${'═'.repeat(60)}${colors.reset}`);
49
- console.log(`${colors.bright} ${icon} ${title}${colors.reset}`);
50
- console.log(`${colors.bright}${colors.cyan}${'═'.repeat(60)}${colors.reset}`);
51
- console.log();
52
- }
53
-
54
- /**
55
- * Print a code block
56
- */
57
- function printCode(code, lang = 'bash') {
58
- console.log(` ${colors.dim}[ ${lang} ]${colors.reset}`);
59
- console.log(` ${colors.bright}${code}${colors.reset}`);
60
- console.log();
61
- }
62
-
63
- /**
64
- * Print a link
65
- */
66
- function printLink(label, url) {
67
- console.log(` ${colors.cyan}🔗 ${label}:${colors.reset}`);
68
- console.log(` ${colors.blue}${url}${colors.reset}`);
69
- console.log();
70
- }
71
-
72
- /**
73
- * Show all SDK options
74
- */
75
- function showAllSdks() {
76
- printBanner();
77
-
78
- console.log(` ${colors.bright}Available SDKs and Libraries:${colors.reset}\n`);
79
-
80
- console.log(` ${colors.yellow}npm${colors.reset} aether-cli sdk js - JavaScript/TypeScript client`);
81
- console.log(` ${colors.yellow}npm${colors.reset} aether-cli sdk rust - Rust SDK for native development`);
82
- console.log(` ${colors.yellow}npm${colors.reset} aether-cli sdk tokens - FLUX/ATH token libraries`);
83
- console.log(` ${colors.yellow}npm${colors.reset} aether-cli sdk docs - Documentation portal`);
84
- console.log();
85
-
86
- // Quick start
87
- printSection('⚡ Quick Start', '🚀');
88
- console.log(' Get started with Aether development in 3 steps:\n');
89
- console.log(` 1. ${colors.bright}Install the JS client:${colors.reset}`);
90
- printCode('npm install @aether-network/client');
91
- console.log(` 2. ${colors.bright}Initialize your connection:${colors.reset}`);
92
- printCode('const aether = require(\'@aether-network/client\');\nconst client = new aether.Client({ rpcUrl: \'http://localhost:8899\' });');
93
- console.log(` 3. ${colors.bright}Start building!${colors.reset}`);
94
- console.log(` ${colors.dim}See docs for full API reference${colors.reset}`);
95
- console.log();
96
-
97
- printLink('Documentation', 'https://docs.aether.network');
98
- printLink('GitHub Organization', 'https://github.com/aether-network');
99
- printLink('Discord Community', 'https://discord.gg/aether');
100
- }
101
-
102
- /**
103
- * Show JavaScript SDK info
104
- */
105
- function showJsSdk() {
106
- printSection('Aether JavaScript Client', '📜');
107
-
108
- console.log(` ${colors.bright}The official Aether JavaScript/TypeScript client library.${colors.reset}`);
109
- console.log(` Provides a simple API for interacting with the Aether blockchain.${colors.reset}\n`);
110
-
111
- console.log(` ${colors.green}✓ Stable Release${colors.reset}`);
112
- console.log(` ${colors.dim}Version: 1.2.0${colors.reset}`);
113
- console.log();
114
-
115
- printSection('Installation');
116
- printCode('npm install @aether-network/client');
117
- console.log(' or');
118
- printCode('yarn add @aether-network/client');
119
- console.log(' or');
120
- printCode('pnpm add @aether-network/client');
121
-
122
- printSection('Usage Example');
123
- const example = `const aether = require('@aether-network/client');
124
-
125
- // Initialize client
126
- const client = new aether.Client({
127
- rpcUrl: 'http://localhost:8899',
128
- wsUrl: 'ws://localhost:8900',
129
- });
130
-
131
- // Get slot info
132
- const slot = await client.getSlot();
133
- console.log('Current slot:', slot);
134
-
135
- // Get balance
136
- const balance = await client.getBalance('pubkey...');
137
- console.log('Balance:', balance);
138
-
139
- // Send transaction
140
- const tx = await client.sendTransaction({
141
- from: 'sender-pubkey',
142
- to: 'recipient-pubkey',
143
- amount: 1000,
144
- });
145
- console.log('Transaction signature:', tx.signature);`;
146
-
147
- console.log(` ${colors.dim}[ javascript ]${colors.reset}`);
148
- example.split('\n').forEach(line => {
149
- console.log(` ${colors.bright}${line}${colors.reset}`);
150
- });
151
- console.log();
152
-
153
- printSection('API Reference');
154
- console.log(` ${colors.cyan}Core Methods:${colors.reset}`);
155
- console.log(` • getSlot() - Get current slot number`);
156
- console.log(` • getBalance(pubkey) - Get account balance in lamports`);
157
- console.log(` • getAccountInfo(pubkey) - Get full account information`);
158
- console.log(` • sendTransaction(tx) - Send a signed transaction`);
159
- console.log(` • confirmTransaction(sig) - Wait for transaction confirmation`);
160
- console.log(` • getProgramAccounts(...) - Query accounts by program`);
161
- console.log();
162
-
163
- printLink('NPM Package', 'https://www.npmjs.com/package/@aether-network/client');
164
- printLink('TypeScript Docs', 'https://docs.aether.network/sdk/js');
165
- printLink('GitHub Repo', 'https://github.com/aether-network/aether-js');
166
- }
167
-
168
- /**
169
- * Show Rust SDK info
170
- */
171
- function showRustSdk() {
172
- printSection('Aether Rust SDK', '🦀');
173
-
174
- console.log(` ${colors.bright}Native Rust SDK for building Aether programs and clients.${colors.reset}`);
175
- console.log(` Use this for validator plugins, custom programs, and high-performance tools.${colors.reset}\n`);
176
-
177
- console.log(` ${colors.green}✓ Stable Release${colors.reset}`);
178
- console.log(` ${colors.dim}Version: 1.2.0${colors.reset}`);
179
- console.log();
180
-
181
- printSection('Installation');
182
- printCode('cargo add aether-sdk');
183
- console.log(' or add to your Cargo.toml:');
184
- console.log();
185
- console.log(` ${colors.dim}${colors.bgRed}toml${colors.reset}`);
186
- console.log(` ${colors.bright}[dependencies]${colors.reset}`);
187
- console.log(` ${colors.bright}aether-sdk = "1.2"${colors.reset}`);
188
- console.log();
189
-
190
- printSection('Usage Example');
191
- const rustExample = `use aether_sdk::{client::Client, pubkey::Pubkey};
192
-
193
- #[tokio::main]
194
- async fn main() -> Result<(), Box<dyn std::error::Error>> {
195
- // Initialize client
196
- let client = Client::new("http://localhost:8899");
197
-
198
- // Get slot
199
- let slot = client.get_slot().await?;
200
- println!("Current slot: {}", slot);
201
-
202
- // Get balance
203
- let pubkey = Pubkey::from_str("...")?;
204
- let balance = client.get_balance(&pubkey).await?;
205
- println!("Balance: {} lamports", balance);
206
-
207
- Ok(())
208
- }`;
209
-
210
- console.log(` ${colors.dim}${colors.bgRed}rust${colors.reset}`);
211
- rustExample.split('\n').forEach(line => {
212
- console.log(` ${colors.bright}${line}${colors.reset}`);
213
- });
214
- console.log();
215
-
216
- printSection('Features');
217
- console.log(` ${colors.cyan}• Full RPC client${colors.reset}`);
218
- console.log(` ${colors.cyan}• Program development framework${colors.reset}`);
219
- console.log(` ${colors.cyan}• Account serialization/deserialization${colors.reset}`);
220
- console.log(` ${colors.cyan}• Transaction building and signing${colors.reset}`);
221
- console.log(` ${colors.cyan}• Async runtime support (tokio)${colors.reset}`);
222
- console.log();
223
-
224
- printLink('Crates.io', 'https://crates.io/crates/aether-sdk');
225
- printLink('API Docs', 'https://docs.rs/aether-sdk');
226
- printLink('GitHub Repo', 'https://github.com/aether-network/aether-rust');
227
- }
228
-
229
- /**
230
- * Show token libraries info
231
- */
232
- function showTokensSdk() {
233
- printSection('FLUX / ATH Token Libraries', '🪙');
234
-
235
- console.log(` ${colors.bright}Token libraries for FLUX (utility) and ATH (governance) tokens.${colors.reset}`);
236
- console.log(` Use these to integrate Aether tokens into your applications.${colors.reset}\n`);
237
-
238
- console.log(` ${colors.yellow}⚠ Beta Release${colors.reset}`);
239
- console.log(` ${colors.dim}Version: 0.9.0 (testnet only)${colors.reset}`);
240
- console.log();
241
-
242
- printSection('Installation');
243
- console.log(` ${colors.bright}JavaScript:${colors.reset}`);
244
- printCode('npm install @aether-network/tokens');
245
- console.log();
246
- console.log(` ${colors.bright}Rust:${colors.reset}`);
247
- printCode('cargo add aether-tokens');
248
-
249
- printSection('Supported Tokens');
250
- console.log();
251
- console.log(` ${colors.magenta}FLUX${colors.reset} - Utility Token`);
252
- console.log(` • Purpose: Transaction fees, staking rewards`);
253
- console.log(` • Decimals: 9`);
254
- console.log(` • Mint: ${colors.dim}flux7x... (testnet)${colors.reset}`);
255
- console.log();
256
- console.log(` ${colors.blue}ATH${colors.reset} - Governance Token`);
257
- console.log(` • Purpose: Voting, protocol upgrades`);
258
- console.log(` • Decimals: 6`);
259
- console.log(` • Mint: ${colors.dim}athgov... (testnet)${colors.reset}`);
260
- console.log();
261
-
262
- printSection('Usage Example (JavaScript)');
263
- const tokenExample = `const { TokenClient, TOKENS } = require('@aether-network/tokens');
264
-
265
- const client = new TokenClient(rpcUrl);
266
-
267
- // Get FLUX balance
268
- const fluxBalance = await client.getTokenBalance(pubkey, TOKENS.FLUX);
269
- console.log('FLUX:', fluxBalance);
270
-
271
- // Transfer FLUX
272
- const tx = await client.transfer({
273
- mint: TOKENS.FLUX,
274
- from: senderPubkey,
275
- to: recipientPubkey,
276
- amount: 1000,
277
- });`;
278
-
279
- console.log(` ${colors.dim}${colors.bgRed}javascript${colors.reset}`);
280
- tokenExample.split('\n').forEach(line => {
281
- console.log(` ${colors.bright}${line}${colors.reset}`);
282
- });
283
- console.log();
284
-
285
- printLink('Token Documentation', 'https://docs.aether.network/tokens');
286
- printLink('Token Registry', 'https://github.com/aether-network/token-registry');
287
- printLink('Testnet Faucet', 'https://faucet.aether.network');
288
- }
289
-
290
- /**
291
- * Show documentation portal info
292
- */
293
- function showDocs() {
294
- printSection('Aether Documentation', '📚');
295
-
296
- console.log(` ${colors.bright}Comprehensive documentation for Aether developers.${colors.reset}\n`);
297
-
298
- console.log(` ${colors.cyan}📖 Documentation Portal:${colors.reset}`);
299
- console.log(` ${colors.blue}https://docs.aether.network${colors.reset}`);
300
- console.log();
301
-
302
- console.log(` ${colors.cyan}Sections:${colors.reset}`);
303
- console.log(` • Getting Started - Quick start guides`);
304
- console.log(` • Core Concepts - Accounts, programs, transactions`);
305
- console.log(` • SDK Reference - Full API docs for JS and Rust`);
306
- console.log(` • Tutorials - Step-by-step projects`);
307
- console.log(` • Validator Guide - Running and maintaining validators`);
308
- console.log(` • Economics - Staking, rewards, fees`);
309
- console.log();
310
-
311
- printLink('Main Docs', 'https://docs.aether.network');
312
- printLink('API Reference', 'https://docs.aether.network/api');
313
- printLink('Tutorials', 'https://docs.aether.network/tutorials');
314
- printLink('Validator Docs', 'https://docs.aether.network/validators');
315
- }
316
-
317
- /**
318
- * Parse command line args
319
- */
320
- function parseArgs() {
321
- const args = process.argv.slice(3); // Skip 'aether-cli sdk'
322
-
323
- if (args.length === 0 || args.includes('--help') || args.includes('-h')) {
324
- return 'all';
325
- }
326
-
327
- const subcmd = args[0].toLowerCase();
328
-
329
- switch (subcmd) {
330
- case 'js':
331
- case 'javascript':
332
- case 'node':
333
- return 'js';
334
- case 'rust':
335
- case 'rs':
336
- return 'rust';
337
- case 'tokens':
338
- case 'token':
339
- case 'flux':
340
- case 'ath':
341
- return 'tokens';
342
- case 'docs':
343
- case 'doc':
344
- case 'documentation':
345
- return 'docs';
346
- default:
347
- return 'all';
348
- }
349
- }
350
-
351
- /**
352
- * Main SDK command
353
- */
354
- function sdkCommand() {
355
- const subcmd = parseArgs();
356
-
357
- switch (subcmd) {
358
- case 'js':
359
- showJsSdk();
360
- break;
361
- case 'rust':
362
- showRustSdk();
363
- break;
364
- case 'tokens':
365
- showTokensSdk();
366
- break;
367
- case 'docs':
368
- showDocs();
369
- break;
370
- default:
371
- showAllSdks();
372
- }
373
- }
374
-
375
- // Export for use as module
376
- module.exports = { sdkCommand };
377
-
378
- // Run if called directly
379
- if (require.main === module) {
380
- sdkCommand();
381
- }
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.yellow}npm${colors.reset} aether-cli sdk js - JavaScript/TypeScript client`);
82
+ console.log(` ${colors.yellow}npm${colors.reset} aether-cli sdk rust - Rust SDK for native development`);
83
+ console.log(` ${colors.yellow}npm${colors.reset} aether-cli sdk tokens - FLUX/ATH token libraries`);
84
+ console.log(` ${colors.yellow}npm${colors.reset} aether-cli sdk docs - Documentation portal`);
85
+ console.log(` ${colors.yellow}npm${colors.reset} aether-cli sdk types - TypeScript/Rust type definitions`);
86
+ console.log();
87
+
88
+ // Quick start
89
+ printSection('⚡ Quick Start', '🚀');
90
+ console.log(' Get started with Aether development in 3 steps:\n');
91
+ console.log(` 1. ${colors.bright}Install the JS client:${colors.reset}`);
92
+ printCode('npm install @aether-network/client');
93
+ console.log(` 2. ${colors.bright}Initialize your connection:${colors.reset}`);
94
+ printCode('const aether = require(\'@aether-network/client\');\nconst client = new aether.Client({ rpcUrl: \'http://localhost:8899\' });');
95
+ console.log(` 3. ${colors.bright}Start building!${colors.reset}`);
96
+ console.log(` ${colors.dim}See docs for full API reference${colors.reset}`);
97
+ console.log();
98
+
99
+ printLink('Documentation', 'https://docs.aether.network');
100
+ printLink('GitHub Organization', 'https://github.com/aether-network');
101
+ printLink('Discord Community', 'https://discord.gg/aether');
102
+ }
103
+
104
+ /**
105
+ * Show JavaScript SDK info
106
+ */
107
+ function showJsSdk() {
108
+ printSection('Aether JavaScript Client', '📜');
109
+
110
+ console.log(` ${colors.bright}The official Aether JavaScript/TypeScript client library.${colors.reset}`);
111
+ console.log(` Provides a simple API for interacting with the Aether blockchain.${colors.reset}\n`);
112
+
113
+ console.log(` ${colors.green}✓ Stable Release${colors.reset}`);
114
+ console.log(` ${colors.dim}Version: 1.2.0${colors.reset}`);
115
+ console.log();
116
+
117
+ printSection('Transaction Types');
118
+ console.log(` ${colors.cyan}Transfer${colors.reset} — ${colors.dim}Send AETH to another address${colors.reset}`);
119
+ console.log(` { recipient: string, amount: u64, nonce: u64 }`);
120
+ console.log();
121
+ console.log(` ${colors.cyan}Stake${colors.reset} — ${colors.dim}Delegate tokens to a validator${colors.reset}`);
122
+ console.log(` { validator: string, amount: u64 }`);
123
+ console.log();
124
+ console.log(` ${colors.cyan}Unstake${colors.reset} — ${colors.dim}Request withdrawal of staked tokens${colors.reset}`);
125
+ console.log(` { stake_account: string, amount: u64 }`);
126
+ console.log();
127
+ console.log(` ${colors.cyan}ClaimRewards${colors.reset} — ${colors.dim}Claim accumulated staking rewards${colors.reset}`);
128
+ console.log(` { stake_account: string }`);
129
+ console.log();
130
+ console.log(` ${colors.cyan}CreateNFT${colors.reset} — ${colors.dim}Create a new NFT on-chain${colors.reset}`);
131
+ console.log(` { metadata_url: string, royalties: u16 }`);
132
+ console.log();
133
+ console.log(` ${colors.cyan}MintNFT${colors.reset} — ${colors.dim}Mint additional supply of an existing NFT${colors.reset}`);
134
+ console.log(` { nft_id: string, amount: u64 }`);
135
+ console.log();
136
+ console.log(` ${colors.cyan}TransferNFT${colors.reset} — ${colors.dim}Transfer an NFT to another address${colors.reset}`);
137
+ console.log(` { nft_id: string, recipient: string }`);
138
+ console.log();
139
+ console.log(` ${colors.cyan}UpdateMetadata${colors.reset} ${colors.dim}Update NFT metadata URL${colors.reset}`);
140
+ console.log(` { nft_id: string, metadata_url: string }`);
141
+ console.log();
142
+
143
+ printSection('Installation');
144
+ printCode('npm install @aether-network/client');
145
+ console.log(' or');
146
+ printCode('yarn add @aether-network/client');
147
+ console.log(' or');
148
+ printCode('pnpm add @aether-network/client');
149
+
150
+ printSection('Usage Example');
151
+ const example = `const aether = require('@aether-network/client');
152
+
153
+ // Initialize client
154
+ const client = new aether.Client({
155
+ rpcUrl: 'http://localhost:8899',
156
+ wsUrl: 'ws://localhost:8900',
157
+ });
158
+
159
+ // Get slot info
160
+ const slot = await client.getSlot();
161
+ console.log('Current slot:', slot);
162
+
163
+ // Get account info (includes balance)
164
+ const account = await client.getAccountInfo(pubkey);
165
+ console.log('Balance:', account.lamports, 'lamports');
166
+
167
+ // Send Transfer transaction
168
+ const tx = await client.sendTransaction({
169
+ type: 'Transfer',
170
+ payload: {
171
+ recipient: 'ATH...',
172
+ amount: 1000000000, // 1 AETH in lamports
173
+ nonce: 0,
174
+ },
175
+ });
176
+ console.log('Transaction signature:', tx.signature);`;
177
+
178
+ console.log(` ${colors.dim}[ javascript ]${colors.reset}`);
179
+ example.split('\n').forEach(line => {
180
+ console.log(` ${colors.bright}${line}${colors.reset}`);
181
+ });
182
+ console.log();
183
+
184
+ printSection('RPC API Reference');
185
+ console.log(` ${colors.cyan}GET /v1/account/<addr>${colors.reset} — ${colors.dim}Fetch account info + lamports balance${colors.reset}`);
186
+ console.log(` ${colors.cyan}GET /v1/slot${colors.reset} — ${colors.dim}Get current slot number${colors.reset}`);
187
+ console.log(` ${colors.cyan}GET /v1/validators${colors.reset} — ${colors.dim}List active validators${colors.reset}`);
188
+ console.log(` ${colors.cyan}POST /v1/tx${colors.reset} — ${colors.dim}Submit signed transaction${colors.reset}`);
189
+ console.log(` ${colors.cyan}GET /v1/tx/<signature>${colors.reset} — ${colors.dim}Get transaction receipt${colors.reset}`);
190
+ console.log();
191
+
192
+ printLink('NPM Package', 'https://www.npmjs.com/package/@aether-network/client');
193
+ printLink('TypeScript Docs', 'https://docs.aether.network/sdk/js');
194
+ printLink('GitHub Repo', 'https://github.com/aether-network/aether-js');
195
+ }
196
+
197
+ /**
198
+ * Show Rust SDK info
199
+ */
200
+ function showRustSdk() {
201
+ printSection('Aether Rust SDK', '🦀');
202
+
203
+ console.log(` ${colors.bright}Native Rust SDK for building Aether programs and clients.${colors.reset}`);
204
+ console.log(` Use this for validator plugins, custom programs, and high-performance tools.${colors.reset}\n`);
205
+
206
+ console.log(` ${colors.green}✓ Stable Release${colors.reset}`);
207
+ console.log(` ${colors.dim}Version: 1.2.0${colors.reset}`);
208
+ console.log();
209
+
210
+ printSection('Installation');
211
+ printCode('cargo add aether-sdk');
212
+ console.log(' or add to your Cargo.toml:');
213
+ console.log();
214
+ console.log(` ${colors.dim}${colors.bgRed}toml${colors.reset}`);
215
+ console.log(` ${colors.bright}[dependencies]${colors.reset}`);
216
+ console.log(` ${colors.bright}aether-sdk = "1.2"${colors.reset}`);
217
+ console.log();
218
+
219
+ printSection('Usage Example');
220
+ const rustExample = `use aether_sdk::{client::Client, pubkey::Pubkey};
221
+
222
+ #[tokio::main]
223
+ async fn main() -> Result<(), Box<dyn std::error::Error>> {
224
+ // Initialize client
225
+ let client = Client::new("http://localhost:8899");
226
+
227
+ // Get slot
228
+ let slot = client.get_slot().await?;
229
+ println!("Current slot: {}", slot);
230
+
231
+ // Get balance
232
+ let pubkey = Pubkey::from_str("...")?;
233
+ let balance = client.get_balance(&pubkey).await?;
234
+ println!("Balance: {} lamports", balance);
235
+
236
+ Ok(())
237
+ }`;
238
+
239
+ console.log(` ${colors.dim}${colors.bgRed}rust${colors.reset}`);
240
+ rustExample.split('\n').forEach(line => {
241
+ console.log(` ${colors.bright}${line}${colors.reset}`);
242
+ });
243
+ console.log();
244
+
245
+ printSection('Features');
246
+ console.log(` ${colors.cyan}• Full RPC client${colors.reset}`);
247
+ console.log(` ${colors.cyan}• Program development framework${colors.reset}`);
248
+ console.log(` ${colors.cyan}• Account serialization/deserialization${colors.reset}`);
249
+ console.log(` ${colors.cyan}• Transaction building and signing${colors.reset}`);
250
+ console.log(` ${colors.cyan}• Async runtime support (tokio)${colors.reset}`);
251
+ console.log();
252
+
253
+ printLink('Crates.io', 'https://crates.io/crates/aether-sdk');
254
+ printLink('API Docs', 'https://docs.rs/aether-sdk');
255
+ printLink('GitHub Repo', 'https://github.com/aether-network/aether-rust');
256
+ }
257
+
258
+ /**
259
+ * Show token libraries info
260
+ */
261
+ function showTokensSdk() {
262
+ printSection('FLUX / ATH Token Libraries', '🪙');
263
+
264
+ console.log(` ${colors.bright}Token libraries for FLUX (utility) and ATH (governance) tokens.${colors.reset}`);
265
+ console.log(` Use these to integrate Aether tokens into your applications.${colors.reset}\n`);
266
+
267
+ console.log(` ${colors.yellow}⚠ Beta Release${colors.reset}`);
268
+ console.log(` ${colors.dim}Version: 0.9.0 (testnet only)${colors.reset}`);
269
+ console.log();
270
+
271
+ printSection('Installation');
272
+ console.log(` ${colors.bright}JavaScript:${colors.reset}`);
273
+ printCode('npm install @aether-network/tokens');
274
+ console.log();
275
+ console.log(` ${colors.bright}Rust:${colors.reset}`);
276
+ printCode('cargo add aether-tokens');
277
+
278
+ printSection('Supported Tokens');
279
+ console.log();
280
+ console.log(` ${colors.magenta}FLUX${colors.reset} - Utility Token`);
281
+ console.log(` • Purpose: Transaction fees, staking rewards`);
282
+ console.log(` • Decimals: 9`);
283
+ console.log(` • Mint: ${colors.dim}flux7x... (testnet)${colors.reset}`);
284
+ console.log();
285
+ console.log(` ${colors.blue}ATH${colors.reset} - Governance Token`);
286
+ console.log(` • Purpose: Voting, protocol upgrades`);
287
+ console.log(` • Decimals: 6`);
288
+ console.log(` • Mint: ${colors.dim}athgov... (testnet)${colors.reset}`);
289
+ console.log();
290
+
291
+ printSection('Usage Example (JavaScript)');
292
+ const tokenExample = `const { TokenClient, TOKENS } = require('@aether-network/tokens');
293
+
294
+ const client = new TokenClient(rpcUrl);
295
+
296
+ // Get FLUX balance
297
+ const fluxBalance = await client.getTokenBalance(pubkey, TOKENS.FLUX);
298
+ console.log('FLUX:', fluxBalance);
299
+
300
+ // Transfer FLUX
301
+ const tx = await client.transfer({
302
+ mint: TOKENS.FLUX,
303
+ from: senderPubkey,
304
+ to: recipientPubkey,
305
+ amount: 1000,
306
+ });`;
307
+
308
+ console.log(` ${colors.dim}${colors.bgRed}javascript${colors.reset}`);
309
+ tokenExample.split('\n').forEach(line => {
310
+ console.log(` ${colors.bright}${line}${colors.reset}`);
311
+ });
312
+ console.log();
313
+
314
+ printLink('Token Documentation', 'https://docs.aether.network/tokens');
315
+ printLink('Token Registry', 'https://github.com/aether-network/token-registry');
316
+ printLink('Testnet Faucet', 'https://faucet.aether.network');
317
+ }
318
+
319
+ /**
320
+ * Show TypeScript/Rust type definitions for Aether transactions
321
+ */
322
+ function showTypes() {
323
+ printSection('Aether Transaction Type Definitions', '🏷️');
324
+
325
+ console.log(` ${colors.bright}Exported from ${colors.cyan}@aether-network/client${colors.reset} and ${colors.cyan}aether-sdk${colors.reset}\n`);
326
+
327
+ printSection('TransactionPayload (Rust enum — serde JSON tag)');
328
+
329
+ const tsTypes = `// TypeScript / JavaScript
330
+ // Import from @aether-network/client
331
+
332
+ // TransactionPayload — discriminated union via 'type' field
333
+ type TransferPayload = { type: 'Transfer'; data: { recipient: string; amount: u64; nonce: u64 } };
334
+ type StakePayload = { type: 'Stake'; data: { validator: string; amount: u64 } };
335
+ type UnstakePayload = { type: 'Unstake'; data: { stake_account: string; amount: u64 } };
336
+ type ClaimRewardsPayload = { type: 'ClaimRewards'; data: { stake_account: string } };
337
+ type CreateNFTPayload = { type: 'CreateNFT'; data: { metadata_url: string; royalties: u16 } };
338
+ type MintNFTPayload = { type: 'MintNFT'; data: { nft_id: string; amount: u64 } };
339
+ type TransferNFTPayload = { type: 'TransferNFT'; data: { nft_id: string; recipient: string } };
340
+ type UpdateMetadataPayload = { type: 'UpdateMetadata'; data: { nft_id: string; metadata_url: string } };
341
+
342
+ type TransactionPayload =
343
+ | TransferPayload | StakePayload | UnstakePayload | ClaimRewardsPayload
344
+ | CreateNFTPayload | MintNFTPayload | TransferNFTPayload | UpdateMetadataPayload;
345
+
346
+ // Full AetherTransaction
347
+ interface AetherTransaction {
348
+ signature: string; // base58 of [u8; 64]
349
+ signer: string; // base58 of [u8; 32]
350
+ tx_type: string; // e.g. "Transfer", "Stake"
351
+ payload: TransactionPayload;
352
+ fee: u64;
353
+ slot: u64;
354
+ timestamp: u64;
355
+ }
356
+
357
+ // Account response from GET /v1/account/<addr>
358
+ interface Account {
359
+ lamports: u64;
360
+ owner: string; // base58 of [u8; 32]
361
+ data: Uint8Array;
362
+ rent_epoch: u64;
363
+ }`;
364
+
365
+ console.log(` ${colors.dim}[ typescript ]${colors.reset}`);
366
+ tsTypes.split('\n').forEach(line => {
367
+ console.log(` ${line}`);
368
+ });
369
+ console.log();
370
+
371
+ printSection('Rust struct definitions (from crates/aether-core/src/types.rs)');
372
+
373
+ const rustTypes = `// Rust — use aether_sdk::types;
374
+
375
+ use serde::{Deserialize, Serialize};
376
+
377
+ #[derive(Debug, Clone, Serialize, Deserialize)]
378
+ pub enum TransactionPayload {
379
+ #[serde(tag = "type", content = "data")]
380
+ Transfer { recipient: String, amount: u64, nonce: u64 },
381
+ #[serde(tag = "type", content = "data")]
382
+ Stake { validator: String, amount: u64 },
383
+ #[serde(tag = "type", content = "data")]
384
+ Unstake { stake_account: String, amount: u64 },
385
+ #[serde(tag = "type", content = "data")]
386
+ ClaimRewards { stake_account: String },
387
+ #[serde(tag = "type", content = "data")]
388
+ CreateNFT { metadata_url: String, royalties: u16 },
389
+ #[serde(tag = "type", content = "data")]
390
+ MintNFT { nft_id: String, amount: u64 },
391
+ #[serde(tag = "type", content = "data")]
392
+ TransferNFT { nft_id: String, recipient: String },
393
+ #[serde(tag = "type", content = "data")]
394
+ UpdateMetadata { nft_id: String, metadata_url: String },
395
+ }
396
+
397
+ #[derive(Debug, Clone, Serialize, Deserialize)]
398
+ pub struct AetherTransaction {
399
+ #[serde(with = "serde_bytes_64")]
400
+ pub signature: [u8; 64],
401
+ #[serde(with = "serde_bytes_32")]
402
+ pub signer: [u8; 32],
403
+ pub tx_type: TransactionType,
404
+ pub payload: TransactionPayload,
405
+ pub fee: u64,
406
+ pub slot: u64,
407
+ pub timestamp: u64,
408
+ }
409
+
410
+ pub type Address = [u8; 32];
411
+
412
+ #[derive(Debug, Clone, Serialize, Deserialize)]
413
+ pub struct Account {
414
+ pub lamports: u64,
415
+ pub owner: [u8; 32],
416
+ pub data: Vec<u8>,
417
+ pub rent_epoch: u64,
418
+ }`;
419
+
420
+ console.log(` ${colors.dim}[ rust ]${colors.reset}`);
421
+ rustTypes.split('\n').forEach(line => {
422
+ console.log(` ${line}`);
423
+ });
424
+ console.log();
425
+
426
+ printSection('TransactionType enum');
427
+ console.log(` ${colors.cyan}Transfer${colors.reset} — Send AETH`);
428
+ console.log(` ${colors.cyan}Stake${colors.reset} — Delegate to validator`);
429
+ console.log(` ${colors.cyan}Unstake${colors.reset} — Request withdrawal`);
430
+ console.log(` ${colors.cyan}ClaimRewards${colors.reset} — Claim staking rewards`);
431
+ console.log(` ${colors.cyan}CreateNFT${colors.reset} — Create on-chain NFT`);
432
+ console.log(` ${colors.cyan}MintNFT${colors.reset} — Mint additional NFT supply`);
433
+ console.log(` ${colors.cyan}TransferNFT${colors.reset} — Transfer NFT to another address`);
434
+ console.log(` ${colors.cyan}UpdateMetadata${colors.reset} — Update NFT metadata URL`);
435
+ console.log();
436
+ }
437
+
438
+ /**
439
+ * Show documentation portal info
440
+ */
441
+ function showDocs() {
442
+ printSection('Aether Documentation', '📚');
443
+
444
+ console.log(` ${colors.bright}Comprehensive documentation for Aether developers.${colors.reset}\n`);
445
+
446
+ console.log(` ${colors.cyan}📖 Documentation Portal:${colors.reset}`);
447
+ console.log(` ${colors.blue}https://docs.aether.network${colors.reset}`);
448
+ console.log();
449
+
450
+ console.log(` ${colors.cyan}Sections:${colors.reset}`);
451
+ console.log(` • Getting Started - Quick start guides`);
452
+ console.log(` • Core Concepts - Accounts, programs, transactions`);
453
+ console.log(` • SDK Reference - Full API docs for JS and Rust`);
454
+ console.log(` • Tutorials - Step-by-step projects`);
455
+ console.log(` • Validator Guide - Running and maintaining validators`);
456
+ console.log(` • Economics - Staking, rewards, fees`);
457
+ console.log();
458
+
459
+ printLink('Main Docs', 'https://docs.aether.network');
460
+ printLink('API Reference', 'https://docs.aether.network/api');
461
+ printLink('Tutorials', 'https://docs.aether.network/tutorials');
462
+ printLink('Validator Docs', 'https://docs.aether.network/validators');
463
+ }
464
+
465
+ /**
466
+ * Parse command line args
467
+ */
468
+ function parseArgs() {
469
+ const args = process.argv.slice(3); // Skip 'aether-cli sdk'
470
+
471
+ if (args.length === 0 || args.includes('--help') || args.includes('-h')) {
472
+ return 'all';
473
+ }
474
+
475
+ const subcmd = args[0].toLowerCase();
476
+
477
+ switch (subcmd) {
478
+ case 'js':
479
+ case 'javascript':
480
+ case 'node':
481
+ return 'js';
482
+ case 'rust':
483
+ case 'rs':
484
+ return 'rust';
485
+ case 'tokens':
486
+ case 'token':
487
+ case 'flux':
488
+ case 'ath':
489
+ return 'tokens';
490
+ case 'docs':
491
+ case 'doc':
492
+ case 'documentation':
493
+ return 'docs';
494
+ case 'types':
495
+ case 'type':
496
+ case 'typedef':
497
+ case 'typedefs':
498
+ return 'types';
499
+ default:
500
+ return 'all';
501
+ }
502
+ }
503
+
504
+ /**
505
+ * Main SDK command
506
+ */
507
+ function sdkCommand() {
508
+ const subcmd = parseArgs();
509
+
510
+ switch (subcmd) {
511
+ case 'js':
512
+ showJsSdk();
513
+ break;
514
+ case 'rust':
515
+ showRustSdk();
516
+ break;
517
+ case 'tokens':
518
+ showTokensSdk();
519
+ break;
520
+ case 'docs':
521
+ showDocs();
522
+ break;
523
+ case 'types':
524
+ showTypes();
525
+ break;
526
+ default:
527
+ showAllSdks();
528
+ }
529
+ }
530
+
531
+ // Export for use as module
532
+ module.exports = { sdkCommand };
533
+
534
+ // Run if called directly
535
+ if (require.main === module) {
536
+ sdkCommand();
537
+ }