@1sat/cli 0.0.130 → 0.0.131

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 (2) hide show
  1. package/dist/cli.js +28 -21
  2. package/package.json +8 -8
package/dist/cli.js CHANGED
@@ -1,7 +1,15 @@
1
1
  #!/usr/bin/env node
2
- import { createRequire } from "node:module";
3
- var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
4
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
2
+ var __esm = (fn, res, err) => () => {
3
+ if (fn)
4
+ try {
5
+ res = fn(fn = 0);
6
+ } catch (e) {
7
+ err = [e];
8
+ }
9
+ if (err)
10
+ throw err[0];
11
+ return res;
12
+ };
5
13
 
6
14
  // src/args.ts
7
15
  function parseGlobalFlags(args) {
@@ -622,11 +630,11 @@ async function handleActionCommand(args, opts) {
622
630
  Registered actions:
623
631
  `);
624
632
  const grouped = new Map;
625
- for (const action2 of actions) {
626
- const cat = action2.meta.category;
633
+ for (const action of actions) {
634
+ const cat = action.meta.category;
627
635
  if (!grouped.has(cat))
628
636
  grouped.set(cat, []);
629
- grouped.get(cat).push(action2);
637
+ grouped.get(cat).push(action);
630
638
  }
631
639
  for (const [category, categoryActions] of grouped) {
632
640
  console.log(` ${category}:`);
@@ -1665,7 +1673,7 @@ function createApprovalAuth(wallet) {
1665
1673
  get(target, property) {
1666
1674
  if (property === "createAction")
1667
1675
  return async (...args) => {
1668
- const satoshis = args[0].outputs?.reduce((sum, output2) => sum + output2.satoshis, 0) ?? 0;
1676
+ const satoshis = args[0].outputs?.reduce((sum, output) => sum + output.satoshis, 0) ?? 0;
1669
1677
  if (!Number.isSafeInteger(satoshis) || satoshis <= 0)
1670
1678
  throw new Error("Invalid HTTP payment amount");
1671
1679
  if (approved === false)
@@ -2189,15 +2197,15 @@ async function handleInitCommand(_args, opts) {
2189
2197
  }
2190
2198
  let wif;
2191
2199
  if (keySource === "generate") {
2192
- const pk2 = PrivateKey2.fromRandom();
2193
- wif = pk2.toWif();
2194
- const address2 = pk2.toPublicKey().toAddress();
2200
+ const pk = PrivateKey2.fromRandom();
2201
+ wif = pk.toWif();
2202
+ const address = pk.toPublicKey().toAddress();
2195
2203
  console.log();
2196
2204
  console.log(formatWarning(" IMPORTANT: Back up your private key!"));
2197
2205
  console.log(formatWarning(" If you lose it, your funds are gone forever."));
2198
2206
  console.log();
2199
2207
  console.log(` ${formatValue("WIF:")} ${wif}`);
2200
- console.log(` ${formatValue("Address:")} ${address2}`);
2208
+ console.log(` ${formatValue("Address:")} ${address}`);
2201
2209
  console.log();
2202
2210
  const confirmed = await confirm2({
2203
2211
  message: "Have you saved your private key somewhere safe?"
@@ -3530,12 +3538,12 @@ async function permissionsRevoke(args, opts) {
3530
3538
  const originator = normalizeOriginator2(origin);
3531
3539
  const { store, path } = openStore(opts);
3532
3540
  if (hasFlag(args, "--all")) {
3533
- const removed2 = await store.deleteAllForOriginator(originator);
3541
+ const removed = await store.deleteAllForOriginator(originator);
3534
3542
  if (opts.json) {
3535
- output({ originator, removed: removed2, store: path }, opts);
3543
+ output({ originator, removed, store: path }, opts);
3536
3544
  return;
3537
3545
  }
3538
- output(`revoked ${removed2} grant(s) for ${originator}`, opts);
3546
+ output(`revoked ${removed} grant(s) for ${originator}`, opts);
3539
3547
  return;
3540
3548
  }
3541
3549
  let specs;
@@ -4731,11 +4739,11 @@ function selectedSweepClasses(only, skip) {
4731
4739
  throw new Error("--only and --skip are mutually exclusive");
4732
4740
  }
4733
4741
  if (only) {
4734
- const selected2 = parseSweepClasses(only, "--only");
4735
- if (selected2.size === 0) {
4742
+ const selected = parseSweepClasses(only, "--only");
4743
+ if (selected.size === 0) {
4736
4744
  throw new Error("--only requires at least one class");
4737
4745
  }
4738
- return selected2;
4746
+ return selected;
4739
4747
  }
4740
4748
  const selected = new Set(SWEEP_CLASSES);
4741
4749
  if (skip) {
@@ -5832,8 +5840,8 @@ async function walletListOutputs(args, opts) {
5832
5840
  ${result.totalOutputs} total outputs in basket '${basket}':
5833
5841
  `);
5834
5842
  for (const out of result.outputs) {
5835
- const tags2 = out.tags?.join(", ") || "none";
5836
- console.log(` ${out.outpoint} | ${out.satoshis} sats | tags: ${tags2}`);
5843
+ const tags = out.tags?.join(", ") || "none";
5844
+ console.log(` ${out.outpoint} | ${out.satoshis} sats | tags: ${tags}`);
5837
5845
  }
5838
5846
  console.log();
5839
5847
  }
@@ -6048,7 +6056,6 @@ var init_wallet = __esm(() => {
6048
6056
  });
6049
6057
 
6050
6058
  // src/main.ts
6051
- var exports_main = {};
6052
6059
  import { existsSync as existsSync5 } from "node:fs";
6053
6060
  import { resolve } from "node:path";
6054
6061
  import { config as loadEnv } from "dotenv";
@@ -6192,4 +6199,4 @@ var init_main = __esm(() => {
6192
6199
 
6193
6200
  // src/cli.ts
6194
6201
  process.env.DOTENV_CONFIG_QUIET = "true";
6195
- await Promise.resolve().then(() => (init_main(), exports_main));
6202
+ await Promise.resolve().then(() => (init_main(), {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1sat/cli",
3
- "version": "0.0.130",
3
+ "version": "0.0.131",
4
4
  "description": "CLI for 1Sat Ordinals SDK",
5
5
  "type": "module",
6
6
  "main": "./dist/cli.js",
@@ -27,16 +27,16 @@
27
27
  ],
28
28
  "license": "MIT",
29
29
  "dependencies": {
30
- "@1sat/actions": "0.0.232",
31
- "@1sat/client": "0.0.61",
30
+ "@1sat/actions": "0.0.233",
31
+ "@1sat/client": "0.0.62",
32
32
  "@1sat/types": "0.0.52",
33
- "@1sat/wallet": "0.0.118",
34
- "@1sat/wallet-node": "0.0.85",
35
- "@1sat/wallet-server": "0.0.63",
33
+ "@1sat/wallet": "0.0.119",
34
+ "@1sat/wallet-node": "0.0.86",
35
+ "@1sat/wallet-server": "0.0.64",
36
36
  "@bopen-io/messagebox-server": "^1.3.2",
37
37
  "@bsv/sdk": "^2.6.0",
38
- "@bsv/wallet-toolbox": "npm:@bopen-io/wallet-toolbox@2.14.6",
39
- "@bsv/wallet-toolbox-client": "npm:@bopen-io/wallet-toolbox-client@2.14.6",
38
+ "@bsv/wallet-toolbox": "npm:@bopen-io/wallet-toolbox@2.14.7",
39
+ "@bsv/wallet-toolbox-client": "npm:@bopen-io/wallet-toolbox-client@2.14.7",
40
40
  "@clack/prompts": "^0.8.0",
41
41
  "bitcoin-backup": "^0.0.11",
42
42
  "chalk": "^5.0.0",