@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.
Files changed (2) hide show
  1. package/dist/bin.js +26 -15
  2. 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
- try {
155
- const { createRequire } = await import("module");
156
- const _req = createRequire(import.meta.url);
157
- owsSdk = _req("@open-wallet-standard/core");
158
- wallets = owsSdk.listWallets();
159
- } catch {
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 { homedir } = await import("os");
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
- execSync("npm init -y", { stdio: "pipe", cwd: owsDir });
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
- const { createRequire: cr } = await import("module");
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moly-mcp/lido",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "Lido MCP Server — stake, unstake, wrap, govern. Works with Claude Desktop, Cursor, Windsurf, and any MCP client.",
5
5
  "license": "MIT",
6
6
  "type": "module",