@moly-mcp/lido 1.1.3 → 1.1.4
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/dist/bin.js +26 -15
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -151,35 +151,46 @@ async function runWizard() {
|
|
|
151
151
|
if (keySource === "ows") {
|
|
152
152
|
let owsSdk = null;
|
|
153
153
|
let wallets = [];
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
154
|
+
const { createRequire } = await import("module");
|
|
155
|
+
const { homedir } = await import("os");
|
|
156
|
+
const { join } = await import("path");
|
|
157
|
+
const owsDir = join(homedir(), ".moly");
|
|
158
|
+
const searchPaths = [
|
|
159
|
+
() => createRequire(import.meta.url)("@open-wallet-standard/core"),
|
|
160
|
+
() => createRequire(join(owsDir, "package.json"))("@open-wallet-standard/core"),
|
|
161
|
+
() => createRequire(join(homedir(), ".nvm", "versions", "node", process.version, "lib", "node_modules", "package.json"))("@open-wallet-standard/core")
|
|
162
|
+
];
|
|
163
|
+
for (const loader of searchPaths) {
|
|
164
|
+
try {
|
|
165
|
+
owsSdk = loader();
|
|
166
|
+
break;
|
|
167
|
+
} catch {
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
if (!owsSdk) {
|
|
160
171
|
const s = spinner();
|
|
161
172
|
s.start("Installing @open-wallet-standard/core...");
|
|
162
173
|
try {
|
|
163
174
|
const { execSync } = await import("child_process");
|
|
164
|
-
const {
|
|
165
|
-
const { join } = await import("path");
|
|
166
|
-
const { mkdirSync, existsSync } = await import("fs");
|
|
167
|
-
const owsDir = join(homedir(), ".moly");
|
|
175
|
+
const { mkdirSync, existsSync, writeFileSync } = await import("fs");
|
|
168
176
|
if (!existsSync(owsDir)) mkdirSync(owsDir, { recursive: true });
|
|
169
177
|
if (!existsSync(join(owsDir, "package.json"))) {
|
|
170
|
-
|
|
178
|
+
writeFileSync(join(owsDir, "package.json"), '{"name":"moly-deps","private":true}');
|
|
171
179
|
}
|
|
172
180
|
execSync("npm install @open-wallet-standard/core", { stdio: "pipe", cwd: owsDir });
|
|
173
181
|
s.stop("OWS SDK installed.");
|
|
174
|
-
|
|
175
|
-
const owsRequire = cr(join(owsDir, "package.json"));
|
|
176
|
-
owsSdk = owsRequire("@open-wallet-standard/core");
|
|
177
|
-
wallets = owsSdk.listWallets();
|
|
182
|
+
owsSdk = createRequire(join(owsDir, "package.json"))("@open-wallet-standard/core");
|
|
178
183
|
} catch (installErr) {
|
|
179
184
|
s.stop("Auto-install failed: " + installErr.message);
|
|
180
185
|
note("Could not install OWS SDK automatically.\nFalling back to raw key storage.", "OWS not available");
|
|
181
186
|
}
|
|
182
187
|
}
|
|
188
|
+
if (owsSdk) {
|
|
189
|
+
try {
|
|
190
|
+
wallets = owsSdk.listWallets();
|
|
191
|
+
} catch {
|
|
192
|
+
}
|
|
193
|
+
}
|
|
183
194
|
if (owsSdk && wallets.length > 0) {
|
|
184
195
|
const walletName = check(
|
|
185
196
|
await select({
|
package/package.json
CHANGED