@metamask-previews/wallet-cli 0.0.0-preview-fdd989e1b → 0.0.0-preview-7fb08ad32
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
CHANGED
|
@@ -32,7 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
32
32
|
- `--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
33
|
- 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))
|
|
34
34
|
- Report daemon socket connection errors consistently across `mm daemon call` and `mm daemon list` ([#9339](https://github.com/MetaMask/core/pull/9339))
|
|
35
|
-
- Bump `@metamask/wallet` from `^3.0.0` to `^18.0.
|
|
35
|
+
- Bump `@metamask/wallet` from `^3.0.0` to `^18.0.0` ([#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), [#10137](https://github.com/MetaMask/core/pull/10137), [#10160](https://github.com/MetaMask/core/pull/10160), [#10280](https://github.com/MetaMask/core/pull/10280), [#10351](https://github.com/MetaMask/core/pull/10351), [#10423](https://github.com/MetaMask/core/pull/10423), [#10433](https://github.com/MetaMask/core/pull/10433), [#10570](https://github.com/MetaMask/core/pull/10570), [#10655](https://github.com/MetaMask/core/pull/10655), [#10658](https://github.com/MetaMask/core/pull/10658), [#10756](https://github.com/MetaMask/core/pull/10756), [#10810](https://github.com/MetaMask/core/pull/10810), [#10864](https://github.com/MetaMask/core/pull/10864))
|
|
36
36
|
- 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
37
|
- Wire the `selectedNetworkController` slot in the daemon wallet's instance options, passing an empty `domainProxyMap` ([#10808](https://github.com/MetaMask/core/pull/10808))
|
|
38
38
|
- Bump `@metamask/analytics-controller` from `^1.2.1` to `^4.0.0` ([#9735](https://github.com/MetaMask/core/pull/9735), [#10092](https://github.com/MetaMask/core/pull/10092), [#10160](https://github.com/MetaMask/core/pull/10160), [#10301](https://github.com/MetaMask/core/pull/10301), [#10411](https://github.com/MetaMask/core/pull/10411), [#10658](https://github.com/MetaMask/core/pull/10658))
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import type { Config } from '@oclif/core';
|
|
3
|
+
import { CLIError } from '@oclif/core/errors';
|
|
4
|
+
type CommandCtor = new (argv: string[], config: Config) => Command & {
|
|
5
|
+
_run: () => Promise<unknown>;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Invoke an oclif command class with the given argv and return the captured
|
|
9
|
+
* stdout/stderr/error so tests can assert on them.
|
|
10
|
+
*
|
|
11
|
+
* Bypasses `Command.run`'s static plugin-loading path (which requires a real
|
|
12
|
+
* `Config.load`) by constructing the command instance directly with a
|
|
13
|
+
* hand-rolled `Config` and invoking the protected `_run`. Spies on the
|
|
14
|
+
* Command prototype so `this.log` and `this.error` go to local buffers
|
|
15
|
+
* instead of stdout/stderr.
|
|
16
|
+
*
|
|
17
|
+
* @param CommandClass - The command class (a subclass of `@oclif/core` Command).
|
|
18
|
+
* @param argv - Command-line tokens (flags + positional args).
|
|
19
|
+
* @returns Captured stdout, stderr, and any `this.error()` payload.
|
|
20
|
+
*/
|
|
21
|
+
export declare function runCommand(CommandClass: CommandCtor, argv?: string[]): Promise<{
|
|
22
|
+
stdout: string;
|
|
23
|
+
stderr: string;
|
|
24
|
+
error: CLIError | undefined;
|
|
25
|
+
}>;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=run-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-command.d.ts","sourceRoot":"","sources":["../../src/test/run-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,KAAK,WAAW,GAAG,KACjB,IAAI,EAAE,MAAM,EAAE,EACd,MAAM,EAAE,MAAM,KACX,OAAO,GAAG;IACb,IAAI,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;CAC9B,CAAC;AAKF;;;;;;;;;;;;;GAaG;AACH,wBAAsB,UAAU,CAC9B,YAAY,EAAE,WAAW,EACzB,IAAI,GAAE,MAAM,EAAO,GAClB,OAAO,CAAC;IACT,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,QAAQ,GAAG,SAAS,CAAC;CAC7B,CAAC,CAkDD"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { CLIError } from '@oclif/core/errors';
|
|
3
|
+
const TEST_DATA_DIR = '/tmp/mm-cli-test-data';
|
|
4
|
+
const TEST_PACKAGE_ROOT = '/tmp/mm-cli-test-root';
|
|
5
|
+
/**
|
|
6
|
+
* Invoke an oclif command class with the given argv and return the captured
|
|
7
|
+
* stdout/stderr/error so tests can assert on them.
|
|
8
|
+
*
|
|
9
|
+
* Bypasses `Command.run`'s static plugin-loading path (which requires a real
|
|
10
|
+
* `Config.load`) by constructing the command instance directly with a
|
|
11
|
+
* hand-rolled `Config` and invoking the protected `_run`. Spies on the
|
|
12
|
+
* Command prototype so `this.log` and `this.error` go to local buffers
|
|
13
|
+
* instead of stdout/stderr.
|
|
14
|
+
*
|
|
15
|
+
* @param CommandClass - The command class (a subclass of `@oclif/core` Command).
|
|
16
|
+
* @param argv - Command-line tokens (flags + positional args).
|
|
17
|
+
* @returns Captured stdout, stderr, and any `this.error()` payload.
|
|
18
|
+
*/
|
|
19
|
+
export async function runCommand(CommandClass, argv = []) {
|
|
20
|
+
let stdout = '';
|
|
21
|
+
let stderr = '';
|
|
22
|
+
let error;
|
|
23
|
+
const fakeConfig = {
|
|
24
|
+
dataDir: TEST_DATA_DIR,
|
|
25
|
+
root: TEST_PACKAGE_ROOT,
|
|
26
|
+
bin: 'mm',
|
|
27
|
+
name: '@metamask/wallet-cli',
|
|
28
|
+
version: '0.0.0-test',
|
|
29
|
+
pjson: { name: '@metamask/wallet-cli', version: '0.0.0-test' },
|
|
30
|
+
findCommand: () => undefined,
|
|
31
|
+
runHook: async () => ({ successes: [], failures: [] }),
|
|
32
|
+
scopedEnvVar: () => undefined,
|
|
33
|
+
scopedEnvVarKey: () => '',
|
|
34
|
+
scopedEnvVarKeys: () => [],
|
|
35
|
+
scopedEnvVarTrue: () => false,
|
|
36
|
+
plugins: new Map(),
|
|
37
|
+
flexibleTaxonomy: false,
|
|
38
|
+
};
|
|
39
|
+
const logSpy = jest
|
|
40
|
+
.spyOn(Command.prototype, 'log')
|
|
41
|
+
.mockImplementation((message = '') => {
|
|
42
|
+
stdout += `${String(message)}\n`;
|
|
43
|
+
});
|
|
44
|
+
const errorSpy = jest
|
|
45
|
+
.spyOn(Command.prototype, 'error')
|
|
46
|
+
.mockImplementation((input) => {
|
|
47
|
+
const message = typeof input === 'string' ? input : input.message;
|
|
48
|
+
throw new CLIError(message);
|
|
49
|
+
});
|
|
50
|
+
try {
|
|
51
|
+
const instance = new CommandClass(argv, fakeConfig);
|
|
52
|
+
await instance._run();
|
|
53
|
+
}
|
|
54
|
+
catch (caught) {
|
|
55
|
+
if (caught instanceof CLIError) {
|
|
56
|
+
error = caught;
|
|
57
|
+
stderr += `${caught.message}\n`;
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
throw caught;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
finally {
|
|
64
|
+
logSpy.mockRestore();
|
|
65
|
+
errorSpy.mockRestore();
|
|
66
|
+
}
|
|
67
|
+
return { stdout, stderr, error };
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=run-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-command.js","sourceRoot":"","sources":["../../src/test/run-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAS9C,MAAM,aAAa,GAAG,uBAAuB,CAAC;AAC9C,MAAM,iBAAiB,GAAG,uBAAuB,CAAC;AAElD;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,YAAyB,EACzB,IAAI,GAAa,EAAE;IAMnB,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,KAA2B,CAAC;IAEhC,MAAM,UAAU,GAAG;QACjB,OAAO,EAAE,aAAa;QACtB,IAAI,EAAE,iBAAiB;QACvB,GAAG,EAAE,IAAI;QACT,IAAI,EAAE,sBAAsB;QAC5B,OAAO,EAAE,YAAY;QACrB,KAAK,EAAE,EAAE,IAAI,EAAE,sBAAsB,EAAE,OAAO,EAAE,YAAY,EAAE;QAC9D,WAAW,EAAE,GAAG,EAAE,CAAC,SAAS;QAC5B,OAAO,EAAE,KAAK,IA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;QACf,CAAC;IACH,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,WAAW,EAAE,CAAC;QACrB,QAAQ,CAAC,WAAW,EAAE,CAAC;IACzB,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AACnC,CAAC","sourcesContent":["import { Command } from '@oclif/core';\nimport type { Config } from '@oclif/core';\nimport { CLIError } from '@oclif/core/errors';\n\ntype CommandCtor = new (\n argv: string[],\n config: Config,\n) => Command & {\n _run: () => Promise<unknown>;\n};\n\nconst TEST_DATA_DIR = '/tmp/mm-cli-test-data';\nconst TEST_PACKAGE_ROOT = '/tmp/mm-cli-test-root';\n\n/**\n * Invoke an oclif command class with the given argv and return the captured\n * stdout/stderr/error so tests can assert on them.\n *\n * Bypasses `Command.run`'s static plugin-loading path (which requires a real\n * `Config.load`) by constructing the command instance directly with a\n * hand-rolled `Config` and invoking the protected `_run`. Spies on the\n * Command prototype so `this.log` and `this.error` go to local buffers\n * instead of stdout/stderr.\n *\n * @param CommandClass - The command class (a subclass of `@oclif/core` Command).\n * @param argv - Command-line tokens (flags + positional args).\n * @returns Captured stdout, stderr, and any `this.error()` payload.\n */\nexport async function runCommand(\n CommandClass: CommandCtor,\n argv: string[] = [],\n): Promise<{\n stdout: string;\n stderr: string;\n error: CLIError | undefined;\n}> {\n let stdout = '';\n let stderr = '';\n let error: CLIError | undefined;\n\n const fakeConfig = {\n dataDir: TEST_DATA_DIR,\n root: TEST_PACKAGE_ROOT,\n bin: 'mm',\n name: '@metamask/wallet-cli',\n version: '0.0.0-test',\n pjson: { name: '@metamask/wallet-cli', version: '0.0.0-test' },\n findCommand: () => undefined,\n runHook: async () => ({ successes: [], failures: [] }),\n scopedEnvVar: () => undefined,\n scopedEnvVarKey: () => '',\n scopedEnvVarKeys: () => [],\n scopedEnvVarTrue: () => false,\n plugins: new Map(),\n flexibleTaxonomy: false,\n } as unknown as Config;\n\n const logSpy = jest\n .spyOn(Command.prototype, 'log')\n .mockImplementation((message: unknown = '') => {\n stdout += `${String(message)}\\n`;\n });\n const errorSpy = jest\n .spyOn(Command.prototype, 'error')\n .mockImplementation((input: string | Error) => {\n const message = typeof input === 'string' ? input : input.message;\n throw new CLIError(message);\n });\n\n try {\n const instance = new CommandClass(argv, fakeConfig);\n await instance._run();\n } catch (caught: unknown) {\n if (caught instanceof CLIError) {\n error = caught;\n stderr += `${caught.message}\\n`;\n } else {\n throw caught;\n }\n } finally {\n logSpy.mockRestore();\n errorSpy.mockRestore();\n }\n\n return { stdout, stderr, error };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask-previews/wallet-cli",
|
|
3
|
-
"version": "0.0.0-preview-
|
|
3
|
+
"version": "0.0.0-preview-7fb08ad32",
|
|
4
4
|
"description": "The CLI of @metamask/wallet",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Ethereum",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@metamask/storage-service": "^2.0.0",
|
|
63
63
|
"@metamask/superstruct": "^3.4.1",
|
|
64
64
|
"@metamask/utils": "^12.0.0",
|
|
65
|
-
"@metamask/wallet": "^18.0.
|
|
65
|
+
"@metamask/wallet": "^18.0.0",
|
|
66
66
|
"@oclif/core": "^4.10.5",
|
|
67
67
|
"better-sqlite3": "^13.0.3",
|
|
68
68
|
"immer": "^11.1.18"
|