@metamask-previews/wallet-cli 0.0.0-preview-4f4c98e → 0.0.0-preview-5b293ee50
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/CHANGELOG.md +1 -2
- package/dist/commands/daemon/call.cjs +79 -0
- package/dist/commands/daemon/call.cjs.map +1 -0
- package/dist/commands/daemon/{call.d.ts → call.d.cts} +2 -2
- package/dist/commands/daemon/call.d.cts.map +1 -0
- package/dist/commands/daemon/call.d.mts +14 -0
- package/dist/commands/daemon/call.d.mts.map +1 -0
- package/dist/commands/daemon/{call.js → call.mjs} +6 -6
- package/dist/commands/daemon/call.mjs.map +1 -0
- package/dist/commands/daemon/list.cjs +48 -0
- package/dist/commands/daemon/list.cjs.map +1 -0
- package/dist/commands/daemon/{list.d.ts → list.d.cts} +2 -2
- package/dist/commands/daemon/list.d.cts.map +1 -0
- package/dist/commands/daemon/list.d.mts +7 -0
- package/dist/commands/daemon/list.d.mts.map +1 -0
- package/dist/commands/daemon/{list.js → list.mjs} +6 -6
- package/dist/commands/daemon/list.mjs.map +1 -0
- package/dist/commands/daemon/purge.cjs +58 -0
- package/dist/commands/daemon/purge.cjs.map +1 -0
- package/dist/commands/daemon/{purge.d.ts → purge.d.cts} +2 -2
- package/dist/commands/daemon/purge.d.cts.map +1 -0
- package/dist/commands/daemon/purge.d.mts +10 -0
- package/dist/commands/daemon/purge.d.mts.map +1 -0
- package/dist/commands/daemon/{purge.js → purge.mjs} +7 -7
- package/dist/commands/daemon/purge.mjs.map +1 -0
- package/dist/commands/daemon/start.cjs +52 -0
- package/dist/commands/daemon/start.cjs.map +1 -0
- package/dist/commands/daemon/{start.d.ts → start.d.cts} +2 -2
- package/dist/commands/daemon/start.d.cts.map +1 -0
- package/dist/commands/daemon/start.d.mts +12 -0
- package/dist/commands/daemon/start.d.mts.map +1 -0
- package/dist/commands/daemon/{start.js → start.mjs} +4 -4
- package/dist/commands/daemon/start.mjs.map +1 -0
- package/dist/commands/daemon/status.cjs +59 -0
- package/dist/commands/daemon/status.cjs.map +1 -0
- package/dist/commands/daemon/{status.d.ts → status.d.cts} +2 -2
- package/dist/commands/daemon/status.d.cts.map +1 -0
- package/dist/commands/daemon/status.d.mts +7 -0
- package/dist/commands/daemon/status.d.mts.map +1 -0
- package/dist/commands/daemon/{status.js → status.mjs} +6 -6
- package/dist/commands/daemon/status.mjs.map +1 -0
- package/dist/commands/daemon/stop.cjs +26 -0
- package/dist/commands/daemon/stop.cjs.map +1 -0
- package/dist/commands/daemon/{stop.d.ts → stop.d.cts} +2 -2
- package/dist/commands/daemon/stop.d.cts.map +1 -0
- package/dist/commands/daemon/stop.d.mts +7 -0
- package/dist/commands/daemon/stop.d.mts.map +1 -0
- package/dist/commands/daemon/{stop.js → stop.mjs} +6 -6
- package/dist/commands/daemon/stop.mjs.map +1 -0
- package/dist/commands/wallet/send.cjs +332 -0
- package/dist/commands/wallet/send.cjs.map +1 -0
- package/dist/commands/wallet/{send.d.ts → send.d.cts} +3 -3
- package/dist/commands/wallet/send.d.cts.map +1 -0
- package/dist/commands/wallet/send.d.mts +42 -0
- package/dist/commands/wallet/send.d.mts.map +1 -0
- package/dist/commands/wallet/{send.js → send.mjs} +9 -9
- package/dist/commands/wallet/send.mjs.map +1 -0
- package/dist/commands/wallet/unlock.cjs +75 -0
- package/dist/commands/wallet/unlock.cjs.map +1 -0
- package/dist/commands/wallet/{unlock.d.ts → unlock.d.cts} +2 -2
- package/dist/commands/wallet/unlock.d.cts.map +1 -0
- package/dist/commands/wallet/unlock.d.mts +11 -0
- package/dist/commands/wallet/unlock.d.mts.map +1 -0
- package/dist/commands/wallet/{unlock.js → unlock.mjs} +7 -7
- package/dist/commands/wallet/unlock.mjs.map +1 -0
- package/dist/daemon/auto-approval.cjs +86 -0
- package/dist/daemon/auto-approval.cjs.map +1 -0
- package/dist/daemon/{auto-approval.d.ts → auto-approval.d.cts} +3 -3
- package/dist/daemon/auto-approval.d.cts.map +1 -0
- package/dist/daemon/auto-approval.d.mts +22 -0
- package/dist/daemon/auto-approval.d.mts.map +1 -0
- package/dist/daemon/{auto-approval.js → auto-approval.mjs} +1 -1
- package/dist/daemon/auto-approval.mjs.map +1 -0
- package/dist/daemon/daemon-client.cjs +149 -0
- package/dist/daemon/daemon-client.cjs.map +1 -0
- package/dist/daemon/{daemon-client.d.ts → daemon-client.d.cts} +2 -2
- package/dist/daemon/daemon-client.d.cts.map +1 -0
- package/dist/daemon/daemon-client.d.mts +84 -0
- package/dist/daemon/daemon-client.d.mts.map +1 -0
- package/dist/daemon/{daemon-client.js → daemon-client.mjs} +6 -6
- package/dist/daemon/daemon-client.mjs.map +1 -0
- package/dist/daemon/daemon-entry.cjs +278 -0
- package/dist/daemon/daemon-entry.cjs.map +1 -0
- package/dist/daemon/daemon-entry.d.cts +2 -0
- package/dist/daemon/daemon-entry.d.cts.map +1 -0
- package/dist/daemon/daemon-entry.d.mts +2 -0
- package/dist/daemon/daemon-entry.d.mts.map +1 -0
- package/dist/daemon/{daemon-entry.js → daemon-entry.mjs} +12 -12
- package/dist/daemon/daemon-entry.mjs.map +1 -0
- package/dist/daemon/daemon-spawn.cjs +138 -0
- package/dist/daemon/daemon-spawn.cjs.map +1 -0
- package/dist/daemon/{daemon-spawn.d.ts → daemon-spawn.d.cts} +2 -2
- package/dist/daemon/daemon-spawn.d.cts.map +1 -0
- package/dist/daemon/daemon-spawn.d.mts +28 -0
- package/dist/daemon/daemon-spawn.d.mts.map +1 -0
- package/dist/daemon/{daemon-spawn.js → daemon-spawn.mjs} +7 -7
- package/dist/daemon/daemon-spawn.mjs.map +1 -0
- package/dist/daemon/data-dir.cjs +23 -0
- package/dist/daemon/data-dir.cjs.map +1 -0
- package/dist/daemon/{data-dir.d.ts → data-dir.d.cts} +1 -1
- package/dist/daemon/data-dir.d.cts.map +1 -0
- package/dist/daemon/data-dir.d.mts +14 -0
- package/dist/daemon/data-dir.d.mts.map +1 -0
- package/dist/daemon/{data-dir.js → data-dir.mjs} +3 -3
- package/dist/daemon/data-dir.mjs.map +1 -0
- package/dist/daemon/paths.cjs +20 -0
- package/dist/daemon/paths.cjs.map +1 -0
- package/dist/daemon/{paths.d.ts → paths.d.cts} +2 -2
- package/dist/daemon/paths.d.cts.map +1 -0
- package/dist/daemon/paths.d.mts +9 -0
- package/dist/daemon/paths.d.mts.map +1 -0
- package/dist/daemon/{paths.js → paths.mjs} +2 -2
- package/dist/daemon/paths.mjs.map +1 -0
- package/dist/daemon/prompts.cjs +55 -0
- package/dist/daemon/prompts.cjs.map +1 -0
- package/dist/daemon/{prompts.d.ts → prompts.d.cts} +1 -1
- package/dist/daemon/prompts.d.cts.map +1 -0
- package/dist/daemon/prompts.d.mts +31 -0
- package/dist/daemon/prompts.d.mts.map +1 -0
- package/dist/daemon/{prompts.js → prompts.mjs} +4 -4
- package/dist/daemon/prompts.mjs.map +1 -0
- package/dist/daemon/rpc-socket-server.cjs +284 -0
- package/dist/daemon/rpc-socket-server.cjs.map +1 -0
- package/dist/daemon/{rpc-socket-server.d.ts → rpc-socket-server.d.cts} +2 -2
- package/dist/daemon/rpc-socket-server.d.cts.map +1 -0
- package/dist/daemon/rpc-socket-server.d.mts +44 -0
- package/dist/daemon/rpc-socket-server.d.mts.map +1 -0
- package/dist/daemon/{rpc-socket-server.js → rpc-socket-server.mjs} +7 -7
- package/dist/daemon/rpc-socket-server.mjs.map +1 -0
- package/dist/daemon/secrets.cjs +137 -0
- package/dist/daemon/secrets.cjs.map +1 -0
- package/dist/daemon/{secrets.d.ts → secrets.d.cts} +1 -1
- package/dist/daemon/secrets.d.cts.map +1 -0
- package/dist/daemon/secrets.d.mts +72 -0
- package/dist/daemon/secrets.d.mts.map +1 -0
- package/dist/daemon/{secrets.js → secrets.mjs} +3 -3
- package/dist/daemon/secrets.mjs.map +1 -0
- package/dist/daemon/send-transaction.cjs +147 -0
- package/dist/daemon/send-transaction.cjs.map +1 -0
- package/dist/daemon/{send-transaction.d.ts → send-transaction.d.cts} +9 -9
- package/dist/daemon/send-transaction.d.cts.map +1 -0
- package/dist/daemon/send-transaction.d.mts +102 -0
- package/dist/daemon/send-transaction.d.mts.map +1 -0
- package/dist/daemon/{send-transaction.js → send-transaction.mjs} +3 -3
- package/dist/daemon/send-transaction.mjs.map +1 -0
- package/dist/daemon/socket-line.cjs +93 -0
- package/dist/daemon/socket-line.cjs.map +1 -0
- package/dist/daemon/{socket-line.d.ts → socket-line.d.cts} +5 -2
- package/dist/daemon/socket-line.d.cts.map +1 -0
- package/dist/daemon/socket-line.d.mts +21 -0
- package/dist/daemon/socket-line.d.mts.map +1 -0
- package/dist/daemon/{socket-line.js → socket-line.mjs} +1 -1
- package/dist/daemon/socket-line.mjs.map +1 -0
- package/dist/daemon/stop-daemon.cjs +117 -0
- package/dist/daemon/stop-daemon.cjs.map +1 -0
- package/dist/daemon/{stop-daemon.d.ts → stop-daemon.d.cts} +1 -1
- package/dist/daemon/stop-daemon.d.cts.map +1 -0
- package/dist/daemon/stop-daemon.d.mts +28 -0
- package/dist/daemon/stop-daemon.d.mts.map +1 -0
- package/dist/daemon/{stop-daemon.js → stop-daemon.mjs} +4 -4
- package/dist/daemon/stop-daemon.mjs.map +1 -0
- package/dist/daemon/types.cjs +20 -0
- package/dist/daemon/types.cjs.map +1 -0
- package/dist/daemon/{types.d.ts → types.d.cts} +4 -4
- package/dist/daemon/types.d.cts.map +1 -0
- package/dist/daemon/types.d.mts +94 -0
- package/dist/daemon/types.d.mts.map +1 -0
- package/dist/daemon/{types.js → types.mjs} +1 -1
- package/dist/daemon/types.mjs.map +1 -0
- package/dist/daemon/utils.cjs +172 -0
- package/dist/daemon/utils.cjs.map +1 -0
- package/dist/daemon/{utils.d.ts → utils.d.cts} +3 -2
- package/dist/daemon/utils.d.cts.map +1 -0
- package/dist/daemon/utils.d.mts +87 -0
- package/dist/daemon/utils.d.mts.map +1 -0
- package/dist/daemon/{utils.js → utils.mjs} +3 -3
- package/dist/daemon/utils.mjs.map +1 -0
- package/dist/daemon/wallet-factory.cjs +341 -0
- package/dist/daemon/wallet-factory.cjs.map +1 -0
- package/dist/daemon/{wallet-factory.d.ts → wallet-factory.d.cts} +4 -4
- package/dist/daemon/wallet-factory.d.cts.map +1 -0
- package/dist/daemon/wallet-factory.d.mts +64 -0
- package/dist/daemon/wallet-factory.d.mts.map +1 -0
- package/dist/daemon/{wallet-factory.js → wallet-factory.mjs} +11 -11
- package/dist/daemon/wallet-factory.mjs.map +1 -0
- package/dist/persistence/KeyValueStore.cjs +79 -0
- package/dist/persistence/KeyValueStore.cjs.map +1 -0
- package/dist/persistence/{KeyValueStore.d.ts → KeyValueStore.d.cts} +2 -2
- package/dist/persistence/KeyValueStore.d.cts.map +1 -0
- package/dist/persistence/KeyValueStore.d.mts +18 -0
- package/dist/persistence/KeyValueStore.d.mts.map +1 -0
- package/dist/persistence/{KeyValueStore.js → KeyValueStore.mjs} +9 -2
- package/dist/persistence/KeyValueStore.mjs.map +1 -0
- package/dist/persistence/persistence.cjs +204 -0
- package/dist/persistence/persistence.cjs.map +1 -0
- package/dist/persistence/{persistence.d.ts → persistence.d.cts} +5 -5
- package/dist/persistence/persistence.d.cts.map +1 -0
- package/dist/persistence/persistence.d.mts +45 -0
- package/dist/persistence/persistence.d.mts.map +1 -0
- package/dist/persistence/{persistence.js → persistence.mjs} +2 -2
- package/dist/persistence/persistence.mjs.map +1 -0
- package/dist/test/run-command.cjs +73 -0
- package/dist/test/run-command.cjs.map +1 -0
- package/dist/test/{run-command.d.ts → run-command.d.cts} +4 -4
- package/dist/test/run-command.d.cts.map +1 -0
- package/dist/test/run-command.d.mts +27 -0
- package/dist/test/run-command.d.mts.map +1 -0
- package/dist/test/{run-command.js → run-command.mjs} +3 -3
- package/dist/test/run-command.mjs.map +1 -0
- package/package.json +8 -12
- package/dist/commands/daemon/call.d.ts.map +0 -1
- package/dist/commands/daemon/call.js.map +0 -1
- package/dist/commands/daemon/list.d.ts.map +0 -1
- package/dist/commands/daemon/list.js.map +0 -1
- package/dist/commands/daemon/purge.d.ts.map +0 -1
- package/dist/commands/daemon/purge.js.map +0 -1
- package/dist/commands/daemon/start.d.ts.map +0 -1
- package/dist/commands/daemon/start.js.map +0 -1
- package/dist/commands/daemon/status.d.ts.map +0 -1
- package/dist/commands/daemon/status.js.map +0 -1
- package/dist/commands/daemon/stop.d.ts.map +0 -1
- package/dist/commands/daemon/stop.js.map +0 -1
- package/dist/commands/wallet/send.d.ts.map +0 -1
- package/dist/commands/wallet/send.js.map +0 -1
- package/dist/commands/wallet/unlock.d.ts.map +0 -1
- package/dist/commands/wallet/unlock.js.map +0 -1
- package/dist/daemon/auto-approval.d.ts.map +0 -1
- package/dist/daemon/auto-approval.js.map +0 -1
- package/dist/daemon/daemon-client.d.ts.map +0 -1
- package/dist/daemon/daemon-client.js.map +0 -1
- package/dist/daemon/daemon-entry.d.ts +0 -2
- package/dist/daemon/daemon-entry.d.ts.map +0 -1
- package/dist/daemon/daemon-entry.js.map +0 -1
- package/dist/daemon/daemon-spawn.d.ts.map +0 -1
- package/dist/daemon/daemon-spawn.js.map +0 -1
- package/dist/daemon/data-dir.d.ts.map +0 -1
- package/dist/daemon/data-dir.js.map +0 -1
- package/dist/daemon/paths.d.ts.map +0 -1
- package/dist/daemon/paths.js.map +0 -1
- package/dist/daemon/prompts.d.ts.map +0 -1
- package/dist/daemon/prompts.js.map +0 -1
- package/dist/daemon/rpc-socket-server.d.ts.map +0 -1
- package/dist/daemon/rpc-socket-server.js.map +0 -1
- package/dist/daemon/secrets.d.ts.map +0 -1
- package/dist/daemon/secrets.js.map +0 -1
- package/dist/daemon/send-transaction.d.ts.map +0 -1
- package/dist/daemon/send-transaction.js.map +0 -1
- package/dist/daemon/socket-line.d.ts.map +0 -1
- package/dist/daemon/socket-line.js.map +0 -1
- package/dist/daemon/stop-daemon.d.ts.map +0 -1
- package/dist/daemon/stop-daemon.js.map +0 -1
- package/dist/daemon/types.d.ts.map +0 -1
- package/dist/daemon/types.js.map +0 -1
- package/dist/daemon/utils.d.ts.map +0 -1
- package/dist/daemon/utils.js.map +0 -1
- package/dist/daemon/wallet-factory.d.ts.map +0 -1
- package/dist/daemon/wallet-factory.js.map +0 -1
- package/dist/persistence/KeyValueStore.d.ts.map +0 -1
- package/dist/persistence/KeyValueStore.js.map +0 -1
- package/dist/persistence/persistence.d.ts.map +0 -1
- package/dist/persistence/persistence.js.map +0 -1
- package/dist/test/run-command.d.ts.map +0 -1
- package/dist/test/run-command.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -27,7 +27,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
27
27
|
|
|
28
28
|
### Changed
|
|
29
29
|
|
|
30
|
-
- **BREAKING:** Bump minimum Node.js version to 22 ([#9168](https://github.com/MetaMask/core/pull/9168))
|
|
31
30
|
- The daemon client (`sendCommand`) now retries only on `ECONNREFUSED`, not `ECONNRESET`, since a reset can drop after the daemon has already acted on a request — re-sending could execute a non-idempotent action (e.g. a transaction broadcast) twice ([#9608](https://github.com/MetaMask/core/pull/9608))
|
|
32
31
|
- `--password` / `MM_WALLET_PASSWORD` is now optional on `mm daemon start`; on subsequent runs, omitting it starts the daemon with a locked keyring, and the persisted vault is auto-unlocked when a password is supplied ([#8821](https://github.com/MetaMask/core/pull/8821))
|
|
33
32
|
- The daemon RPC server now validates `params` against each handler's superstruct before dispatch, returning a `-32602 invalidParams` error on mismatch instead of passing raw params to the handler ([#8846](https://github.com/MetaMask/core/pull/8846))
|
|
@@ -35,7 +34,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
35
34
|
- Bump `@metamask/wallet` from `^3.0.0` to `^12.0.2` ([#9218](https://github.com/MetaMask/core/pull/9218), [#9263](https://github.com/MetaMask/core/pull/9263), [#9349](https://github.com/MetaMask/core/pull/9349), [#9396](https://github.com/MetaMask/core/pull/9396), [#9470](https://github.com/MetaMask/core/pull/9470), [#9609](https://github.com/MetaMask/core/pull/9609), [#9629](https://github.com/MetaMask/core/pull/9629), [#9735](https://github.com/MetaMask/core/pull/9735), [#9809](https://github.com/MetaMask/core/pull/9809), [#9903](https://github.com/MetaMask/core/pull/9903), [#9938](https://github.com/MetaMask/core/pull/9938), [#9945](https://github.com/MetaMask/core/pull/9945), [#9969](https://github.com/MetaMask/core/pull/9969))
|
|
36
35
|
- Wrap daemon password and SRP in opaque `Password` and `Srp` types that redact on logging; validated and unwrapped only at trust boundaries ([#8863](https://github.com/MetaMask/core/pull/8863))
|
|
37
36
|
- Bump `@metamask/analytics-controller` from `^1.2.1` to `^2.0.0` ([#9735](https://github.com/MetaMask/core/pull/9735))
|
|
38
|
-
- Bump `@metamask/remote-feature-flag-controller` from `^4.2.2` to `^6.
|
|
37
|
+
- Bump `@metamask/remote-feature-flag-controller` from `^4.2.2` to `^6.0.0` ([#9735](https://github.com/MetaMask/core/pull/9735), [#9945](https://github.com/MetaMask/core/pull/9945))
|
|
39
38
|
- Bump `@metamask/superstruct` from `^3.1.0` to `^3.4.1` ([#9754](https://github.com/MetaMask/core/pull/9754))
|
|
40
39
|
- Bump `@metamask/config-registry-controller` from `^3.0.0` to `^3.1.0` ([#9969](https://github.com/MetaMask/core/pull/9969))
|
|
41
40
|
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("@metamask/utils");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const daemon_client_js_1 = require("../../daemon/daemon-client.cjs");
|
|
6
|
+
const paths_js_1 = require("../../daemon/paths.cjs");
|
|
7
|
+
const utils_js_1 = require("../../daemon/utils.cjs");
|
|
8
|
+
class DaemonCall extends core_1.Command {
|
|
9
|
+
async run() {
|
|
10
|
+
const { args, flags } = await this.parse(DaemonCall);
|
|
11
|
+
const { action } = args;
|
|
12
|
+
const timeoutMs = flags.timeout;
|
|
13
|
+
// The daemon's `call` RPC expects `[action, ...args]`. `JSON.parse` returns
|
|
14
|
+
// `unknown`, but anything it produces is structurally `Json`, so we cast to
|
|
15
|
+
// `Json[]` once we've confirmed the parsed payload is an array.
|
|
16
|
+
const rpcParams = [action];
|
|
17
|
+
if (args.params !== undefined) {
|
|
18
|
+
let parsed;
|
|
19
|
+
try {
|
|
20
|
+
parsed = JSON.parse(args.params);
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
this.error('params must be valid JSON');
|
|
24
|
+
}
|
|
25
|
+
if (!Array.isArray(parsed)) {
|
|
26
|
+
this.error('params must be a JSON array');
|
|
27
|
+
}
|
|
28
|
+
rpcParams.push(...parsed);
|
|
29
|
+
}
|
|
30
|
+
const { socketPath } = (0, paths_js_1.getDaemonPaths)(this.config.dataDir);
|
|
31
|
+
let response;
|
|
32
|
+
try {
|
|
33
|
+
response = await (0, daemon_client_js_1.sendCommand)({
|
|
34
|
+
socketPath,
|
|
35
|
+
method: 'call',
|
|
36
|
+
params: rpcParams,
|
|
37
|
+
...(timeoutMs === undefined ? {} : { timeoutMs }),
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
this.error((0, utils_js_1.makeDaemonConnectionError)(error));
|
|
42
|
+
}
|
|
43
|
+
if ((0, utils_1.isJsonRpcFailure)(response)) {
|
|
44
|
+
this.error((0, utils_js_1.formatJsonRpcError)(response.error));
|
|
45
|
+
}
|
|
46
|
+
const isTTY = process.stdout.isTTY ?? false;
|
|
47
|
+
if (isTTY) {
|
|
48
|
+
this.log(JSON.stringify(response.result, null, 2));
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
process.stdout.write(`${JSON.stringify(response.result)}\n`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
DaemonCall.description = 'Call a messenger action on the wallet daemon';
|
|
56
|
+
DaemonCall.examples = [
|
|
57
|
+
'<%= config.bin %> daemon call KeyringController:getState',
|
|
58
|
+
'<%= config.bin %> daemon call NetworkController:getState',
|
|
59
|
+
'<%= config.bin %> daemon call ApprovalController:getState --timeout 10000',
|
|
60
|
+
];
|
|
61
|
+
DaemonCall.args = {
|
|
62
|
+
action: core_1.Args.string({
|
|
63
|
+
description: 'The messenger action name (e.g. KeyringController:getState)',
|
|
64
|
+
required: true,
|
|
65
|
+
}),
|
|
66
|
+
params: core_1.Args.string({
|
|
67
|
+
description: 'JSON-encoded arguments array (e.g. \'["arg1", "arg2"]\')',
|
|
68
|
+
required: false,
|
|
69
|
+
}),
|
|
70
|
+
};
|
|
71
|
+
DaemonCall.flags = {
|
|
72
|
+
timeout: core_1.Flags.integer({
|
|
73
|
+
char: 't',
|
|
74
|
+
description: 'Response timeout in milliseconds',
|
|
75
|
+
required: false,
|
|
76
|
+
}),
|
|
77
|
+
};
|
|
78
|
+
exports.default = DaemonCall;
|
|
79
|
+
//# sourceMappingURL=call.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call.cjs","sourceRoot":"","sources":["../../../src/commands/daemon/call.ts"],"names":[],"mappings":";;AACA,2CAAmD;AACnD,sCAAmD;AAEnD,qEAA4D;AAC5D,qDAAuD;AACvD,qDAG+B;AAE/B,MAAqB,UAAW,SAAQ,cAAO;IA6BtC,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QACrD,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QACxB,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC;QAEhC,4EAA4E;QAC5E,4EAA4E;QAC5E,gEAAgE;QAChE,MAAM,SAAS,GAAW,CAAC,MAAM,CAAC,CAAC;QACnC,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAC9B,IAAI,MAAe,CAAC;YACpB,IAAI,CAAC;gBACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAA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,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;;AA5Ee,sBAAW,GAAG,8CAA8C,CAAC;AAE7D,mBAAQ,GAAG;IACzB,0DAA0D;IAC1D,0DAA0D;IAC1D,2EAA2E;CAC5E,CAAC;AAEc,eAAI,GAAG;IACrB,MAAM,EAAE,WAAI,CAAC,MAAM,CAAC;QAClB,WAAW,EACT,6DAA6D;QAC/D,QAAQ,EAAE,IAAI;KACf,CAAC;IACF,MAAM,EAAE,WAAI,CAAC,MAAM,CAAC;QAClB,WAAW,EAAE,0DAA0D;QACvE,QAAQ,EAAE,KAAK;KAChB,CAAC;CACH,CAAC;AAEc,gBAAK,GAAG;IACtB,OAAO,EAAE,YAAK,CAAC,OAAO,CAAC;QACrB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,kCAAkC;QAC/C,QAAQ,EAAE,KAAK;KAChB,CAAC;CACH,CAAC;kBA3BiB,UAAU","sourcesContent":["import type { Json } from '@metamask/utils';\nimport { isJsonRpcFailure } from '@metamask/utils';\nimport { Args, Command, Flags } from '@oclif/core';\n\nimport { sendCommand } from '../../daemon/daemon-client.js';\nimport { getDaemonPaths } from '../../daemon/paths.js';\nimport {\n formatJsonRpcError,\n makeDaemonConnectionError,\n} from '../../daemon/utils.js';\n\nexport default class DaemonCall extends Command {\n static override description = 'Call a messenger action on the wallet daemon';\n\n static override examples = [\n '<%= config.bin %> daemon call KeyringController:getState',\n '<%= config.bin %> daemon call NetworkController:getState',\n '<%= config.bin %> daemon call ApprovalController:getState --timeout 10000',\n ];\n\n static override args = {\n action: Args.string({\n description:\n 'The messenger action name (e.g. KeyringController:getState)',\n required: true,\n }),\n params: Args.string({\n description: 'JSON-encoded arguments array (e.g. \\'[\"arg1\", \"arg2\"]\\')',\n required: false,\n }),\n };\n\n static override flags = {\n timeout: Flags.integer({\n char: 't',\n description: 'Response timeout in milliseconds',\n required: false,\n }),\n };\n\n public async run(): Promise<void> {\n const { args, flags } = await this.parse(DaemonCall);\n const { action } = args;\n const timeoutMs = flags.timeout;\n\n // The daemon's `call` RPC expects `[action, ...args]`. `JSON.parse` returns\n // `unknown`, but anything it produces is structurally `Json`, so we cast to\n // `Json[]` once we've confirmed the parsed payload is an array.\n const rpcParams: Json[] = [action];\n if (args.params !== undefined) {\n let parsed: unknown;\n try {\n parsed = JSON.parse(args.params);\n } catch {\n this.error('params must be valid JSON');\n }\n\n if (!Array.isArray(parsed)) {\n this.error('params must be a JSON array');\n }\n\n rpcParams.push(...(parsed as Json[]));\n }\n\n const { socketPath } = getDaemonPaths(this.config.dataDir);\n\n let response;\n try {\n response = await sendCommand({\n socketPath,\n method: 'call',\n params: rpcParams,\n ...(timeoutMs === undefined ? {} : { timeoutMs }),\n });\n } catch (error) {\n this.error(makeDaemonConnectionError(error));\n }\n\n if (isJsonRpcFailure(response)) {\n this.error(formatJsonRpcError(response.error));\n }\n\n const isTTY = process.stdout.isTTY ?? false;\n if (isTTY) {\n this.log(JSON.stringify(response.result, null, 2));\n } else {\n process.stdout.write(`${JSON.stringify(response.result)}\\n`);\n }\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Command } from
|
|
1
|
+
import { Command } from "@oclif/core";
|
|
2
2
|
export default class DaemonCall extends Command {
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
@@ -11,4 +11,4 @@ export default class DaemonCall extends Command {
|
|
|
11
11
|
};
|
|
12
12
|
run(): Promise<void>;
|
|
13
13
|
}
|
|
14
|
-
//# sourceMappingURL=call.d.
|
|
14
|
+
//# sourceMappingURL=call.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call.d.cts","sourceRoot":"","sources":["../../../src/commands/daemon/call.ts"],"names":[],"mappings":"AAEA,OAAO,EAAQ,OAAO,EAAS,oBAAoB;AASnD,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,OAAO;IAC7C,OAAgB,WAAW,SAAkD;IAE7E,OAAgB,QAAQ,WAItB;IAEF,OAAgB,IAAI;;;MAUlB;IAEF,OAAgB,KAAK;;MAMnB;IAEW,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAiDlC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Command } from "@oclif/core";
|
|
2
|
+
export default class DaemonCall extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static args: {
|
|
6
|
+
action: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
params: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
8
|
+
};
|
|
9
|
+
static flags: {
|
|
10
|
+
timeout: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
};
|
|
12
|
+
run(): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=call.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call.d.mts","sourceRoot":"","sources":["../../../src/commands/daemon/call.ts"],"names":[],"mappings":"AAEA,OAAO,EAAQ,OAAO,EAAS,oBAAoB;AASnD,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,OAAO;IAC7C,OAAgB,WAAW,SAAkD;IAE7E,OAAgB,QAAQ,WAItB;IAEF,OAAgB,IAAI;;;MAUlB;IAEF,OAAgB,KAAK;;MAMnB;IAEW,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAiDlC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { isJsonRpcFailure } from
|
|
2
|
-
import { Args, Command, Flags } from
|
|
3
|
-
import { sendCommand } from
|
|
4
|
-
import { getDaemonPaths } from
|
|
5
|
-
import { formatJsonRpcError, makeDaemonConnectionError
|
|
1
|
+
import { isJsonRpcFailure } from "@metamask/utils";
|
|
2
|
+
import { Args, Command, Flags } from "@oclif/core";
|
|
3
|
+
import { sendCommand } from "../../daemon/daemon-client.mjs";
|
|
4
|
+
import { getDaemonPaths } from "../../daemon/paths.mjs";
|
|
5
|
+
import { formatJsonRpcError, makeDaemonConnectionError } from "../../daemon/utils.mjs";
|
|
6
6
|
class DaemonCall extends Command {
|
|
7
7
|
async run() {
|
|
8
8
|
const { args, flags } = await this.parse(DaemonCall);
|
|
@@ -74,4 +74,4 @@ DaemonCall.flags = {
|
|
|
74
74
|
}),
|
|
75
75
|
};
|
|
76
76
|
export default DaemonCall;
|
|
77
|
-
//# sourceMappingURL=call.
|
|
77
|
+
//# sourceMappingURL=call.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call.mjs","sourceRoot":"","sources":["../../../src/commands/daemon/call.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,wBAAwB;AACnD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,oBAAoB;AAEnD,OAAO,EAAE,WAAW,EAAE,uCAAsC;AAC5D,OAAO,EAAE,cAAc,EAAE,+BAA8B;AACvD,OAAO,EACL,kBAAkB,EAClB,yBAAyB,EAC1B,+BAA8B;AAE/B,MAAqB,UAAW,SAAQ,OAAO;IA6BtC,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QACrD,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QACxB,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC;QAEhC,4EAA4E;QAC5E,4EAA4E;QAC5E,gEAAgE;QAChE,MAAM,SAAS,GAAW,CAAC,MAAM,CAAC,CAAC;QACnC,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAC9B,IAAI,MAAe,CAAC;YACpB,IAAI,CAAC;gBACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAA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AAI,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;;AA5Ee,sBAAW,GAAG,8CAA8C,CAAC;AAE7D,mBAAQ,GAAG;IACzB,0DAA0D;IAC1D,0DAA0D;IAC1D,2EAA2E;CAC5E,CAAC;AAEc,eAAI,GAAG;IACrB,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;QAClB,WAAW,EACT,6DAA6D;QAC/D,QAAQ,EAAE,IAAI;KACf,CAAC;IACF,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;QAClB,WAAW,EAAE,0DAA0D;QACvE,QAAQ,EAAE,KAAK;KAChB,CAAC;CACH,CAAC;AAEc,gBAAK,GAAG;IACtB,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC;QACrB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,kCAAkC;QAC/C,QAAQ,EAAE,KAAK;KAChB,CAAC;CACH,CAAC;eA3BiB,UAAU","sourcesContent":["import type { Json } from '@metamask/utils';\nimport { isJsonRpcFailure } from '@metamask/utils';\nimport { Args, Command, Flags } from '@oclif/core';\n\nimport { sendCommand } from '../../daemon/daemon-client.js';\nimport { getDaemonPaths } from '../../daemon/paths.js';\nimport {\n formatJsonRpcError,\n makeDaemonConnectionError,\n} from '../../daemon/utils.js';\n\nexport default class DaemonCall extends Command {\n static override description = 'Call a messenger action on the wallet daemon';\n\n static override examples = [\n '<%= config.bin %> daemon call KeyringController:getState',\n '<%= config.bin %> daemon call NetworkController:getState',\n '<%= config.bin %> daemon call ApprovalController:getState --timeout 10000',\n ];\n\n static override args = {\n action: Args.string({\n description:\n 'The messenger action name (e.g. KeyringController:getState)',\n required: true,\n }),\n params: Args.string({\n description: 'JSON-encoded arguments array (e.g. \\'[\"arg1\", \"arg2\"]\\')',\n required: false,\n }),\n };\n\n static override flags = {\n timeout: Flags.integer({\n char: 't',\n description: 'Response timeout in milliseconds',\n required: false,\n }),\n };\n\n public async run(): Promise<void> {\n const { args, flags } = await this.parse(DaemonCall);\n const { action } = args;\n const timeoutMs = flags.timeout;\n\n // The daemon's `call` RPC expects `[action, ...args]`. `JSON.parse` returns\n // `unknown`, but anything it produces is structurally `Json`, so we cast to\n // `Json[]` once we've confirmed the parsed payload is an array.\n const rpcParams: Json[] = [action];\n if (args.params !== undefined) {\n let parsed: unknown;\n try {\n parsed = JSON.parse(args.params);\n } catch {\n this.error('params must be valid JSON');\n }\n\n if (!Array.isArray(parsed)) {\n this.error('params must be a JSON array');\n }\n\n rpcParams.push(...(parsed as Json[]));\n }\n\n const { socketPath } = getDaemonPaths(this.config.dataDir);\n\n let response;\n try {\n response = await sendCommand({\n socketPath,\n method: 'call',\n params: rpcParams,\n ...(timeoutMs === undefined ? {} : { timeoutMs }),\n });\n } catch (error) {\n this.error(makeDaemonConnectionError(error));\n }\n\n if (isJsonRpcFailure(response)) {\n this.error(formatJsonRpcError(response.error));\n }\n\n const isTTY = process.stdout.isTTY ?? false;\n if (isTTY) {\n this.log(JSON.stringify(response.result, null, 2));\n } else {\n process.stdout.write(`${JSON.stringify(response.result)}\\n`);\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("@metamask/utils");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const daemon_client_js_1 = require("../../daemon/daemon-client.cjs");
|
|
6
|
+
const paths_js_1 = require("../../daemon/paths.cjs");
|
|
7
|
+
const utils_js_1 = require("../../daemon/utils.cjs");
|
|
8
|
+
class DaemonList extends core_1.Command {
|
|
9
|
+
async run() {
|
|
10
|
+
await this.parse(DaemonList);
|
|
11
|
+
const { socketPath } = (0, paths_js_1.getDaemonPaths)(this.config.dataDir);
|
|
12
|
+
let response;
|
|
13
|
+
try {
|
|
14
|
+
response = await (0, daemon_client_js_1.sendCommand)({ socketPath, method: 'listActions' });
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
this.error((0, utils_js_1.makeDaemonConnectionError)(error));
|
|
18
|
+
}
|
|
19
|
+
if ((0, utils_1.isJsonRpcFailure)(response)) {
|
|
20
|
+
this.error((0, utils_js_1.formatJsonRpcError)(response.error));
|
|
21
|
+
}
|
|
22
|
+
if (!(0, utils_js_1.isStringArray)(response.result)) {
|
|
23
|
+
this.error('Daemon returned an unexpected action list.');
|
|
24
|
+
}
|
|
25
|
+
const actions = [...response.result].sort();
|
|
26
|
+
const isTTY = process.stdout.isTTY ?? false;
|
|
27
|
+
if (!isTTY) {
|
|
28
|
+
// Bare output so it pipes cleanly into `grep`/`fzf`.
|
|
29
|
+
if (actions.length > 0) {
|
|
30
|
+
process.stdout.write(`${actions.join('\n')}\n`);
|
|
31
|
+
}
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (actions.length === 0) {
|
|
35
|
+
this.log('The daemon has no callable actions registered.');
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
this.log(`${actions.length} callable action${actions.length === 1 ? '' : 's'} ` +
|
|
39
|
+
'(dispatch with `mm daemon call <action>`):');
|
|
40
|
+
for (const action of actions) {
|
|
41
|
+
this.log(` ${action}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
DaemonList.description = 'List the messenger actions the running daemon can dispatch via `daemon call`';
|
|
46
|
+
DaemonList.examples = ['<%= config.bin %> daemon list'];
|
|
47
|
+
exports.default = DaemonList;
|
|
48
|
+
//# sourceMappingURL=list.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.cjs","sourceRoot":"","sources":["../../../src/commands/daemon/list.ts"],"names":[],"mappings":";;AAAA,2CAAmD;AACnD,sCAAsC;AAEtC,qEAA4D;AAC5D,qDAAuD;AACvD,qDAI+B;AAE/B,MAAqB,UAAW,SAAQ,cAAO;IAMtC,KAAK,CAAC,GAAG;QACd,MAAM,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QAED,IAAI,CAAC,GAAG,CACN,GAAG,OAAO,CAAC,MAAM,mBAAmB,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG;YACpE,4CAA4C,CAC/C,CAAC;QACF,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,IAAI,CAAC,GAAG,CAAC,KAAK,MAAM,EAAE,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;;AA/Ce,sBAAW,GACzB,8EAA8E,CAAC;AAEjE,mBAAQ,GAAG,CAAC,+BAA+B,CAAC,CAAC;kBAJ1C,UAAU","sourcesContent":["import { isJsonRpcFailure } from '@metamask/utils';\nimport { Command } from '@oclif/core';\n\nimport { sendCommand } from '../../daemon/daemon-client.js';\nimport { getDaemonPaths } from '../../daemon/paths.js';\nimport {\n formatJsonRpcError,\n isStringArray,\n makeDaemonConnectionError,\n} from '../../daemon/utils.js';\n\nexport default class DaemonList extends Command {\n static override description =\n 'List the messenger actions the running daemon can dispatch via `daemon call`';\n\n static override examples = ['<%= config.bin %> daemon list'];\n\n public async run(): Promise<void> {\n await this.parse(DaemonList);\n const { socketPath } = getDaemonPaths(this.config.dataDir);\n\n let response;\n try {\n response = await sendCommand({ socketPath, method: 'listActions' });\n } catch (error) {\n this.error(makeDaemonConnectionError(error));\n }\n\n if (isJsonRpcFailure(response)) {\n this.error(formatJsonRpcError(response.error));\n }\n\n if (!isStringArray(response.result)) {\n this.error('Daemon returned an unexpected action list.');\n }\n\n const actions = [...response.result].sort();\n\n const isTTY = process.stdout.isTTY ?? false;\n if (!isTTY) {\n // Bare output so it pipes cleanly into `grep`/`fzf`.\n if (actions.length > 0) {\n process.stdout.write(`${actions.join('\\n')}\\n`);\n }\n return;\n }\n\n if (actions.length === 0) {\n this.log('The daemon has no callable actions registered.');\n return;\n }\n\n this.log(\n `${actions.length} callable action${actions.length === 1 ? '' : 's'} ` +\n '(dispatch with `mm daemon call <action>`):',\n );\n for (const action of actions) {\n this.log(` ${action}`);\n }\n }\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Command } from
|
|
1
|
+
import { Command } from "@oclif/core";
|
|
2
2
|
export default class DaemonList extends Command {
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
5
5
|
run(): Promise<void>;
|
|
6
6
|
}
|
|
7
|
-
//# sourceMappingURL=list.d.
|
|
7
|
+
//# sourceMappingURL=list.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.cts","sourceRoot":"","sources":["../../../src/commands/daemon/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,oBAAoB;AAUtC,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,OAAO;IAC7C,OAAgB,WAAW,SACsD;IAEjF,OAAgB,QAAQ,WAAqC;IAEhD,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA2ClC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.mts","sourceRoot":"","sources":["../../../src/commands/daemon/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,oBAAoB;AAUtC,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,OAAO;IAC7C,OAAgB,WAAW,SACsD;IAEjF,OAAgB,QAAQ,WAAqC;IAEhD,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA2ClC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { isJsonRpcFailure } from
|
|
2
|
-
import { Command } from
|
|
3
|
-
import { sendCommand } from
|
|
4
|
-
import { getDaemonPaths } from
|
|
5
|
-
import { formatJsonRpcError, isStringArray, makeDaemonConnectionError
|
|
1
|
+
import { isJsonRpcFailure } from "@metamask/utils";
|
|
2
|
+
import { Command } from "@oclif/core";
|
|
3
|
+
import { sendCommand } from "../../daemon/daemon-client.mjs";
|
|
4
|
+
import { getDaemonPaths } from "../../daemon/paths.mjs";
|
|
5
|
+
import { formatJsonRpcError, isStringArray, makeDaemonConnectionError } from "../../daemon/utils.mjs";
|
|
6
6
|
class DaemonList extends Command {
|
|
7
7
|
async run() {
|
|
8
8
|
await this.parse(DaemonList);
|
|
@@ -43,4 +43,4 @@ class DaemonList extends Command {
|
|
|
43
43
|
DaemonList.description = 'List the messenger actions the running daemon can dispatch via `daemon call`';
|
|
44
44
|
DaemonList.examples = ['<%= config.bin %> daemon list'];
|
|
45
45
|
export default DaemonList;
|
|
46
|
-
//# sourceMappingURL=list.
|
|
46
|
+
//# sourceMappingURL=list.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.mjs","sourceRoot":"","sources":["../../../src/commands/daemon/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,wBAAwB;AACnD,OAAO,EAAE,OAAO,EAAE,oBAAoB;AAEtC,OAAO,EAAE,WAAW,EAAE,uCAAsC;AAC5D,OAAO,EAAE,cAAc,EAAE,+BAA8B;AACvD,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,yBAAyB,EAC1B,+BAA8B;AAE/B,MAAqB,UAAW,SAAQ,OAAO;IAMtC,KAAK,CAAC,GAAG;QACd,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC7B,MAAM,EAAE,UAAU,EAAE,GAAG,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAE3D,IAAI,QAAQ,CAAC;QACb,IAAI,CAAC;YACH,QAAQ,GAAG,MAAM,WAAW,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC;QACtE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC,CAAC;QAC/C,CAAC;QAED,IAAI,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC/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on/daemon-client.js';\nimport { getDaemonPaths } from '../../daemon/paths.js';\nimport {\n formatJsonRpcError,\n isStringArray,\n makeDaemonConnectionError,\n} from '../../daemon/utils.js';\n\nexport default class DaemonList extends Command {\n static override description =\n 'List the messenger actions the running daemon can dispatch via `daemon call`';\n\n static override examples = ['<%= config.bin %> daemon list'];\n\n public async run(): Promise<void> {\n await this.parse(DaemonList);\n const { socketPath } = getDaemonPaths(this.config.dataDir);\n\n let response;\n try {\n response = await sendCommand({ socketPath, method: 'listActions' });\n } catch (error) {\n this.error(makeDaemonConnectionError(error));\n }\n\n if (isJsonRpcFailure(response)) {\n this.error(formatJsonRpcError(response.error));\n }\n\n if (!isStringArray(response.result)) {\n this.error('Daemon returned an unexpected action list.');\n }\n\n const actions = [...response.result].sort();\n\n const isTTY = process.stdout.isTTY ?? false;\n if (!isTTY) {\n // Bare output so it pipes cleanly into `grep`/`fzf`.\n if (actions.length > 0) {\n process.stdout.write(`${actions.join('\\n')}\\n`);\n }\n return;\n }\n\n if (actions.length === 0) {\n this.log('The daemon has no callable actions registered.');\n return;\n }\n\n this.log(\n `${actions.length} callable action${actions.length === 1 ? '' : 's'} ` +\n '(dispatch with `mm daemon call <action>`):',\n );\n for (const action of actions) {\n this.log(` ${action}`);\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const promises_1 = require("node:fs/promises");
|
|
5
|
+
const daemon_client_js_1 = require("../../daemon/daemon-client.cjs");
|
|
6
|
+
const paths_js_1 = require("../../daemon/paths.cjs");
|
|
7
|
+
const prompts_js_1 = require("../../daemon/prompts.cjs");
|
|
8
|
+
const stop_daemon_js_1 = require("../../daemon/stop-daemon.cjs");
|
|
9
|
+
class DaemonPurge extends core_1.Command {
|
|
10
|
+
async run() {
|
|
11
|
+
const { flags } = await this.parse(DaemonPurge);
|
|
12
|
+
if (!flags.force) {
|
|
13
|
+
const confirmed = await (0, prompts_js_1.confirmPurge)();
|
|
14
|
+
if (!confirmed) {
|
|
15
|
+
this.log('Aborted.');
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
const paths = (0, paths_js_1.getDaemonPaths)(this.config.dataDir);
|
|
20
|
+
const stopped = await (0, stop_daemon_js_1.stopDaemon)(paths.socketPath, paths.pidPath, (message) => this.log(message));
|
|
21
|
+
if (!stopped) {
|
|
22
|
+
// Purge is the escape hatch for a daemon that wouldn't shut down cleanly,
|
|
23
|
+
// so proceed once we've confirmed it isn't responsive — deleting state
|
|
24
|
+
// out from under a live daemon would risk corrupting it.
|
|
25
|
+
const ping = await (0, daemon_client_js_1.pingDaemon)(paths.socketPath);
|
|
26
|
+
if (ping.status === 'responsive') {
|
|
27
|
+
this.error('Refusing to delete state while the daemon is still responsive.');
|
|
28
|
+
}
|
|
29
|
+
this.log('Could not confirm clean shutdown; proceeding to delete state anyway.');
|
|
30
|
+
}
|
|
31
|
+
// Whitelist only the daemon-owned files rather than rm'ing the entire
|
|
32
|
+
// oclif dataDir, which may hold unrelated state (caches, oclif lock
|
|
33
|
+
// files, future config). `force: true` makes ENOENT a no-op for any
|
|
34
|
+
// file already removed by stopDaemon.
|
|
35
|
+
await Promise.all([
|
|
36
|
+
paths.pidPath,
|
|
37
|
+
paths.socketPath,
|
|
38
|
+
paths.logPath,
|
|
39
|
+
paths.dbPath,
|
|
40
|
+
`${paths.dbPath}-wal`,
|
|
41
|
+
`${paths.dbPath}-shm`,
|
|
42
|
+
].map(async (path) => (0, promises_1.rm)(path, { force: true })));
|
|
43
|
+
this.log('All daemon state deleted.');
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
DaemonPurge.description = 'Stop the daemon and delete all daemon state files';
|
|
47
|
+
DaemonPurge.examples = [
|
|
48
|
+
'<%= config.bin %> daemon purge',
|
|
49
|
+
'<%= config.bin %> daemon purge --force',
|
|
50
|
+
];
|
|
51
|
+
DaemonPurge.flags = {
|
|
52
|
+
force: core_1.Flags.boolean({
|
|
53
|
+
char: 'f',
|
|
54
|
+
description: 'Skip confirmation prompt',
|
|
55
|
+
}),
|
|
56
|
+
};
|
|
57
|
+
exports.default = DaemonPurge;
|
|
58
|
+
//# sourceMappingURL=purge.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"purge.cjs","sourceRoot":"","sources":["../../../src/commands/daemon/purge.ts"],"names":[],"mappings":";;AAAA,sCAA6C;AAC7C,+CAAsC;AAEtC,qEAA2D;AAC3D,qDAAuD;AACvD,yDAAuD;AACvD,iEAAyD;AAEzD,MAAqB,WAAY,SAAQ,cAAO;IAgBvC,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAEhD,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YACjB,MAAM,SAAS,GAAG,MAAM,IAAA,yBAAY,GAAE,CAAC;YACvC,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;gBACrB,OAAO;YACT,CAAC;QACH,CAAC;QAED,MAAM,KAAK,GAAG,IAAA,yBAAc,EAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAElD,MAAM,OAAO,GAAG,MAAM,IAAA,2BAAU,EAC9B,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,OAAO,EACb,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAC/B,CAAC;QAEF,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,0EAA0E;YAC1E,uEAAuE;YACvE,yDAAyD;YACzD,MAAM,IAAI,GAAG,MAAM,IAAA,6BAAU,EAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YAChD,IAAI,IAAI,CAAC,MAAM,KAAK,YAAY,EAAE,CAAC;gBACjC,IAAI,CAAC,KAAK,CACR,gEAAgE,CACjE,CAAC;YACJ,CAAC;YACD,IAAI,CAAC,GAAG,CACN,sEAAsE,CACvE,CAAC;QACJ,CAAC;QAED,sEAAsE;QACtE,oEAAoE;QACpE,oEAAoE;QACpE,sCAAsC;QACtC,MAAM,OAAO,CAAC,GAAG,CACf;YACE,KAAK,CAAC,OAAO;YACb,KAAK,CAAC,UAAU;YAChB,KAAK,CAAC,OAAO;YACb,KAAK,CAAC,MAAM;YACZ,GAAG,KAAK,CAAC,MAAM,MAAM;YACrB,GAAG,KAAK,CAAC,MAAM,MAAM;SACtB,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,IAAA,aAAE,EAAC,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CACjD,CAAC;QAEF,IAAI,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;IACxC,CAAC;;AAjEe,uBAAW,GACzB,mDAAmD,CAAC;AAEtC,oBAAQ,GAAG;IACzB,gCAAgC;IAChC,wCAAwC;CACzC,CAAC;AAEc,iBAAK,GAAG;IACtB,KAAK,EAAE,YAAK,CAAC,OAAO,CAAC;QACnB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,0BAA0B;KACxC,CAAC;CACH,CAAC;kBAdiB,WAAW","sourcesContent":["import { Command, Flags } from '@oclif/core';\nimport { rm } from 'node:fs/promises';\n\nimport { pingDaemon } from '../../daemon/daemon-client.js';\nimport { getDaemonPaths } from '../../daemon/paths.js';\nimport { confirmPurge } from '../../daemon/prompts.js';\nimport { stopDaemon } from '../../daemon/stop-daemon.js';\n\nexport default class DaemonPurge extends Command {\n static override description =\n 'Stop the daemon and delete all daemon state files';\n\n static override examples = [\n '<%= config.bin %> daemon purge',\n '<%= config.bin %> daemon purge --force',\n ];\n\n static override flags = {\n force: Flags.boolean({\n char: 'f',\n description: 'Skip confirmation prompt',\n }),\n };\n\n public async run(): Promise<void> {\n const { flags } = await this.parse(DaemonPurge);\n\n if (!flags.force) {\n const confirmed = await confirmPurge();\n if (!confirmed) {\n this.log('Aborted.');\n return;\n }\n }\n\n const paths = getDaemonPaths(this.config.dataDir);\n\n const stopped = await stopDaemon(\n paths.socketPath,\n paths.pidPath,\n (message) => this.log(message),\n );\n\n if (!stopped) {\n // Purge is the escape hatch for a daemon that wouldn't shut down cleanly,\n // so proceed once we've confirmed it isn't responsive — deleting state\n // out from under a live daemon would risk corrupting it.\n const ping = await pingDaemon(paths.socketPath);\n if (ping.status === 'responsive') {\n this.error(\n 'Refusing to delete state while the daemon is still responsive.',\n );\n }\n this.log(\n 'Could not confirm clean shutdown; proceeding to delete state anyway.',\n );\n }\n\n // Whitelist only the daemon-owned files rather than rm'ing the entire\n // oclif dataDir, which may hold unrelated state (caches, oclif lock\n // files, future config). `force: true` makes ENOENT a no-op for any\n // file already removed by stopDaemon.\n await Promise.all(\n [\n paths.pidPath,\n paths.socketPath,\n paths.logPath,\n paths.dbPath,\n `${paths.dbPath}-wal`,\n `${paths.dbPath}-shm`,\n ].map(async (path) => rm(path, { force: true })),\n );\n\n this.log('All daemon state deleted.');\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Command } from
|
|
1
|
+
import { Command } from "@oclif/core";
|
|
2
2
|
export default class DaemonPurge extends Command {
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
@@ -7,4 +7,4 @@ export default class DaemonPurge extends Command {
|
|
|
7
7
|
};
|
|
8
8
|
run(): Promise<void>;
|
|
9
9
|
}
|
|
10
|
-
//# sourceMappingURL=purge.d.
|
|
10
|
+
//# sourceMappingURL=purge.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"purge.d.cts","sourceRoot":"","sources":["../../../src/commands/daemon/purge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAS,oBAAoB;AAQ7C,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,OAAO;IAC9C,OAAgB,WAAW,SAC2B;IAEtD,OAAgB,QAAQ,WAGtB;IAEF,OAAgB,KAAK;;MAKnB;IAEW,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAmDlC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from "@oclif/core";
|
|
2
|
+
export default class DaemonPurge extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
};
|
|
8
|
+
run(): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=purge.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"purge.d.mts","sourceRoot":"","sources":["../../../src/commands/daemon/purge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAS,oBAAoB;AAQ7C,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,OAAO;IAC9C,OAAgB,WAAW,SAC2B;IAEtD,OAAgB,QAAQ,WAGtB;IAEF,OAAgB,KAAK;;MAKnB;IAEW,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAmDlC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Command, Flags } from
|
|
2
|
-
import { rm } from
|
|
3
|
-
import { pingDaemon } from
|
|
4
|
-
import { getDaemonPaths } from
|
|
5
|
-
import { confirmPurge } from
|
|
6
|
-
import { stopDaemon } from
|
|
1
|
+
import { Command, Flags } from "@oclif/core";
|
|
2
|
+
import { rm } from "node:fs/promises";
|
|
3
|
+
import { pingDaemon } from "../../daemon/daemon-client.mjs";
|
|
4
|
+
import { getDaemonPaths } from "../../daemon/paths.mjs";
|
|
5
|
+
import { confirmPurge } from "../../daemon/prompts.mjs";
|
|
6
|
+
import { stopDaemon } from "../../daemon/stop-daemon.mjs";
|
|
7
7
|
class DaemonPurge extends Command {
|
|
8
8
|
async run() {
|
|
9
9
|
const { flags } = await this.parse(DaemonPurge);
|
|
@@ -53,4 +53,4 @@ DaemonPurge.flags = {
|
|
|
53
53
|
}),
|
|
54
54
|
};
|
|
55
55
|
export default DaemonPurge;
|
|
56
|
-
//# sourceMappingURL=purge.
|
|
56
|
+
//# sourceMappingURL=purge.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"purge.mjs","sourceRoot":"","sources":["../../../src/commands/daemon/purge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,oBAAoB;AAC7C,OAAO,EAAE,EAAE,EAAE,yBAAyB;AAEtC,OAAO,EAAE,UAAU,EAAE,uCAAsC;AAC3D,OAAO,EAAE,cAAc,EAAE,+BAA8B;AACvD,OAAO,EAAE,YAAY,EAAE,iCAAgC;AACvD,OAAO,EAAE,UAAU,EAAE,qCAAoC;AAEzD,MAAqB,WAAY,SAAQ,OAAO;IAgBvC,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAEhD,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YACjB,MAAM,SAAS,GAAG,MAAM,YAAY,EAAE,CAAC;YACvC,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;gBACrB,OAAO;YACT,CAAC;QACH,CAAC;QAED,MAAM,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAElD,MAAM,OAAO,GAAG,MAAM,UAAU,CAC9B,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,OAAO,EACb,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAC/B,CAAC;QAEF,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,0EAA0E;YAC1E,uEAAuE;YACvE,yDAAyD;YACzD,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YAChD,IAAI,IAAI,CAAC,MAAM,KAAK,YAAY,EAAE,CAAC;gBACjC,IAAI,CAAC,KAAK,CACR,gEAAgE,CACjE,CAAC;YACJ,CAAC;YACD,IAAI,CAAC,GAAG,CACN,sEAAsE,CACvE,CAAC;QACJ,CAAC;QAED,sEAAsE;QACtE,oEAAoE;QACpE,oEAAoE;QACpE,sCAAsC;QACtC,MAAM,OAAO,CAAC,GAAG,CACf;YACE,KAAK,CAAC,OAAO;YACb,KAAK,CAAC,UAAU;YAChB,KAAK,CAAC,OAAO;YACb,KAAK,CAAC,MAAM;YACZ,GAAG,KAAK,CAAC,MAAM,MAAM;YACrB,GAAG,KAAK,CAAC,MAAM,MAAM;SACtB,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CACjD,CAAC;QAEF,IAAI,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;IACxC,CAAC;;AAjEe,uBAAW,GACzB,mDAAmD,CAAC;AAEtC,oBAAQ,GAAG;IACzB,gCAAgC;IAChC,wCAAwC;CACzC,CAAC;AAEc,iBAAK,GAAG;IACtB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC;QACnB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,0BAA0B;KACxC,CAAC;CACH,CAAC;eAdiB,WAAW","sourcesContent":["import { Command, Flags } from '@oclif/core';\nimport { rm } from 'node:fs/promises';\n\nimport { pingDaemon } from '../../daemon/daemon-client.js';\nimport { getDaemonPaths } from '../../daemon/paths.js';\nimport { confirmPurge } from '../../daemon/prompts.js';\nimport { stopDaemon } from '../../daemon/stop-daemon.js';\n\nexport default class DaemonPurge extends Command {\n static override description =\n 'Stop the daemon and delete all daemon state files';\n\n static override examples = [\n '<%= config.bin %> daemon purge',\n '<%= config.bin %> daemon purge --force',\n ];\n\n static override flags = {\n force: Flags.boolean({\n char: 'f',\n description: 'Skip confirmation prompt',\n }),\n };\n\n public async run(): Promise<void> {\n const { flags } = await this.parse(DaemonPurge);\n\n if (!flags.force) {\n const confirmed = await confirmPurge();\n if (!confirmed) {\n this.log('Aborted.');\n return;\n }\n }\n\n const paths = getDaemonPaths(this.config.dataDir);\n\n const stopped = await stopDaemon(\n paths.socketPath,\n paths.pidPath,\n (message) => this.log(message),\n );\n\n if (!stopped) {\n // Purge is the escape hatch for a daemon that wouldn't shut down cleanly,\n // so proceed once we've confirmed it isn't responsive — deleting state\n // out from under a live daemon would risk corrupting it.\n const ping = await pingDaemon(paths.socketPath);\n if (ping.status === 'responsive') {\n this.error(\n 'Refusing to delete state while the daemon is still responsive.',\n );\n }\n this.log(\n 'Could not confirm clean shutdown; proceeding to delete state anyway.',\n );\n }\n\n // Whitelist only the daemon-owned files rather than rm'ing the entire\n // oclif dataDir, which may hold unrelated state (caches, oclif lock\n // files, future config). `force: true` makes ENOENT a no-op for any\n // file already removed by stopDaemon.\n await Promise.all(\n [\n paths.pidPath,\n paths.socketPath,\n paths.logPath,\n paths.dbPath,\n `${paths.dbPath}-wal`,\n `${paths.dbPath}-shm`,\n ].map(async (path) => rm(path, { force: true })),\n );\n\n this.log('All daemon state deleted.');\n }\n}\n"]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const daemon_spawn_js_1 = require("../../daemon/daemon-spawn.cjs");
|
|
5
|
+
const secrets_js_1 = require("../../daemon/secrets.cjs");
|
|
6
|
+
class DaemonStart extends core_1.Command {
|
|
7
|
+
async run() {
|
|
8
|
+
const { flags } = await this.parse(DaemonStart);
|
|
9
|
+
const infuraProjectId = flags['infura-project-id'];
|
|
10
|
+
const password = flags.password ? secrets_js_1.Password.from(flags.password) : undefined;
|
|
11
|
+
const srp = secrets_js_1.Srp.from(flags.srp);
|
|
12
|
+
const { state, socketPath } = await (0, daemon_spawn_js_1.ensureDaemon)({
|
|
13
|
+
dataDir: this.config.dataDir,
|
|
14
|
+
infuraProjectId,
|
|
15
|
+
password,
|
|
16
|
+
srp,
|
|
17
|
+
packageRoot: this.config.root,
|
|
18
|
+
});
|
|
19
|
+
if (state === 'already-running') {
|
|
20
|
+
this.log(`Daemon already running. Socket: ${socketPath}. ` +
|
|
21
|
+
`The provided flags were not applied; run \`mm daemon stop\` and start again to change them.`);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
this.log(`Daemon running. Socket: ${socketPath}`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
DaemonStart.description = 'Start the wallet daemon';
|
|
28
|
+
DaemonStart.examples = [
|
|
29
|
+
'<%= config.bin %> daemon start --infura-project-id <key> --password <pw> --srp <phrase>',
|
|
30
|
+
'INFURA_PROJECT_ID=<key> MM_WALLET_PASSWORD=<pw> MM_WALLET_SRP=<phrase> <%= config.bin %> daemon start',
|
|
31
|
+
'<%= config.bin %> daemon start --infura-project-id <key> --srp <phrase> # then `mm wallet unlock` later',
|
|
32
|
+
];
|
|
33
|
+
DaemonStart.flags = {
|
|
34
|
+
'infura-project-id': core_1.Flags.string({
|
|
35
|
+
description: 'Infura project ID for network access',
|
|
36
|
+
env: 'INFURA_PROJECT_ID',
|
|
37
|
+
required: true,
|
|
38
|
+
}),
|
|
39
|
+
password: core_1.Flags.string({
|
|
40
|
+
description: 'Wallet password (testing only — use MM_WALLET_PASSWORD env var in production). ' +
|
|
41
|
+
'Required on first run; on subsequent runs, omit (and leave MM_WALLET_PASSWORD unset) to start with a locked keyring and use `mm wallet unlock`.',
|
|
42
|
+
env: 'MM_WALLET_PASSWORD',
|
|
43
|
+
required: false,
|
|
44
|
+
}),
|
|
45
|
+
srp: core_1.Flags.string({
|
|
46
|
+
description: 'Secret recovery phrase (testing only — use MM_WALLET_SRP env var in production)',
|
|
47
|
+
env: 'MM_WALLET_SRP',
|
|
48
|
+
required: true,
|
|
49
|
+
}),
|
|
50
|
+
};
|
|
51
|
+
exports.default = DaemonStart;
|
|
52
|
+
//# sourceMappingURL=start.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start.cjs","sourceRoot":"","sources":["../../../src/commands/daemon/start.ts"],"names":[],"mappings":";;AAAA,sCAA6C;AAE7C,mEAA4D;AAC5D,yDAAwD;AAExD,MAAqB,WAAY,SAAQ,cAAO;IA8BvC,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAChD,MAAM,eAAe,GAAG,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACnD,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,qBAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC5E,MAAM,GAAG,GAAG,gBAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAEhC,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,MAAM,IAAA,8BAAY,EAAC;YAC/C,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO;YAC5B,eAAe;YACf,QAAQ;YACR,GAAG;YACH,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI;SAC9B,CAAC,CAAC;QAEH,IAAI,KAAK,KAAK,iBAAiB,EAAE,CAAC;YAChC,IAAI,CAAC,GAAG,CACN,mCAAmC,UAAU,IAAI;gBAC/C,6FAA6F,CAChG,CAAC;YACF,OAAO;QACT,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,2BAA2B,UAAU,EAAE,CAAC,CAAC;IACpD,CAAC;;AApDe,uBAAW,GAAG,yBAAyB,CAAC;AAExC,oBAAQ,GAAG;IACzB,yFAAyF;IACzF,uGAAuG;IACvG,2GAA2G;CAC5G,CAAC;AAEc,iBAAK,GAAG;IACtB,mBAAmB,EAAE,YAAK,CAAC,MAAM,CAAC;QAChC,WAAW,EAAE,sCAAsC;QACnD,GAAG,EAAE,mBAAmB;QACxB,QAAQ,EAAE,IAAI;KACf,CAAC;IACF,QAAQ,EAAE,YAAK,CAAC,MAAM,CAAC;QACrB,WAAW,EACT,iFAAiF;YACjF,iJAAiJ;QACnJ,GAAG,EAAE,oBAAoB;QACzB,QAAQ,EAAE,KAAK;KAChB,CAAC;IACF,GAAG,EAAE,YAAK,CAAC,MAAM,CAAC;QAChB,WAAW,EACT,iFAAiF;QACnF,GAAG,EAAE,eAAe;QACpB,QAAQ,EAAE,IAAI;KACf,CAAC;CACH,CAAC;kBA5BiB,WAAW","sourcesContent":["import { Command, Flags } from '@oclif/core';\n\nimport { ensureDaemon } from '../../daemon/daemon-spawn.js';\nimport { Password, Srp } from '../../daemon/secrets.js';\n\nexport default class DaemonStart extends Command {\n static override description = 'Start the wallet daemon';\n\n static override examples = [\n '<%= config.bin %> daemon start --infura-project-id <key> --password <pw> --srp <phrase>',\n 'INFURA_PROJECT_ID=<key> MM_WALLET_PASSWORD=<pw> MM_WALLET_SRP=<phrase> <%= config.bin %> daemon start',\n '<%= config.bin %> daemon start --infura-project-id <key> --srp <phrase> # then `mm wallet unlock` later',\n ];\n\n static override flags = {\n 'infura-project-id': Flags.string({\n description: 'Infura project ID for network access',\n env: 'INFURA_PROJECT_ID',\n required: true,\n }),\n password: Flags.string({\n description:\n 'Wallet password (testing only — use MM_WALLET_PASSWORD env var in production). ' +\n 'Required on first run; on subsequent runs, omit (and leave MM_WALLET_PASSWORD unset) to start with a locked keyring and use `mm wallet unlock`.',\n env: 'MM_WALLET_PASSWORD',\n required: false,\n }),\n srp: Flags.string({\n description:\n 'Secret recovery phrase (testing only — use MM_WALLET_SRP env var in production)',\n env: 'MM_WALLET_SRP',\n required: true,\n }),\n };\n\n public async run(): Promise<void> {\n const { flags } = await this.parse(DaemonStart);\n const infuraProjectId = flags['infura-project-id'];\n const password = flags.password ? Password.from(flags.password) : undefined;\n const srp = Srp.from(flags.srp);\n\n const { state, socketPath } = await ensureDaemon({\n dataDir: this.config.dataDir,\n infuraProjectId,\n password,\n srp,\n packageRoot: this.config.root,\n });\n\n if (state === 'already-running') {\n this.log(\n `Daemon already running. Socket: ${socketPath}. ` +\n `The provided flags were not applied; run \\`mm daemon stop\\` and start again to change them.`,\n );\n return;\n }\n\n this.log(`Daemon running. Socket: ${socketPath}`);\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Command } from
|
|
1
|
+
import { Command } from "@oclif/core";
|
|
2
2
|
export default class DaemonStart extends Command {
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
@@ -9,4 +9,4 @@ export default class DaemonStart extends Command {
|
|
|
9
9
|
};
|
|
10
10
|
run(): Promise<void>;
|
|
11
11
|
}
|
|
12
|
-
//# sourceMappingURL=start.d.
|
|
12
|
+
//# sourceMappingURL=start.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start.d.cts","sourceRoot":"","sources":["../../../src/commands/daemon/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAS,oBAAoB;AAK7C,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,OAAO;IAC9C,OAAgB,WAAW,SAA6B;IAExD,OAAgB,QAAQ,WAItB;IAEF,OAAgB,KAAK;;;;MAmBnB;IAEW,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAwBlC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Command } from "@oclif/core";
|
|
2
|
+
export default class DaemonStart extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
'infura-project-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
password: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
srp: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
};
|
|
10
|
+
run(): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=start.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start.d.mts","sourceRoot":"","sources":["../../../src/commands/daemon/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAS,oBAAoB;AAK7C,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,OAAO;IAC9C,OAAgB,WAAW,SAA6B;IAExD,OAAgB,QAAQ,WAItB;IAEF,OAAgB,KAAK;;;;MAmBnB;IAEW,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAwBlC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Command, Flags } from
|
|
2
|
-
import { ensureDaemon } from
|
|
3
|
-
import { Password, Srp } from
|
|
1
|
+
import { Command, Flags } from "@oclif/core";
|
|
2
|
+
import { ensureDaemon } from "../../daemon/daemon-spawn.mjs";
|
|
3
|
+
import { Password, Srp } from "../../daemon/secrets.mjs";
|
|
4
4
|
class DaemonStart extends Command {
|
|
5
5
|
async run() {
|
|
6
6
|
const { flags } = await this.parse(DaemonStart);
|
|
@@ -47,4 +47,4 @@ DaemonStart.flags = {
|
|
|
47
47
|
}),
|
|
48
48
|
};
|
|
49
49
|
export default DaemonStart;
|
|
50
|
-
//# sourceMappingURL=start.
|
|
50
|
+
//# sourceMappingURL=start.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start.mjs","sourceRoot":"","sources":["../../../src/commands/daemon/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK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ACF,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC;QACrB,WAAW,EACT,iFAAiF;YACjF,iJAAiJ;QACnJ,GAAG,EAAE,oBAAoB;QACzB,QAAQ,EAAE,KAAK;KAChB,CAAC;IACF,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC;QAChB,WAAW,EACT,iFAAiF;QACnF,GAAG,EAAE,eAAe;QACpB,QAAQ,EAAE,IAAI;KACf,CAAC;CACH,CAAC;eA5BiB,WAAW","sourcesContent":["import { Command, Flags } from '@oclif/core';\n\nimport { ensureDaemon } from '../../daemon/daemon-spawn.js';\nimport { Password, Srp } from '../../daemon/secrets.js';\n\nexport default class DaemonStart extends Command {\n static override description = 'Start the wallet daemon';\n\n static override examples = [\n '<%= config.bin %> daemon start --infura-project-id <key> --password <pw> --srp <phrase>',\n 'INFURA_PROJECT_ID=<key> MM_WALLET_PASSWORD=<pw> MM_WALLET_SRP=<phrase> <%= config.bin %> daemon start',\n '<%= config.bin %> daemon start --infura-project-id <key> --srp <phrase> # then `mm wallet unlock` later',\n ];\n\n static override flags = {\n 'infura-project-id': Flags.string({\n description: 'Infura project ID for network access',\n env: 'INFURA_PROJECT_ID',\n required: true,\n }),\n password: Flags.string({\n description:\n 'Wallet password (testing only — use MM_WALLET_PASSWORD env var in production). ' +\n 'Required on first run; on subsequent runs, omit (and leave MM_WALLET_PASSWORD unset) to start with a locked keyring and use `mm wallet unlock`.',\n env: 'MM_WALLET_PASSWORD',\n required: false,\n }),\n srp: Flags.string({\n description:\n 'Secret recovery phrase (testing only — use MM_WALLET_SRP env var in production)',\n env: 'MM_WALLET_SRP',\n required: true,\n }),\n };\n\n public async run(): Promise<void> {\n const { flags } = await this.parse(DaemonStart);\n const infuraProjectId = flags['infura-project-id'];\n const password = flags.password ? Password.from(flags.password) : undefined;\n const srp = Srp.from(flags.srp);\n\n const { state, socketPath } = await ensureDaemon({\n dataDir: this.config.dataDir,\n infuraProjectId,\n password,\n srp,\n packageRoot: this.config.root,\n });\n\n if (state === 'already-running') {\n this.log(\n `Daemon already running. Socket: ${socketPath}. ` +\n `The provided flags were not applied; run \\`mm daemon stop\\` and start again to change them.`,\n );\n return;\n }\n\n this.log(`Daemon running. Socket: ${socketPath}`);\n }\n}\n"]}
|