@shieldedtech/moth-cli 0.12.1 → 0.13.0-canary.20260903151454-e3385c4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/CHANGELOG.md +226 -0
  2. package/dist/base-command.d.ts +21 -0
  3. package/dist/base-command.d.ts.map +1 -1
  4. package/dist/base-command.js +53 -17
  5. package/dist/base-command.js.map +1 -1
  6. package/dist/commands/balance.d.ts.map +1 -1
  7. package/dist/commands/balance.js +20 -2
  8. package/dist/commands/balance.js.map +1 -1
  9. package/dist/commands/call.js +1 -1
  10. package/dist/commands/call.js.map +1 -1
  11. package/dist/commands/config.d.ts +1 -1
  12. package/dist/commands/config.d.ts.map +1 -1
  13. package/dist/commands/config.js +13 -1
  14. package/dist/commands/config.js.map +1 -1
  15. package/dist/commands/daemon/serve.d.ts.map +1 -1
  16. package/dist/commands/daemon/serve.js +1 -1
  17. package/dist/commands/daemon/serve.js.map +1 -1
  18. package/dist/commands/deploy.js +1 -1
  19. package/dist/commands/deploy.js.map +1 -1
  20. package/dist/commands/diagnostics/timings.d.ts +28 -0
  21. package/dist/commands/diagnostics/timings.d.ts.map +1 -0
  22. package/dist/commands/diagnostics/timings.js +77 -0
  23. package/dist/commands/diagnostics/timings.js.map +1 -0
  24. package/dist/commands/dust/deregister.js +1 -1
  25. package/dist/commands/dust/deregister.js.map +1 -1
  26. package/dist/commands/dust/register.d.ts.map +1 -1
  27. package/dist/commands/dust/register.js +15 -2
  28. package/dist/commands/dust/register.js.map +1 -1
  29. package/dist/commands/maintenance/insert-vk.js +1 -1
  30. package/dist/commands/maintenance/insert-vk.js.map +1 -1
  31. package/dist/commands/maintenance/insert-vks-batch.js +1 -1
  32. package/dist/commands/maintenance/insert-vks-batch.js.map +1 -1
  33. package/dist/commands/mint.js +1 -1
  34. package/dist/commands/mint.js.map +1 -1
  35. package/dist/commands/preseed/build.d.ts +28 -0
  36. package/dist/commands/preseed/build.d.ts.map +1 -0
  37. package/dist/commands/preseed/build.js +51 -0
  38. package/dist/commands/preseed/build.js.map +1 -0
  39. package/dist/commands/preseed/export.d.ts +28 -0
  40. package/dist/commands/preseed/export.d.ts.map +1 -0
  41. package/dist/commands/preseed/export.js +47 -0
  42. package/dist/commands/preseed/export.js.map +1 -0
  43. package/dist/commands/preseed/import.d.ts +29 -0
  44. package/dist/commands/preseed/import.d.ts.map +1 -0
  45. package/dist/commands/preseed/import.js +81 -0
  46. package/dist/commands/preseed/import.js.map +1 -0
  47. package/dist/commands/preseed/refresh.d.ts +25 -0
  48. package/dist/commands/preseed/refresh.d.ts.map +1 -0
  49. package/dist/commands/preseed/refresh.js +37 -0
  50. package/dist/commands/preseed/refresh.js.map +1 -0
  51. package/dist/commands/preseed/status.d.ts +26 -0
  52. package/dist/commands/preseed/status.d.ts.map +1 -0
  53. package/dist/commands/preseed/status.js +34 -0
  54. package/dist/commands/preseed/status.js.map +1 -0
  55. package/dist/commands/transfer/batch.js +1 -1
  56. package/dist/commands/transfer/batch.js.map +1 -1
  57. package/dist/commands/transfer.d.ts +2 -0
  58. package/dist/commands/transfer.d.ts.map +1 -1
  59. package/dist/commands/transfer.js +86 -15
  60. package/dist/commands/transfer.js.map +1 -1
  61. package/dist/commands/tui.d.ts.map +1 -1
  62. package/dist/commands/tui.js +4 -1
  63. package/dist/commands/tui.js.map +1 -1
  64. package/dist/commands/wallet/address.d.ts +1 -1
  65. package/dist/commands/wallet/address.d.ts.map +1 -1
  66. package/dist/commands/wallet/address.js +11 -2
  67. package/dist/commands/wallet/address.js.map +1 -1
  68. package/dist/commands/wallet/export-phrase.d.ts +35 -0
  69. package/dist/commands/wallet/export-phrase.d.ts.map +1 -0
  70. package/dist/commands/wallet/export-phrase.js +93 -0
  71. package/dist/commands/wallet/export-phrase.js.map +1 -0
  72. package/dist/commands/wallet/generate.d.ts.map +1 -1
  73. package/dist/commands/wallet/generate.js +14 -2
  74. package/dist/commands/wallet/generate.js.map +1 -1
  75. package/dist/mainnet-guard.d.ts +29 -0
  76. package/dist/mainnet-guard.d.ts.map +1 -0
  77. package/dist/mainnet-guard.js +48 -0
  78. package/dist/mainnet-guard.js.map +1 -0
  79. package/package.json +11 -6
@@ -11,14 +11,23 @@ export default class WalletAddress extends BaseCommand {
11
11
  static description = "Show an existing wallet's addresses (unlocks the keystore; offline)";
12
12
  static flags = {
13
13
  ...BaseCommand.baseFlags,
14
- name: Flags.string({ description: 'Wallet name', required: true }),
14
+ // `--name` was required, and this was the only command in the CLI that used
15
+ // it — every other wallet-scoped command takes the shared `--wallet` and
16
+ // falls back to the active wallet. That made this the one command that could
17
+ // not act on the active wallet: `wallet use w1` then `wallet address` failed
18
+ // with "Missing required flag name" (#60). `--wallet` now works, resolution
19
+ // goes through resolveWalletName like everywhere else, and `--name` stays as
20
+ // an alias so existing scripts keep working.
21
+ name: Flags.string({ description: 'Wallet name (alias for --wallet)' }),
15
22
  };
16
23
  async run() {
17
24
  const { flags } = await this.parse(WalletAddress);
18
25
  this.outputFormat = flags.output ?? 'text';
19
26
  this.verbose = flags.verbose;
27
+ // --name wins when given, else --wallet, else the active wallet.
28
+ const walletName = flags.name ?? (await this.resolveWalletName(flags));
20
29
  const passphrase = await getPassphrase();
21
- const wallet = await this.walletManager.unlock(flags.name, passphrase);
30
+ const wallet = await this.walletManager.unlock(walletName, passphrase);
22
31
  try {
23
32
  if (this.outputFormat === 'json') {
24
33
  this.outputSuccess({ name: wallet.name, addresses: wallet.addresses });
@@ -1 +1 @@
1
- {"version":3,"file":"address.js","sourceRoot":"","sources":["../../../src/commands/wallet/address.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAG7D;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,WAAW;IACpD,MAAM,CA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AC;YAC9D,IAAI,CAAC,GAAG,CAAC,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC;QACnD,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACf,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { BaseCommand } from '../../base-command.js';
2
+ /**
3
+ * Print a wallet's recovery phrase, or its raw seed.
4
+ *
5
+ * The capability existed everywhere except here: `WalletManager.exportPhrase` and
6
+ * `exportSeedHex` have been in core throughout, and the extension exposes them —
7
+ * but no CLI command did (#59). The consequences were a CLI with no backup path
8
+ * (the phrase is shown once at `wallet generate` and never again), no supported
9
+ * way to move a wallet between machines, and no way to recover a seed a user
10
+ * already holds the keystore and passphrase for.
11
+ *
12
+ * Nothing here weakens the security posture: anyone who can run this already has
13
+ * the keystore file and the passphrase that decrypts it. What it does is stop
14
+ * pretending otherwise.
15
+ */
16
+ export default class WalletExportPhrase extends BaseCommand {
17
+ static description: string;
18
+ static examples: string[];
19
+ static flags: {
20
+ name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
21
+ 'seed-hex': import("@oclif/core/interfaces").BooleanFlag<boolean>;
22
+ yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
23
+ output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
24
+ network: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
25
+ wallet: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
26
+ verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
27
+ timeout: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
28
+ 'proof-server': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
29
+ prover: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
30
+ indexer: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
31
+ 'node-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
32
+ };
33
+ run(): Promise<void>;
34
+ }
35
+ //# sourceMappingURL=export-phrase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export-phrase.d.ts","sourceRoot":"","sources":["../../../src/commands/wallet/export-phrase.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGpD;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,WAAW;IACzD,OAAgB,WAAW,SAA2E;IAEtG,OAAgB,QAAQ,WAGtB;IAEF,OAAgB,KAAK;;;;;;;;;;;;;MAYnB;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA+D3B"}
@@ -0,0 +1,93 @@
1
+ import { Flags } from '@oclif/core';
2
+ import { BaseCommand } from '../../base-command.js';
3
+ import { getPassphrase } from '../../adapters/passphrase.js';
4
+ /**
5
+ * Print a wallet's recovery phrase, or its raw seed.
6
+ *
7
+ * The capability existed everywhere except here: `WalletManager.exportPhrase` and
8
+ * `exportSeedHex` have been in core throughout, and the extension exposes them —
9
+ * but no CLI command did (#59). The consequences were a CLI with no backup path
10
+ * (the phrase is shown once at `wallet generate` and never again), no supported
11
+ * way to move a wallet between machines, and no way to recover a seed a user
12
+ * already holds the keystore and passphrase for.
13
+ *
14
+ * Nothing here weakens the security posture: anyone who can run this already has
15
+ * the keystore file and the passphrase that decrypts it. What it does is stop
16
+ * pretending otherwise.
17
+ */
18
+ export default class WalletExportPhrase extends BaseCommand {
19
+ static description = "Print a wallet's recovery phrase or seed (prompts for the passphrase)";
20
+ static examples = [
21
+ '<%= config.bin %> wallet export-phrase --wallet my-wallet',
22
+ '<%= config.bin %> wallet export-phrase --wallet my-wallet --seed-hex',
23
+ ];
24
+ static flags = {
25
+ ...BaseCommand.baseFlags,
26
+ name: Flags.string({ description: 'Wallet name (alias for --wallet)' }),
27
+ 'seed-hex': Flags.boolean({
28
+ description: 'Print the raw hex seed instead of the mnemonic',
29
+ default: false,
30
+ }),
31
+ yes: Flags.boolean({
32
+ char: 'y',
33
+ description: 'Skip the confirmation prompt',
34
+ default: false,
35
+ }),
36
+ };
37
+ async run() {
38
+ const { flags } = await this.parse(WalletExportPhrase);
39
+ this.outputFormat = flags.output ?? 'text';
40
+ this.verbose = flags.verbose;
41
+ const walletName = flags.name ?? (await this.resolveWalletName(flags));
42
+ // Confirmed by default, because the failure mode is a phrase left in
43
+ // scrollback or a CI log by someone who did not realise what the command
44
+ // prints. --yes exists for deliberate scripted use.
45
+ if (!flags.yes) {
46
+ if (!process.stdin.isTTY) {
47
+ // Same rule `wallet remove` applies: a destructive-or-disclosing action
48
+ // in a non-interactive context has to be asked for explicitly, or a
49
+ // pipeline discloses a phrase nobody meant to print.
50
+ this.outputError('INVALID_INPUT', 'Non-interactive export requires --yes');
51
+ this.exit(2);
52
+ return;
53
+ }
54
+ const answer = await this.promptIfMissing(undefined, `Print the recovery phrase for "${walletName}"? Anyone who sees it controls the wallet. (yes/no)`);
55
+ if (answer.toLowerCase() !== 'yes' && answer.toLowerCase() !== 'y') {
56
+ this.log('Cancelled.');
57
+ return;
58
+ }
59
+ }
60
+ const passphrase = await getPassphrase();
61
+ const exported = await this.walletManager.exportPhrase(walletName, passphrase);
62
+ // A wallet imported from a hex seed has no mnemonic to give back — say which
63
+ // one this is rather than presenting a seed as a phrase.
64
+ if (flags['seed-hex'] || exported.kind === 'seed') {
65
+ const seedHex = exported.kind === 'seed'
66
+ ? exported.value
67
+ : await this.walletManager.exportSeedHex(walletName, passphrase);
68
+ if (this.outputFormat === 'json') {
69
+ this.outputSuccess({ wallet: walletName, kind: 'seed', seedHex });
70
+ }
71
+ else {
72
+ if (exported.kind === 'seed' && !flags['seed-hex']) {
73
+ this.log('This wallet was imported from a hex seed, so it has no recovery phrase.');
74
+ }
75
+ this.log('');
76
+ this.log(` ${seedHex}`);
77
+ this.log('');
78
+ }
79
+ return;
80
+ }
81
+ if (this.outputFormat === 'json') {
82
+ this.outputSuccess({ wallet: walletName, kind: 'mnemonic', mnemonic: exported.value });
83
+ }
84
+ else {
85
+ this.log('');
86
+ this.log('RECOVERY PHRASE — anyone who sees this controls the wallet:');
87
+ this.log('');
88
+ this.log(` ${exported.value}`);
89
+ this.log('');
90
+ }
91
+ }
92
+ }
93
+ //# sourceMappingURL=export-phrase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export-phrase.js","sourceRoot":"","sources":["../../../src/commands/wallet/export-phrase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,WAAW;IACzD,MAAM,CAAU,WAAW,GAAG,uEAAuE,CAAC;IAEtG,MAAM,CAAU,QAAQ,GAAG;QACzB,2DAA2D;QAC3D,sEAAsE;KACvE,CAAC;IAEF,MAAM,CAAU,KAAK,GAAG;QACtB,GAAG,WAAW,CAAC,SAAS;QACxB,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;QACvE,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC;YACxB,WAAW,EAAE,gDAAgD;YAC7D,OAAO,EAAE,KAAK;SACf,CAAC;QACF,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC;YACjB,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,8BAA8B;YAC3C,OAAO,EAAE,KAAK;SACf,CAAC;KACH,CAAC;IAEF,KAAK,CAAC,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","sourceRoot":"","sources":["../../../src/commands/wallet/generate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAIpD,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,WAAW;IACrD,OAAgB,WAAW,SAAyD;IAEpF,OAAgB,KAAK;;;;;;;;;;;;MAOnB;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAyD1B,OAAO,CAAC,UAAU;CAOnB"}
1
+ {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/commands/wallet/generate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAIpD,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,WAAW;IACrD,OAAgB,WAAW,SAAyD;IAEpF,OAAgB,KAAK;;;;;;;;;;;;MAOnB;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAsE1B,OAAO,CAAC,UAAU;CAOnB"}
@@ -1,6 +1,7 @@
1
1
  import { Flags } from '@oclif/core';
2
2
  import { BaseCommand } from '../../base-command.js';
3
3
  import { getPassphrase } from '../../adapters/passphrase.js';
4
+ import { chainTip } from '@shieldedtech/moth-wallet';
4
5
  export default class WalletGenerate extends BaseCommand {
5
6
  static description = 'Generate a new wallet from a random BIP-39 mnemonic';
6
7
  static flags = {
@@ -17,8 +18,19 @@ export default class WalletGenerate extends BaseCommand {
17
18
  this.verbose = flags.verbose;
18
19
  const name = flags.name ?? `wallet-${Date.now().toString(36)}`;
19
20
  const passphrase = await getPassphrase('New passphrase: ');
20
- this.log_verbose(`Generating wallet "${name}"`);
21
- const info = await this.walletManager.generate(name, passphrase, flags.network);
21
+ // Record the chain tip as this wallet's birthday, so its first sync can
22
+ // start from a pre-seed reference instead of walking from genesis. Only for
23
+ // wallets generated here — `wallet import` deliberately passes none, since a
24
+ // restored wallet may hold funds at any height (ADR 0003).
25
+ //
26
+ // Best-effort: an unreachable indexer yields undefined and the wallet is
27
+ // still created, it just syncs the slow way.
28
+ const network = await this.getNetworkConfig(flags.network, this.getNetworkOverrides(flags));
29
+ const birthday = await chainTip(network.indexerUrl);
30
+ this.log_verbose(birthday === undefined
31
+ ? `Generating wallet "${name}" (no chain tip available — will sync from genesis)`
32
+ : `Generating wallet "${name}" at birthday ${birthday}`);
33
+ const info = await this.walletManager.generate(name, passphrase, flags.network, birthday);
22
34
  if (this.outputFormat === 'json') {
23
35
  const output = {
24
36
  name: info.name,
@@ -1 +1 @@
1
- {"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/commands/wallet/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAG7D,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,WAAW;IACrD,MAAM,CAAU,WAAW,GAAG,qDAAqD,CAAC;IAEpF,MAAM,CAAU,KAAK,GAAG;QACtB,GAAG,WAAW,CAAC,SAAS;QACxB,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,yCAAyC,EAAE,CAAC;QAC9E,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC;YAC7B,WAAW,EAAE,oDAAoD;YACjE,OAAO,EAAE,KAAK;SACf,CAAC;KACH,CAAC;IAEF,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QACnD,IAAI,CAAC,YAAY,GAAI,KAAK,CAAC,MAA0B,IAAI,MAAM,CAAC;QAChE,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAE7B,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,UAAU,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE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uE,CAAC,CAAC;gBAC9F,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,qDAAqD,CAAC,CAAC;YAC9E,CAAC;QACH,CAAC;IACH,CAAC;IAEO,UAAU,CAAC,KAAa,EAAE,WAAmB,EAAE,IAAqB;QAC1E,IAAI,CAAC,GAAG,CAAC,KAAK,KAAK,MAAM,WAAW,GAAG,CAAC,CAAC;QACzC,KAAK,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YAC9D,IAAI,CAAC,GAAG,CAAC,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC;QACnD,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACf,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * The one place mainnet is refused.
3
+ *
4
+ * This used to live inside `BaseCommand.getNetworkConfig`, which meant it only
5
+ * ran for commands that resolved a network config — and the commands that matter
6
+ * most did not. `moth wallet generate --network mainnet` derived mainnet
7
+ * addresses, wrote a keystore, printed a recovery phrase and exited 0, with no
8
+ * warning shown (issue #25). A guard placed in one consumer is not a guard; it is
9
+ * a convention that happens to hold wherever someone remembered it.
10
+ *
11
+ * So the refusal is attached to the `--network` flag itself, which every command
12
+ * inherits through `BaseCommand.baseFlags`, and to the config key that can store
13
+ * a default network. Those are the two ways a network id enters the CLI.
14
+ */
15
+ /** True for the network ids that mean "real funds". */
16
+ export declare function isMainnet(networkId: string | undefined): boolean;
17
+ /**
18
+ * Print the refusal and stop.
19
+ *
20
+ * `process.exit` rather than a thrown error on purpose. This runs from flag
21
+ * parsing as well as from command bodies, and oclif maps thrown errors to its own
22
+ * exit codes and formatting — which would make the exit status depend on where
23
+ * the refusal happened to fire. A refusal should look the same from everywhere,
24
+ * and 1 is what it has always been.
25
+ */
26
+ export declare function refuseMainnet(): never;
27
+ /** Refuse if `networkId` names mainnet; otherwise return it unchanged. */
28
+ export declare function assertNotMainnet(networkId: string): string;
29
+ //# sourceMappingURL=mainnet-guard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mainnet-guard.d.ts","sourceRoot":"","sources":["../src/mainnet-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAcH,uDAAuD;AACvD,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAEhE;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,IAAI,KAAK,CAGrC;AAED,0EAA0E;AAC1E,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAG1D"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * The one place mainnet is refused.
3
+ *
4
+ * This used to live inside `BaseCommand.getNetworkConfig`, which meant it only
5
+ * ran for commands that resolved a network config — and the commands that matter
6
+ * most did not. `moth wallet generate --network mainnet` derived mainnet
7
+ * addresses, wrote a keystore, printed a recovery phrase and exited 0, with no
8
+ * warning shown (issue #25). A guard placed in one consumer is not a guard; it is
9
+ * a convention that happens to hold wherever someone remembered it.
10
+ *
11
+ * So the refusal is attached to the `--network` flag itself, which every command
12
+ * inherits through `BaseCommand.baseFlags`, and to the config key that can store
13
+ * a default network. Those are the two ways a network id enters the CLI.
14
+ */
15
+ const BANNER = '\n' +
16
+ ' ╔══════════════════════════════════════════════════════════════╗\n' +
17
+ ' ║ WARNING ║\n' +
18
+ ' ║ ║\n' +
19
+ ' ║ Moth is a reference wallet for development and testing. ║\n' +
20
+ ' ║ It should NOT be used with real funds on mainnet. ║\n' +
21
+ ' ║ ║\n' +
22
+ ' ║ Use Lace or another commercial wallet for mainnet. ║\n' +
23
+ ' ╚══════════════════════════════════════════════════════════════╝\n' +
24
+ '\n';
25
+ /** True for the network ids that mean "real funds". */
26
+ export function isMainnet(networkId) {
27
+ return networkId === 'mainnet';
28
+ }
29
+ /**
30
+ * Print the refusal and stop.
31
+ *
32
+ * `process.exit` rather than a thrown error on purpose. This runs from flag
33
+ * parsing as well as from command bodies, and oclif maps thrown errors to its own
34
+ * exit codes and formatting — which would make the exit status depend on where
35
+ * the refusal happened to fire. A refusal should look the same from everywhere,
36
+ * and 1 is what it has always been.
37
+ */
38
+ export function refuseMainnet() {
39
+ process.stderr.write(BANNER);
40
+ process.exit(1);
41
+ }
42
+ /** Refuse if `networkId` names mainnet; otherwise return it unchanged. */
43
+ export function assertNotMainnet(networkId) {
44
+ if (isMainnet(networkId))
45
+ refuseMainnet();
46
+ return networkId;
47
+ }
48
+ //# sourceMappingURL=mainnet-guard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mainnet-guard.js","sourceRoot":"","sources":["../src/mainnet-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,MAAM,GACV,IAAI;IACJ,sEAAsE;IACtE,oEAAoE;IACpE,oEAAoE;IACpE,oEAAoE;IACpE,oEAAoE;IACpE,oEAAoE;IACpE,oEAAoE;IACpE,sEAAsE;IACtE,IAAI,CAAC;AAEP,uDAAuD;AACvD,MAAM,UAAU,SAAS,CAAC,SAA6B;IACrD,OAAO,SAAS,KAAK,SAAS,CAAC;AACjC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,gBAAgB,CAAC,SAAiB;IAChD,IAAI,SAAS,CAAC,SAAS,CAAC;QAAE,aAAa,EAAE,CAAC;IAC1C,OAAO,SAAS,CAAC;AACnB,CAAC"}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@shieldedtech/moth-cli",
3
- "version": "0.12.1",
3
+ "version": "0.13.0-canary.20260903151454-e3385c4",
4
4
  "description": "CLI tool for Midnight Network wallet operations and contract deployments. USE AT YOUR OWN RISK. Experimental software provided AS-IS with no warranty. Not audited. For development and testing purposes only.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "publishConfig": {
8
- "access": "restricted"
8
+ "access": "public"
9
9
  },
10
10
  "files": [
11
11
  "dist",
@@ -32,8 +32,8 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@oclif/core": "^4.2.0",
35
- "@shieldedtech/moth-tui": "^0.12.1",
36
- "@shieldedtech/moth-wallet": "^0.12.1",
35
+ "@shieldedtech/moth-tui": "0.13.0-canary.20260903151454-e3385c4",
36
+ "@shieldedtech/moth-wallet": "0.13.0-canary.20260903151454-e3385c4",
37
37
  "dotenv": "17.4.2",
38
38
  "ink": "^7.0.1"
39
39
  },
@@ -48,6 +48,11 @@
48
48
  "strategy": "pattern",
49
49
  "target": "./dist/commands"
50
50
  },
51
- "topicSeparator": " "
51
+ "topicSeparator": " ",
52
+ "topics": {
53
+ "preseed": {
54
+ "description": "Inspect and maintain this machine's pre-seed reference: one empty wallet synced to chain tip, which lets a new wallet start from its state instead of walking the chain."
55
+ }
56
+ }
52
57
  }
53
- }
58
+ }