@xaidenlabs/uso 1.1.70 → 1.1.71

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xaidenlabs/uso",
3
- "version": "1.1.70",
3
+ "version": "1.1.71",
4
4
  "description": "Universal Solana Development Toolchain. Native or Stealth WSL Mode. Build, test, and deploy without the friction.",
5
5
  "bin": {
6
6
  "uso": "bin/index.js"
@@ -0,0 +1,32 @@
1
+ const shell = require('shelljs');
2
+ const os = require('os');
3
+ const { log } = require('../utils/logger');
4
+ const { isStealthMode } = require('../utils/stealth');
5
+ const { runWsl } = require('../utils/wsl-bridge');
6
+
7
+ const address = async () => {
8
+ const stealth = isStealthMode();
9
+
10
+ try {
11
+ let result;
12
+
13
+ if (stealth.enabled) {
14
+ // Run solana address inside WSL
15
+ result = runWsl('solana address', { distro: stealth.distro });
16
+ } else {
17
+ // Run solana address natively
18
+ result = shell.exec('solana address', { silent: true });
19
+ }
20
+
21
+ if (result.code === 0) {
22
+ log.success(result.stdout.trim());
23
+ } else {
24
+ const errorMsg = result.stderr || result.stdout;
25
+ log.error(errorMsg.trim());
26
+ }
27
+ } catch (e) {
28
+ log.error(`Error getting wallet address: ${e.message}`);
29
+ }
30
+ };
31
+
32
+ module.exports = { address };
@@ -331,6 +331,33 @@ const uninstall = async (component) => {
331
331
  }
332
332
  }
333
333
 
334
+ // 3.5 Remove WSL Distro (if stealth mode is active)
335
+ if (stealth.enabled && os.platform() === "win32") {
336
+ const removeWslDistro = await askQuestion(
337
+ "\n🐧 Remove WSL Ubuntu distro completely? (y/N): ",
338
+ );
339
+ if (removeWslDistro.toLowerCase() === "y") {
340
+ log.warn(`āš ļø This will completely remove the ${stealth.distro} distro and all its data.`);
341
+ const confirmWslRemoval = await askQuestion(
342
+ "šŸ’„ Type 'REMOVE WSL' to confirm distro removal: ",
343
+ );
344
+ if (confirmWslRemoval === "REMOVE WSL") {
345
+ log.info(`Unregistering ${stealth.distro} distro...`);
346
+ const unregisterCmd = `wsl --unregister ${stealth.distro}`;
347
+ const result = runOrElevate(
348
+ unregisterCmd,
349
+ `Unregister WSL distro ${stealth.distro}`,
350
+ { enabled: false, distro: stealth.distro },
351
+ );
352
+ if (result) {
353
+ log.success(`āœ… ${stealth.distro} distro removed.`);
354
+ }
355
+ } else {
356
+ log.info("WSL distro removal cancelled.");
357
+ }
358
+ }
359
+ }
360
+
334
361
  // 4. WALLET REMOVAL (DANGER)
335
362
  const walletPath = path.join(os.homedir(), ".config", "solana", "id.json");
336
363
  const wslWalletPath = "$HOME/.config/solana/id.json";
@@ -4,6 +4,8 @@ const path = require('path');
4
4
  const fs = require('fs');
5
5
  const readline = require('readline');
6
6
  const { log } = require('./logger');
7
+ const { isStealthMode } = require('./stealth');
8
+ const { runWsl } = require('./wsl-bridge');
7
9
 
8
10
  const resolveSolanaKeygen = () => {
9
11
  // 1. Try PATH first
@@ -25,12 +27,31 @@ const resolveSolanaKeygen = () => {
25
27
  * Returns true if wallet exists (or was created), false if user declined.
26
28
  */
27
29
  const ensureWalletInteractive = async () => {
28
- const walletDir = path.join(os.homedir(), '.config', 'solana');
29
- const walletPath = path.join(walletDir, 'id.json');
30
+ const stealth = isStealthMode();
31
+
32
+ // When in stealth mode, wallet is in WSL home
33
+ let walletDir, walletPath;
34
+ if (stealth.enabled) {
35
+ walletDir = '$HOME/.config/solana';
36
+ walletPath = '$HOME/.config/solana/id.json';
37
+ } else {
38
+ walletDir = path.join(os.homedir(), '.config', 'solana');
39
+ walletPath = path.join(walletDir, 'id.json');
40
+ }
30
41
 
31
- if (fs.existsSync(walletPath)) {
32
- log.info("šŸ”‘ Wallet found.");
33
- return true;
42
+ // Check if wallet exists
43
+ if (stealth.enabled) {
44
+ // Check inside WSL
45
+ const checkWallet = runWsl('test -f $HOME/.config/solana/id.json && echo "exists"', { distro: stealth.distro });
46
+ if (checkWallet.code === 0 && checkWallet.stdout.includes('exists')) {
47
+ log.info("šŸ”‘ Wallet found (in WSL).");
48
+ return true;
49
+ }
50
+ } else {
51
+ if (fs.existsSync(walletPath)) {
52
+ log.info("šŸ”‘ Wallet found.");
53
+ return true;
54
+ }
34
55
  }
35
56
 
36
57
  const rl = readline.createInterface({
@@ -45,28 +66,51 @@ const ensureWalletInteractive = async () => {
45
66
  rl.close();
46
67
  if (answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes') {
47
68
  log.info("šŸ”‘ Generating wallet...");
48
- if (!fs.existsSync(walletDir)) fs.mkdirSync(walletDir, { recursive: true });
69
+
70
+ try {
71
+ if (stealth.enabled) {
72
+ // Create wallet inside WSL
73
+ const mkdirCmd = 'mkdir -p $HOME/.config/solana';
74
+ runWsl(mkdirCmd, { distro: stealth.distro });
75
+
76
+ // Run solana-keygen inside WSL with interactive mode
77
+ const { spawnSync } = require('child_process');
78
+ const wslCmd = `wsl -d ${stealth.distro} -e bash -c "solana-keygen new --outfile \\$HOME/.config/solana/id.json"`;
79
+ spawnSync('cmd.exe', ['/c', wslCmd], { stdio: 'inherit' });
80
+
81
+ // Verify wallet was created in WSL
82
+ const verifyCmd = runWsl('test -f $HOME/.config/solana/id.json && echo "exists"', { distro: stealth.distro });
83
+ if (verifyCmd.code === 0 && verifyCmd.stdout.includes('exists')) {
84
+ log.success("āœ… Wallet generated (in WSL).");
85
+ resolve(true);
86
+ } else {
87
+ log.warn("āŒ Creation cancelled or failed.");
88
+ resolve(false);
89
+ }
90
+ } else {
91
+ // Create wallet natively on Windows
92
+ if (!fs.existsSync(walletDir)) fs.mkdirSync(walletDir, { recursive: true });
49
93
 
50
- const keygenCmd = resolveSolanaKeygen();
94
+ const keygenCmd = resolveSolanaKeygen();
51
95
 
52
- // Use spawnSync to allow interactive input (passphrase)
53
- const { spawnSync } = require('child_process');
96
+ // Use spawnSync to allow interactive input (passphrase)
97
+ const { spawnSync } = require('child_process');
54
98
 
55
- // We need to strip quotes for spawn
56
- let cmd = keygenCmd;
57
- if (cmd.startsWith('"') && cmd.endsWith('"')) cmd = cmd.slice(1, -1);
99
+ // We need to strip quotes for spawn
100
+ let cmd = keygenCmd;
101
+ if (cmd.startsWith('"') && cmd.endsWith('"')) cmd = cmd.slice(1, -1);
58
102
 
59
- try {
60
- // We use 'new' command which might prompt for passphrase
61
- spawnSync(cmd, ['new', '--outfile', walletPath], { stdio: 'inherit', shell: true });
103
+ // We use 'new' command which might prompt for passphrase
104
+ spawnSync(cmd, ['new', '--outfile', walletPath], { stdio: 'inherit', shell: true });
62
105
 
63
- if (fs.existsSync(walletPath)) {
64
- log.success("āœ… Wallet generated.");
65
- resolve(true);
66
- } else {
67
- // User might have cancelled via Ctrl+C in the subprocess
68
- log.warn("āŒ Creation cancelled or failed.");
69
- resolve(false);
106
+ if (fs.existsSync(walletPath)) {
107
+ log.success("āœ… Wallet generated.");
108
+ resolve(true);
109
+ } else {
110
+ // User might have cancelled via Ctrl+C in the subprocess
111
+ log.warn("āŒ Creation cancelled or failed.");
112
+ resolve(false);
113
+ }
70
114
  }
71
115
  } catch (e) {
72
116
  log.error("āŒ Failed to generate wallet: " + e.message);