@vultisig/cli 0.2.0-alpha.5 → 0.2.0-alpha.6

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
@@ -1,5 +1,14 @@
1
1
  # @vultisig/cli
2
2
 
3
+ ## 0.2.0-alpha.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#58](https://github.com/vultisig/vultisig-sdk/pull/58) [`c9b7d88`](https://github.com/vultisig/vultisig-sdk/commit/c9b7d888e21e9db1b928ddc929294aa15157e476) Thanks [@bornslippynuxx](https://github.com/bornslippynuxx)! - Fix password prompt being swallowed by spinner during signing
8
+ - Add `--password` option to `send` and `swap` commands for non-interactive use
9
+ - Pre-unlock vault before signing spinner starts to prevent prompt interference
10
+ - Password prompt now appears before spinner when not provided via CLI flag
11
+
3
12
  ## 0.2.0-alpha.5
4
13
 
5
14
  ### Patch Changes
package/README.md CHANGED
@@ -86,6 +86,9 @@ vultisig send ethereum 0xRecipient... 0.1
86
86
 
87
87
  # Send ERC-20 token
88
88
  vultisig send ethereum 0xRecipient... 100 --token 0xTokenAddress...
89
+
90
+ # Provide password via flag (for scripts/automation)
91
+ vultisig send ethereum 0xRecipient... 0.1 --password mypassword
89
92
  ```
90
93
 
91
94
  ### Interactive Shell
@@ -137,6 +140,17 @@ vultisig -i
137
140
  | `swap-quote <from> <to> <amount>` | Get a swap quote |
138
141
  | `swap <from> <to> <amount>` | Execute a swap |
139
142
 
143
+ ```bash
144
+ # Execute a swap
145
+ vultisig swap ethereum bitcoin 0.1
146
+
147
+ # With password for automation
148
+ vultisig swap ethereum bitcoin 0.1 --password mypassword
149
+
150
+ # Skip confirmation prompt
151
+ vultisig swap ethereum bitcoin 0.1 -y --password mypassword
152
+ ```
153
+
140
154
  ### Settings
141
155
 
142
156
  | Command | Description |
package/dist/index.js CHANGED
@@ -231,6 +231,17 @@ function createPasswordCallback() {
231
231
  return getPassword(vaultId, vaultName);
232
232
  };
233
233
  }
234
+ async function ensureVaultUnlocked(vault, password) {
235
+ if (!vault.isEncrypted || vault.isUnlocked()) {
236
+ return;
237
+ }
238
+ if (password) {
239
+ await vault.unlock(password);
240
+ return;
241
+ }
242
+ const inputPassword = await promptForPassword(vault.name, vault.id);
243
+ await vault.unlock(inputPassword);
244
+ }
234
245
 
235
246
  // src/adapters/cli-context.ts
236
247
  var CLIContext = class extends BaseCommandContext {
@@ -770,6 +781,7 @@ async function sendTransaction(vault, params) {
770
781
  throw new Error("Transaction cancelled by user");
771
782
  }
772
783
  }
784
+ await ensureVaultUnlocked(vault, params.password);
773
785
  const signSpinner = createSpinner("Signing transaction...");
774
786
  vault.on("signingProgress", ({ step }) => {
775
787
  signSpinner.text = `${step.message} (${step.progress}%)`;
@@ -1263,6 +1275,7 @@ async function executeSwap(ctx2, options) {
1263
1275
  autoApprove: false
1264
1276
  });
1265
1277
  prepSpinner.succeed("Swap prepared");
1278
+ await ensureVaultUnlocked(vault, options.password);
1266
1279
  if (approvalPayload) {
1267
1280
  info("\nToken approval required before swap...");
1268
1281
  const approvalSpinner = createSpinner("Signing approval transaction...");
@@ -2537,13 +2550,17 @@ import { join } from "path";
2537
2550
  var cachedVersion = null;
2538
2551
  function getVersion() {
2539
2552
  if (cachedVersion) return cachedVersion;
2553
+ if (true) {
2554
+ cachedVersion = "0.2.0-alpha.6";
2555
+ return cachedVersion;
2556
+ }
2540
2557
  try {
2541
2558
  const packagePath = new URL("../../package.json", import.meta.url);
2542
2559
  const pkg = JSON.parse(readFileSync(packagePath, "utf-8"));
2543
2560
  cachedVersion = pkg.version;
2544
2561
  return cachedVersion;
2545
2562
  } catch {
2546
- cachedVersion = "0.1.0-beta.1";
2563
+ cachedVersion = "0.0.0-unknown";
2547
2564
  return cachedVersion;
2548
2565
  }
2549
2566
  }
@@ -3067,7 +3084,7 @@ program.command("balance [chain]").description("Show balance for a chain or all
3067
3084
  });
3068
3085
  })
3069
3086
  );
3070
- program.command("send <chain> <to> <amount>").description("Send tokens to an address").option("--token <tokenId>", "Token to send (default: native)").option("--memo <memo>", "Transaction memo").option("-y, --yes", "Skip confirmation prompt").action(
3087
+ program.command("send <chain> <to> <amount>").description("Send tokens to an address").option("--token <tokenId>", "Token to send (default: native)").option("--memo <memo>", "Transaction memo").option("-y, --yes", "Skip confirmation prompt").option("--password <password>", "Vault password for signing").action(
3071
3088
  withExit(
3072
3089
  async (chainStr, to, amount, options) => {
3073
3090
  const context = await init(program.opts().vault);
@@ -3078,7 +3095,8 @@ program.command("send <chain> <to> <amount>").description("Send tokens to an add
3078
3095
  amount,
3079
3096
  tokenId: options.token,
3080
3097
  memo: options.memo,
3081
- yes: options.yes
3098
+ yes: options.yes,
3099
+ password: options.password
3082
3100
  });
3083
3101
  } catch (err) {
3084
3102
  if (err.message === "Transaction cancelled by user") {
@@ -3204,7 +3222,7 @@ program.command("swap-quote <fromChain> <toChain> <amount>").description("Get a
3204
3222
  }
3205
3223
  )
3206
3224
  );
3207
- program.command("swap <fromChain> <toChain> <amount>").description("Swap tokens between chains").option("--from-token <address>", "Token address to swap from (default: native)").option("--to-token <address>", "Token address to swap to (default: native)").option("--slippage <percent>", "Slippage tolerance in percent", "1").option("-y, --yes", "Skip confirmation prompt").action(
3225
+ program.command("swap <fromChain> <toChain> <amount>").description("Swap tokens between chains").option("--from-token <address>", "Token address to swap from (default: native)").option("--to-token <address>", "Token address to swap to (default: native)").option("--slippage <percent>", "Slippage tolerance in percent", "1").option("-y, --yes", "Skip confirmation prompt").option("--password <password>", "Vault password for signing").action(
3208
3226
  withExit(
3209
3227
  async (fromChainStr, toChainStr, amountStr, options) => {
3210
3228
  const context = await init(program.opts().vault);
@@ -3216,7 +3234,8 @@ program.command("swap <fromChain> <toChain> <amount>").description("Swap tokens
3216
3234
  fromToken: options.fromToken,
3217
3235
  toToken: options.toToken,
3218
3236
  slippage: options.slippage ? parseFloat(options.slippage) : void 0,
3219
- yes: options.yes
3237
+ yes: options.yes,
3238
+ password: options.password
3220
3239
  });
3221
3240
  } catch (err) {
3222
3241
  if (err.message === "Swap cancelled by user") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vultisig/cli",
3
- "version": "0.2.0-alpha.5",
3
+ "version": "0.2.0-alpha.6",
4
4
  "description": "Command-line wallet for Vultisig - multi-chain MPC wallet management",
5
5
  "type": "module",
6
6
  "bin": {
@@ -14,7 +14,7 @@
14
14
  "LICENSE"
15
15
  ],
16
16
  "scripts": {
17
- "build": "esbuild src/index.ts --bundle --platform=node --target=node20 --format=esm --outfile=dist/index.js --external:@vultisig/sdk --external:dotenv --external:chalk --external:commander --external:inquirer --external:ora --external:cli-table3 --external:tabtab --external:ws",
17
+ "build": "node build.mjs",
18
18
  "start": "node dist/index.js",
19
19
  "dev": "npx tsx src/index.ts",
20
20
  "cli": "npx tsx src/index.ts",