@moly-mcp/lido 1.1.3 → 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 +92 -44
- package/dist/{chunk-27PRUUR7.js → chunk-KQV7TVTQ.js} +1 -1
- package/dist/{chunk-A27W633R.js → chunk-LEW3UC2K.js} +1 -1
- package/dist/{chunk-D5JID4WC.js → chunk-TZX6FGR2.js} +1 -1
- package/dist/{chunk-XSQE6QAD.js → chunk-Y3E5B4L2.js} +10 -8
- package/dist/{daemon-XWJQH7IB.js → daemon-NJPRW5QY.js} +2 -2
- package/dist/{position-WDLPRIE7.js → position-34UYMKRX.js} +2 -2
- package/dist/server/index.js +4 -4
- package/dist/{session-52D3R73Y.js → session-T6P233LY.js} +4 -4
- package/package.json +1 -1
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);
|
|
@@ -151,72 +150,121 @@ async function runWizard() {
|
|
|
151
150
|
if (keySource === "ows") {
|
|
152
151
|
let owsSdk = null;
|
|
153
152
|
let wallets = [];
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
153
|
+
const { createRequire } = await import("module");
|
|
154
|
+
const { homedir } = await import("os");
|
|
155
|
+
const { join } = await import("path");
|
|
156
|
+
const owsDir = join(homedir(), ".moly");
|
|
157
|
+
const searchPaths = [
|
|
158
|
+
() => createRequire(import.meta.url)("@open-wallet-standard/core"),
|
|
159
|
+
() => createRequire(join(owsDir, "package.json"))("@open-wallet-standard/core"),
|
|
160
|
+
() => createRequire(join(homedir(), ".nvm", "versions", "node", process.version, "lib", "node_modules", "package.json"))("@open-wallet-standard/core")
|
|
161
|
+
];
|
|
162
|
+
for (const loader of searchPaths) {
|
|
163
|
+
try {
|
|
164
|
+
owsSdk = loader();
|
|
165
|
+
break;
|
|
166
|
+
} catch {
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (!owsSdk) {
|
|
160
170
|
const s = spinner();
|
|
161
171
|
s.start("Installing @open-wallet-standard/core...");
|
|
162
172
|
try {
|
|
163
173
|
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");
|
|
174
|
+
const { mkdirSync, existsSync, writeFileSync } = await import("fs");
|
|
168
175
|
if (!existsSync(owsDir)) mkdirSync(owsDir, { recursive: true });
|
|
169
176
|
if (!existsSync(join(owsDir, "package.json"))) {
|
|
170
|
-
|
|
177
|
+
writeFileSync(join(owsDir, "package.json"), '{"name":"moly-deps","private":true}');
|
|
171
178
|
}
|
|
172
179
|
execSync("npm install @open-wallet-standard/core", { stdio: "pipe", cwd: owsDir });
|
|
173
180
|
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();
|
|
181
|
+
owsSdk = createRequire(join(owsDir, "package.json"))("@open-wallet-standard/core");
|
|
178
182
|
} catch (installErr) {
|
|
179
183
|
s.stop("Auto-install failed: " + installErr.message);
|
|
180
184
|
note("Could not install OWS SDK automatically.\nFalling back to raw key storage.", "OWS not available");
|
|
181
185
|
}
|
|
182
186
|
}
|
|
187
|
+
if (owsSdk) {
|
|
188
|
+
try {
|
|
189
|
+
wallets = owsSdk.listWallets();
|
|
190
|
+
} catch {
|
|
191
|
+
}
|
|
192
|
+
}
|
|
183
193
|
if (owsSdk && wallets.length > 0) {
|
|
184
|
-
const
|
|
194
|
+
const evmAddr = (w) => w.accounts?.find((a) => a.chainId === "evm")?.address ?? "";
|
|
195
|
+
const walletAction = check(
|
|
185
196
|
await select({
|
|
186
|
-
message: "
|
|
187
|
-
options:
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
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
|
+
]
|
|
191
206
|
})
|
|
192
207
|
);
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
message: "
|
|
196
|
-
|
|
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
|
+
]
|
|
197
246
|
})
|
|
198
247
|
);
|
|
199
|
-
ows = { walletName, passphrase: passphrase.trim() };
|
|
200
|
-
} else if (owsSdk && wallets.length === 0) {
|
|
201
|
-
note("No OWS wallets found. Creating one for you...", "New OWS wallet");
|
|
202
248
|
const walletName = check(
|
|
203
249
|
await text({ message: "Wallet name:", placeholder: "moly", initialValue: "moly" })
|
|
204
250
|
);
|
|
205
251
|
const passphrase = check(
|
|
206
|
-
await password({ message: "
|
|
252
|
+
await password({ message: "Passphrase (encrypts the vault):", mask: "*" })
|
|
207
253
|
);
|
|
208
|
-
const s = spinner();
|
|
209
|
-
s.start("Generating wallet...");
|
|
210
254
|
try {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
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
|
+
}
|
|
214
263
|
ows = { walletName: walletName.trim() || "moly", passphrase: passphrase.trim() };
|
|
215
264
|
} catch (err) {
|
|
216
|
-
|
|
217
|
-
note("Falling back to raw private key storage.", "Fallback");
|
|
265
|
+
note("OWS operation failed: " + err.message + "\nFalling back to raw key.", "Fallback");
|
|
218
266
|
const pk = check(
|
|
219
|
-
await password({ message: "
|
|
267
|
+
await password({ message: "Private key (0x...):", mask: "*" })
|
|
220
268
|
);
|
|
221
269
|
privateKey = pk.trim() || null;
|
|
222
270
|
}
|
|
@@ -301,7 +349,7 @@ async function main() {
|
|
|
301
349
|
case "setup": {
|
|
302
350
|
const { cfg, terminalMode } = await runWizard();
|
|
303
351
|
if (terminalMode) {
|
|
304
|
-
const { startChatSession } = await import("./session-
|
|
352
|
+
const { startChatSession } = await import("./session-T6P233LY.js");
|
|
305
353
|
await startChatSession(cfg);
|
|
306
354
|
} else {
|
|
307
355
|
await startServer();
|
|
@@ -381,7 +429,7 @@ async function main() {
|
|
|
381
429
|
console.log("No config. Run: moly setup");
|
|
382
430
|
process.exit(1);
|
|
383
431
|
}
|
|
384
|
-
const { runDaemon } = await import("./daemon-
|
|
432
|
+
const { runDaemon } = await import("./daemon-NJPRW5QY.js");
|
|
385
433
|
await runDaemon();
|
|
386
434
|
break;
|
|
387
435
|
}
|
|
@@ -539,7 +587,7 @@ async function main() {
|
|
|
539
587
|
console.log("No config. Run: moly setup");
|
|
540
588
|
process.exit(1);
|
|
541
589
|
}
|
|
542
|
-
const { getTotalPosition } = await import("./position-
|
|
590
|
+
const { getTotalPosition } = await import("./position-34UYMKRX.js");
|
|
543
591
|
const address = args[1];
|
|
544
592
|
const pos = await getTotalPosition(address);
|
|
545
593
|
console.log(JSON.stringify(pos, null, 2));
|
|
@@ -550,14 +598,14 @@ async function main() {
|
|
|
550
598
|
if (!configExists()) {
|
|
551
599
|
const { cfg, terminalMode } = await runWizard();
|
|
552
600
|
if (terminalMode) {
|
|
553
|
-
const { startChatSession } = await import("./session-
|
|
601
|
+
const { startChatSession } = await import("./session-T6P233LY.js");
|
|
554
602
|
await startChatSession(cfg);
|
|
555
603
|
} else {
|
|
556
604
|
await startServer();
|
|
557
605
|
}
|
|
558
606
|
} else {
|
|
559
607
|
const cfg = loadConfig();
|
|
560
|
-
const { startChatSession } = await import("./session-
|
|
608
|
+
const { startChatSession } = await import("./session-T6P233LY.js");
|
|
561
609
|
await startChatSession(cfg);
|
|
562
610
|
}
|
|
563
611
|
break;
|
|
@@ -578,7 +626,7 @@ async function main() {
|
|
|
578
626
|
if (!configExists()) {
|
|
579
627
|
const { cfg, terminalMode } = await runWizard();
|
|
580
628
|
if (terminalMode) {
|
|
581
|
-
const { startChatSession } = await import("./session-
|
|
629
|
+
const { startChatSession } = await import("./session-T6P233LY.js");
|
|
582
630
|
await startChatSession(cfg);
|
|
583
631
|
} else {
|
|
584
632
|
await startServer();
|
|
@@ -76,18 +76,20 @@ function buildRuntime() {
|
|
|
76
76
|
if (_resolvedAccount) return _resolvedAccount;
|
|
77
77
|
if (config.ows) {
|
|
78
78
|
let owsSdk;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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
|
-
|
|
84
|
-
|
|
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
|
-
|
|
90
|
-
const keyHex =
|
|
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-
|
|
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-
|
|
17
|
+
} from "./chunk-Y3E5B4L2.js";
|
|
18
18
|
import "./chunk-P6VFMSPM.js";
|
|
19
19
|
import "./chunk-PDX44BCA.js";
|
|
20
20
|
|
package/dist/server/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
getSettings,
|
|
4
4
|
stakeEth,
|
|
5
5
|
updateSettings
|
|
6
|
-
} from "../chunk-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
36
|
+
} from "./chunk-Y3E5B4L2.js";
|
|
37
37
|
import "./chunk-P6VFMSPM.js";
|
|
38
38
|
import {
|
|
39
39
|
loadBounds,
|
package/package.json
CHANGED