@xaidenlabs/uso 1.1.71 → 1.1.73

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.71",
3
+ "version": "1.1.73",
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"
@@ -1,32 +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');
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
6
 
7
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}`);
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());
29
26
  }
27
+ } catch (e) {
28
+ log.error(`Error getting wallet address: ${e.message}`);
29
+ }
30
30
  };
31
31
 
32
32
  module.exports = { address };
@@ -337,7 +337,9 @@ const uninstall = async (component) => {
337
337
  "\n🐧 Remove WSL Ubuntu distro completely? (y/N): ",
338
338
  );
339
339
  if (removeWslDistro.toLowerCase() === "y") {
340
- log.warn(`āš ļø This will completely remove the ${stealth.distro} distro and all its data.`);
340
+ log.warn(
341
+ `āš ļø This will completely remove the ${stealth.distro} distro and all its data.`,
342
+ );
341
343
  const confirmWslRemoval = await askQuestion(
342
344
  "šŸ’„ Type 'REMOVE WSL' to confirm distro removal: ",
343
345
  );
@@ -1,25 +1,34 @@
1
- const os = require('os');
2
- const shell = require('shelljs');
3
- const path = require('path');
4
- const fs = require('fs');
5
- const readline = require('readline');
6
- const { log } = require('./logger');
7
- const { isStealthMode } = require('./stealth');
8
- const { runWsl } = require('./wsl-bridge');
1
+ const os = require("os");
2
+ const shell = require("shelljs");
3
+ const path = require("path");
4
+ const fs = require("fs");
5
+ const readline = require("readline");
6
+ const { log } = require("./logger");
7
+ const { isStealthMode } = require("./stealth");
8
+ const { runWsl } = require("./wsl-bridge");
9
9
 
10
10
  const resolveSolanaKeygen = () => {
11
- // 1. Try PATH first
12
- if (shell.which('solana-keygen')) return 'solana-keygen';
13
-
14
- // 2. Try default Windows path
15
- if (os.platform() === 'win32') {
16
- const home = os.homedir();
17
- const defaultPath = path.join(home, '.local', 'share', 'solana', 'install', 'active_release', 'bin', 'solana-keygen.exe');
18
- if (fs.existsSync(defaultPath)) return `"${defaultPath}"`;
19
- }
11
+ // 1. Try PATH first
12
+ if (shell.which("solana-keygen")) return "solana-keygen";
13
+
14
+ // 2. Try default Windows path
15
+ if (os.platform() === "win32") {
16
+ const home = os.homedir();
17
+ const defaultPath = path.join(
18
+ home,
19
+ ".local",
20
+ "share",
21
+ "solana",
22
+ "install",
23
+ "active_release",
24
+ "bin",
25
+ "solana-keygen.exe",
26
+ );
27
+ if (fs.existsSync(defaultPath)) return `"${defaultPath}"`;
28
+ }
20
29
 
21
- // Fallback
22
- return 'solana-keygen';
30
+ // Fallback
31
+ return "solana-keygen";
23
32
  };
24
33
 
25
34
  /**
@@ -27,104 +36,116 @@ const resolveSolanaKeygen = () => {
27
36
  * Returns true if wallet exists (or was created), false if user declined.
28
37
  */
29
38
  const ensureWalletInteractive = async () => {
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
- }
39
+ const stealth = isStealthMode();
41
40
 
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
- }
41
+ // When in stealth mode, wallet is in WSL home
42
+ let walletDir, walletPath;
43
+ if (stealth.enabled) {
44
+ walletDir = "$HOME/.config/solana";
45
+ walletPath = "$HOME/.config/solana/id.json";
46
+ } else {
47
+ walletDir = path.join(os.homedir(), ".config", "solana");
48
+ walletPath = path.join(walletDir, "id.json");
49
+ }
50
+
51
+ // Check if wallet exists
52
+ if (stealth.enabled) {
53
+ // Check inside WSL
54
+ const checkWallet = runWsl(
55
+ 'test -f $HOME/.config/solana/id.json && echo "exists"',
56
+ { distro: stealth.distro },
57
+ );
58
+ if (checkWallet.code === 0 && checkWallet.stdout.includes("exists")) {
59
+ log.info("šŸ”‘ Wallet found (in WSL).");
60
+ return true;
61
+ }
62
+ } else {
63
+ if (fs.existsSync(walletPath)) {
64
+ log.info("šŸ”‘ Wallet found.");
65
+ return true;
55
66
  }
67
+ }
68
+
69
+ const rl = readline.createInterface({
70
+ input: process.stdin,
71
+ output: process.stdout,
72
+ });
73
+
74
+ return new Promise((resolve) => {
75
+ log.info("");
76
+ log.warn("āš ļø No Solana wallet found.");
77
+ rl.question(
78
+ "šŸ‘‰ Do you want to generate a new Solana wallet? [y/N] ",
79
+ (answer) => {
80
+ rl.close();
81
+ if (answer.toLowerCase() === "y" || answer.toLowerCase() === "yes") {
82
+ log.info("šŸ”‘ Generating wallet...");
56
83
 
57
- const rl = readline.createInterface({
58
- input: process.stdin,
59
- output: process.stdout
60
- });
61
-
62
- return new Promise((resolve) => {
63
- log.info("");
64
- log.warn("āš ļø No Solana wallet found.");
65
- rl.question("šŸ‘‰ Do you want to generate a new Solana wallet? [y/N] ", (answer) => {
66
- rl.close();
67
- if (answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes') {
68
- log.info("šŸ”‘ Generating wallet...");
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 });
93
-
94
- const keygenCmd = resolveSolanaKeygen();
95
-
96
- // Use spawnSync to allow interactive input (passphrase)
97
- const { spawnSync } = require('child_process');
98
-
99
- // We need to strip quotes for spawn
100
- let cmd = keygenCmd;
101
- if (cmd.startsWith('"') && cmd.endsWith('"')) cmd = cmd.slice(1, -1);
102
-
103
- // We use 'new' command which might prompt for passphrase
104
- spawnSync(cmd, ['new', '--outfile', walletPath], { stdio: 'inherit', shell: true });
105
-
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
- }
114
- }
115
- } catch (e) {
116
- log.error("āŒ Failed to generate wallet: " + e.message);
117
- resolve(false);
118
- }
84
+ try {
85
+ if (stealth.enabled) {
86
+ // Create wallet inside WSL
87
+ const { spawnSync } = require("child_process");
88
+
89
+ // Use a login shell (-l) to load full environment, then create wallet
90
+ const wslCmd = `mkdir -p "$HOME/.config/solana" && solana-keygen new --outfile "$HOME/.config/solana/id.json"`;
91
+ const result = spawnSync("wsl", ["-d", stealth.distro, "-e", "bash", "-l", "-c", wslCmd], { stdio: "inherit" });
92
+
93
+ // Verify wallet was created in WSL
94
+ const verifyCmd = runWsl(
95
+ 'test -f $HOME/.config/solana/id.json && echo "exists"',
96
+ { distro: stealth.distro },
97
+ );
98
+ if (verifyCmd.code === 0 && verifyCmd.stdout.includes("exists")) {
99
+ log.success("āœ… Wallet generated (in WSL).");
100
+ resolve(true);
101
+ } else {
102
+ log.warn("āŒ Creation cancelled or failed.");
103
+ resolve(false);
104
+ }
119
105
  } else {
120
- log.info(" Skipping wallet generation.");
106
+ // Create wallet natively on Windows
107
+ if (!fs.existsSync(walletDir))
108
+ fs.mkdirSync(walletDir, { recursive: true });
109
+
110
+ const keygenCmd = resolveSolanaKeygen();
111
+
112
+ // Use spawnSync to allow interactive input (passphrase)
113
+ const { spawnSync } = require("child_process");
114
+
115
+ // We need to strip quotes for spawn
116
+ let cmd = keygenCmd;
117
+ if (cmd.startsWith('"') && cmd.endsWith('"'))
118
+ cmd = cmd.slice(1, -1);
119
+
120
+ // We use 'new' command which might prompt for passphrase
121
+ spawnSync(cmd, ["new", "--outfile", walletPath], {
122
+ stdio: "inherit",
123
+ shell: true,
124
+ });
125
+
126
+ if (fs.existsSync(walletPath)) {
127
+ log.success("āœ… Wallet generated.");
128
+ resolve(true);
129
+ } else {
130
+ // User might have cancelled via Ctrl+C in the subprocess
131
+ log.warn("āŒ Creation cancelled or failed.");
121
132
  resolve(false);
133
+ }
122
134
  }
123
- });
124
- });
135
+ } catch (e) {
136
+ log.error("āŒ Failed to generate wallet: " + e.message);
137
+ resolve(false);
138
+ }
139
+ } else {
140
+ log.info(" Skipping wallet generation.");
141
+ resolve(false);
142
+ }
143
+ },
144
+ );
145
+ });
125
146
  };
126
147
 
127
148
  module.exports = {
128
- resolveSolanaKeygen,
129
- ensureWalletInteractive
149
+ resolveSolanaKeygen,
150
+ ensureWalletInteractive,
130
151
  };