@moly-mcp/lido 1.1.4 → 1.1.5

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 CHANGED
@@ -21,7 +21,6 @@ import {
21
21
  isCancel,
22
22
  spinner
23
23
  } from "@clack/prompts";
24
- import { generatePrivateKey } from "viem/accounts";
25
24
  function bail(value) {
26
25
  cancel("Setup cancelled.");
27
26
  process.exit(0);
@@ -192,42 +191,80 @@ async function runWizard() {
192
191
  }
193
192
  }
194
193
  if (owsSdk && wallets.length > 0) {
195
- const walletName = check(
194
+ const evmAddr = (w) => w.accounts?.find((a) => a.chainId === "evm")?.address ?? "";
195
+ const walletAction = check(
196
196
  await select({
197
- message: "Which OWS wallet?",
198
- options: wallets.map((w) => ({
199
- value: w.name,
200
- label: `${w.name} (${w.address.slice(0, 8)}...)`
201
- }))
197
+ message: "OWS wallet?",
198
+ options: [
199
+ ...wallets.map((w) => ({
200
+ value: w.name,
201
+ label: `${w.name} (${evmAddr(w).slice(0, 10)}...)`
202
+ })),
203
+ { value: "__import__", label: "Import existing private key into new wallet" },
204
+ { value: "__create__", label: "Create new wallet" }
205
+ ]
202
206
  })
203
207
  );
204
- const passphrase = check(
205
- await password({
206
- message: "OWS passphrase:",
207
- mask: "*"
208
+ if (walletAction === "__import__" || walletAction === "__create__") {
209
+ const wName = check(
210
+ await text({ message: "Wallet name:", placeholder: "moly", initialValue: "moly" })
211
+ );
212
+ const pp = check(
213
+ await password({ message: "Passphrase (encrypts the vault):", mask: "*" })
214
+ );
215
+ try {
216
+ if (walletAction === "__import__") {
217
+ const pk = check(
218
+ await password({ message: "Private key (0x...):", mask: "*" })
219
+ );
220
+ owsSdk.importWalletPrivateKey(wName.trim() || "moly", pk.trim(), pp.trim() || void 0);
221
+ } else {
222
+ owsSdk.createWallet(wName.trim() || "moly", pp.trim() || void 0);
223
+ }
224
+ ows = { walletName: wName.trim() || "moly", passphrase: pp.trim() };
225
+ } catch (err) {
226
+ note("OWS operation failed: " + err.message + "\nFalling back to raw key.", "Fallback");
227
+ const pk = check(
228
+ await password({ message: "Private key (0x...):", mask: "*" })
229
+ );
230
+ privateKey = pk.trim() || null;
231
+ }
232
+ } else {
233
+ const passphrase = check(
234
+ await password({ message: "OWS passphrase:", mask: "*" })
235
+ );
236
+ ows = { walletName: walletAction, passphrase: passphrase.trim() };
237
+ }
238
+ } else if (owsSdk && wallets.length === 0) {
239
+ const walletAction = check(
240
+ await select({
241
+ message: "No wallets found. What would you like to do?",
242
+ options: [
243
+ { value: "import", label: "Import existing private key" },
244
+ { value: "create", label: "Generate new wallet" }
245
+ ]
208
246
  })
209
247
  );
210
- ows = { walletName, passphrase: passphrase.trim() };
211
- } else if (owsSdk && wallets.length === 0) {
212
- note("No OWS wallets found. Creating one for you...", "New OWS wallet");
213
248
  const walletName = check(
214
249
  await text({ message: "Wallet name:", placeholder: "moly", initialValue: "moly" })
215
250
  );
216
251
  const passphrase = check(
217
- await password({ message: "Set a passphrase (used to encrypt the key):", mask: "*" })
252
+ await password({ message: "Passphrase (encrypts the vault):", mask: "*" })
218
253
  );
219
- const s = spinner();
220
- s.start("Generating wallet...");
221
254
  try {
222
- const privateKey2 = generatePrivateKey();
223
- owsSdk.createWallet(walletName.trim() || "moly", passphrase.trim(), privateKey2);
224
- s.stop("Wallet created.");
255
+ if (walletAction === "import") {
256
+ const pk = check(
257
+ await password({ message: "Private key (0x...):", mask: "*" })
258
+ );
259
+ owsSdk.importWalletPrivateKey(walletName.trim() || "moly", pk.trim(), passphrase.trim() || void 0);
260
+ } else {
261
+ owsSdk.createWallet(walletName.trim() || "moly", passphrase.trim() || void 0);
262
+ }
225
263
  ows = { walletName: walletName.trim() || "moly", passphrase: passphrase.trim() };
226
264
  } catch (err) {
227
- s.stop("Auto-create failed: " + err.message);
228
- note("Falling back to raw private key storage.", "Fallback");
265
+ note("OWS operation failed: " + err.message + "\nFalling back to raw key.", "Fallback");
229
266
  const pk = check(
230
- await password({ message: "Enter or paste a private key (0x...) \u2014 or generate one:", mask: "*" })
267
+ await password({ message: "Private key (0x...):", mask: "*" })
231
268
  );
232
269
  privateKey = pk.trim() || null;
233
270
  }
@@ -312,7 +349,7 @@ async function main() {
312
349
  case "setup": {
313
350
  const { cfg, terminalMode } = await runWizard();
314
351
  if (terminalMode) {
315
- const { startChatSession } = await import("./session-52D3R73Y.js");
352
+ const { startChatSession } = await import("./session-T6P233LY.js");
316
353
  await startChatSession(cfg);
317
354
  } else {
318
355
  await startServer();
@@ -392,7 +429,7 @@ async function main() {
392
429
  console.log("No config. Run: moly setup");
393
430
  process.exit(1);
394
431
  }
395
- const { runDaemon } = await import("./daemon-XWJQH7IB.js");
432
+ const { runDaemon } = await import("./daemon-NJPRW5QY.js");
396
433
  await runDaemon();
397
434
  break;
398
435
  }
@@ -550,7 +587,7 @@ async function main() {
550
587
  console.log("No config. Run: moly setup");
551
588
  process.exit(1);
552
589
  }
553
- const { getTotalPosition } = await import("./position-WDLPRIE7.js");
590
+ const { getTotalPosition } = await import("./position-34UYMKRX.js");
554
591
  const address = args[1];
555
592
  const pos = await getTotalPosition(address);
556
593
  console.log(JSON.stringify(pos, null, 2));
@@ -561,14 +598,14 @@ async function main() {
561
598
  if (!configExists()) {
562
599
  const { cfg, terminalMode } = await runWizard();
563
600
  if (terminalMode) {
564
- const { startChatSession } = await import("./session-52D3R73Y.js");
601
+ const { startChatSession } = await import("./session-T6P233LY.js");
565
602
  await startChatSession(cfg);
566
603
  } else {
567
604
  await startServer();
568
605
  }
569
606
  } else {
570
607
  const cfg = loadConfig();
571
- const { startChatSession } = await import("./session-52D3R73Y.js");
608
+ const { startChatSession } = await import("./session-T6P233LY.js");
572
609
  await startChatSession(cfg);
573
610
  }
574
611
  break;
@@ -589,7 +626,7 @@ async function main() {
589
626
  if (!configExists()) {
590
627
  const { cfg, terminalMode } = await runWizard();
591
628
  if (terminalMode) {
592
- const { startChatSession } = await import("./session-52D3R73Y.js");
629
+ const { startChatSession } = await import("./session-T6P233LY.js");
593
630
  await startChatSession(cfg);
594
631
  } else {
595
632
  await startServer();
@@ -4,7 +4,7 @@ import {
4
4
  getBalance,
5
5
  getConversionRate,
6
6
  getRuntime
7
- } from "./chunk-XSQE6QAD.js";
7
+ } from "./chunk-Y3E5B4L2.js";
8
8
 
9
9
  // src/tools/bridge.ts
10
10
  import { formatEther, parseEther, parseAbi } from "viem";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  applySettingsUpdate,
4
4
  getRuntime
5
- } from "./chunk-XSQE6QAD.js";
5
+ } from "./chunk-Y3E5B4L2.js";
6
6
  import {
7
7
  loadConfig,
8
8
  redactedConfig
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  getRuntime
4
- } from "./chunk-XSQE6QAD.js";
4
+ } from "./chunk-Y3E5B4L2.js";
5
5
 
6
6
  // src/tools/unstake.ts
7
7
  import { parseEther, formatEther } from "viem";
@@ -76,18 +76,20 @@ function buildRuntime() {
76
76
  if (_resolvedAccount) return _resolvedAccount;
77
77
  if (config.ows) {
78
78
  let owsSdk;
79
- try {
80
- owsSdk = _require("@open-wallet-standard/core");
81
- } catch {
79
+ const loaders = [
80
+ () => _require("@open-wallet-standard/core"),
81
+ () => createRequire(join(homedir(), ".moly", "package.json"))("@open-wallet-standard/core"),
82
+ () => createRequire(join(homedir(), ".nvm", "versions", "node", process.version, "lib", "node_modules", "package.json"))("@open-wallet-standard/core")
83
+ ];
84
+ for (const loader of loaders) {
82
85
  try {
83
- const molyRequire = createRequire(join(homedir(), ".moly", "package.json"));
84
- owsSdk = molyRequire("@open-wallet-standard/core");
86
+ owsSdk = loader();
87
+ break;
85
88
  } catch {
86
- throw new Error("OWS SDK not installed. Run: moly setup and select OWS Wallet");
87
89
  }
88
90
  }
89
- const exported = owsSdk.exportWallet(config.ows.walletName, config.ows.passphrase);
90
- const keyHex = exported.secp256k1 ?? exported;
91
+ if (!owsSdk) throw new Error("OWS SDK not installed. Run: npm install -g @open-wallet-standard/core");
92
+ const keyHex = owsSdk.exportWallet(config.ows.walletName, config.ows.passphrase ?? void 0);
91
93
  const pk2 = keyHex.startsWith("0x") ? keyHex : "0x" + keyHex;
92
94
  _resolvedAccount = privateKeyToAccount(pk2);
93
95
  return _resolvedAccount;
@@ -3,7 +3,7 @@ import {
3
3
  getProposals,
4
4
  getWithdrawalRequests,
5
5
  getWithdrawalStatus
6
- } from "./chunk-D5JID4WC.js";
6
+ } from "./chunk-TZX6FGR2.js";
7
7
  import {
8
8
  loadAlerts,
9
9
  loadChannelConfig,
@@ -14,7 +14,7 @@ import {
14
14
  getConversionRate,
15
15
  getRewards,
16
16
  getRuntime
17
- } from "./chunk-XSQE6QAD.js";
17
+ } from "./chunk-Y3E5B4L2.js";
18
18
  import "./chunk-P6VFMSPM.js";
19
19
  import "./chunk-PDX44BCA.js";
20
20
 
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  getTotalPosition
4
- } from "./chunk-27PRUUR7.js";
5
- import "./chunk-XSQE6QAD.js";
4
+ } from "./chunk-KQV7TVTQ.js";
5
+ import "./chunk-Y3E5B4L2.js";
6
6
  import "./chunk-P6VFMSPM.js";
7
7
  import "./chunk-PDX44BCA.js";
8
8
  export {
@@ -3,7 +3,7 @@ import {
3
3
  getSettings,
4
4
  stakeEth,
5
5
  updateSettings
6
- } from "../chunk-A27W633R.js";
6
+ } from "../chunk-LEW3UC2K.js";
7
7
  import {
8
8
  castVote,
9
9
  claimWithdrawals,
@@ -12,7 +12,7 @@ import {
12
12
  getWithdrawalRequests,
13
13
  getWithdrawalStatus,
14
14
  requestWithdrawal
15
- } from "../chunk-D5JID4WC.js";
15
+ } from "../chunk-TZX6FGR2.js";
16
16
  import {
17
17
  configureAlertChannels,
18
18
  listAlerts,
@@ -26,14 +26,14 @@ import {
26
26
  getBridgeStatus,
27
27
  getL2Balance,
28
28
  getTotalPosition
29
- } from "../chunk-27PRUUR7.js";
29
+ } from "../chunk-KQV7TVTQ.js";
30
30
  import {
31
31
  getBalance,
32
32
  getConversionRate,
33
33
  getRewards,
34
34
  unwrapWsteth,
35
35
  wrapSteth
36
- } from "../chunk-XSQE6QAD.js";
36
+ } from "../chunk-Y3E5B4L2.js";
37
37
  import {
38
38
  loadConfig
39
39
  } from "../chunk-P6VFMSPM.js";
@@ -3,7 +3,7 @@ import {
3
3
  getSettings,
4
4
  stakeEth,
5
5
  updateSettings
6
- } from "./chunk-A27W633R.js";
6
+ } from "./chunk-LEW3UC2K.js";
7
7
  import {
8
8
  castVote,
9
9
  claimWithdrawals,
@@ -12,7 +12,7 @@ import {
12
12
  getWithdrawalRequests,
13
13
  getWithdrawalStatus,
14
14
  requestWithdrawal
15
- } from "./chunk-D5JID4WC.js";
15
+ } from "./chunk-TZX6FGR2.js";
16
16
  import {
17
17
  configureAlertChannels,
18
18
  listAlerts,
@@ -26,14 +26,14 @@ import {
26
26
  getBridgeStatus,
27
27
  getL2Balance,
28
28
  getTotalPosition
29
- } from "./chunk-27PRUUR7.js";
29
+ } from "./chunk-KQV7TVTQ.js";
30
30
  import {
31
31
  getBalance,
32
32
  getConversionRate,
33
33
  getRewards,
34
34
  unwrapWsteth,
35
35
  wrapSteth
36
- } from "./chunk-XSQE6QAD.js";
36
+ } from "./chunk-Y3E5B4L2.js";
37
37
  import "./chunk-P6VFMSPM.js";
38
38
  import {
39
39
  loadBounds,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moly-mcp/lido",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
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",