@1sat/cli 0.0.112 → 0.0.114

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/dist/cli.js CHANGED
@@ -1,15 +1,7 @@
1
1
  #!/usr/bin/env node
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
- };
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);
13
5
 
14
6
  // src/args.ts
15
7
  function parseGlobalFlags(args) {
@@ -513,11 +505,11 @@ async function handleActionCommand(args, opts) {
513
505
  Registered actions:
514
506
  `);
515
507
  const grouped = new Map;
516
- for (const action of actions) {
517
- const cat = action.meta.category;
508
+ for (const action2 of actions) {
509
+ const cat = action2.meta.category;
518
510
  if (!grouped.has(cat))
519
511
  grouped.set(cat, []);
520
- grouped.get(cat).push(action);
512
+ grouped.get(cat).push(action2);
521
513
  }
522
514
  for (const [category, categoryActions] of grouped) {
523
515
  console.log(` ${category}:`);
@@ -549,6 +541,9 @@ Run '1sat action' to list available actions.`);
549
541
  try {
550
542
  const result = await action.execute(ctx, input);
551
543
  output(result, opts);
544
+ if (actionName === "cancelOwnedListings" && result !== null && typeof result === "object" && "errors" in result && Array.isArray(result.errors) && result.errors.length > 0) {
545
+ process.exitCode = 1;
546
+ }
552
547
  } finally {
553
548
  await destroy();
554
549
  }
@@ -1441,7 +1436,7 @@ function createApprovalAuth(wallet) {
1441
1436
  get(target, property) {
1442
1437
  if (property === "createAction")
1443
1438
  return async (...args) => {
1444
- const satoshis = args[0].outputs?.reduce((sum, output) => sum + output.satoshis, 0) ?? 0;
1439
+ const satoshis = args[0].outputs?.reduce((sum, output2) => sum + output2.satoshis, 0) ?? 0;
1445
1440
  if (!Number.isSafeInteger(satoshis) || satoshis <= 0)
1446
1441
  throw new Error("Invalid HTTP payment amount");
1447
1442
  if (approved === false)
@@ -1965,15 +1960,15 @@ async function handleInitCommand(_args, opts) {
1965
1960
  }
1966
1961
  let wif;
1967
1962
  if (keySource === "generate") {
1968
- const pk = PrivateKey2.fromRandom();
1969
- wif = pk.toWif();
1970
- const address = pk.toPublicKey().toAddress();
1963
+ const pk2 = PrivateKey2.fromRandom();
1964
+ wif = pk2.toWif();
1965
+ const address2 = pk2.toPublicKey().toAddress();
1971
1966
  console.log();
1972
1967
  console.log(formatWarning(" IMPORTANT: Back up your private key!"));
1973
1968
  console.log(formatWarning(" If you lose it, your funds are gone forever."));
1974
1969
  console.log();
1975
1970
  console.log(` ${formatValue("WIF:")} ${wif}`);
1976
- console.log(` ${formatValue("Address:")} ${address}`);
1971
+ console.log(` ${formatValue("Address:")} ${address2}`);
1977
1972
  console.log();
1978
1973
  const confirmed = await confirm2({
1979
1974
  message: "Have you saved your private key somewhere safe?"
@@ -3699,7 +3694,7 @@ async function startWalletServer(resolved, walletResult, accounts, mode) {
3699
3694
  ttlSeconds: sessionStoreCfg.ttlSeconds
3700
3695
  } : undefined;
3701
3696
  if (mode === "wallet") {
3702
- const handle = createWalletServer({
3697
+ const handle2 = createWalletServer({
3703
3698
  wallet: walletResult.wallet,
3704
3699
  storage: walletResult.getActiveStorage(),
3705
3700
  serverIdentityKey: walletResult.wallet.identityKey,
@@ -3709,10 +3704,10 @@ async function startWalletServer(resolved, walletResult, accounts, mode) {
3709
3704
  accounts: accounts?.walletServerAccounts,
3710
3705
  sessionStore
3711
3706
  });
3712
- const port = await handle.start();
3713
- const notes = [resolved.accounts.enabled ? "accounts: on" : ""].filter(Boolean).join(", ");
3714
- console.log(`[wallet] listening on ${resolved.host}:${port}${notes ? ` (${notes})` : ""}`);
3715
- return { stop: () => handle.stop() };
3707
+ const port2 = await handle2.start();
3708
+ const notes2 = [resolved.accounts.enabled ? "accounts: on" : ""].filter(Boolean).join(", ");
3709
+ console.log(`[wallet] listening on ${resolved.host}:${port2}${notes2 ? ` (${notes2})` : ""}`);
3710
+ return { stop: () => handle2.stop() };
3716
3711
  }
3717
3712
  const serverCfg = config.server ?? {};
3718
3713
  const paymailCfg = serverCfg.paymail;
@@ -4885,8 +4880,8 @@ async function walletListOutputs(args, opts) {
4885
4880
  ${result.totalOutputs} total outputs in basket '${basket}':
4886
4881
  `);
4887
4882
  for (const out of result.outputs) {
4888
- const tags = out.tags?.join(", ") || "none";
4889
- console.log(` ${out.outpoint} | ${out.satoshis} sats | tags: ${tags}`);
4883
+ const tags2 = out.tags?.join(", ") || "none";
4884
+ console.log(` ${out.outpoint} | ${out.satoshis} sats | tags: ${tags2}`);
4890
4885
  }
4891
4886
  console.log();
4892
4887
  }
@@ -5144,6 +5139,7 @@ var init_wallet = __esm(() => {
5144
5139
  });
5145
5140
 
5146
5141
  // src/main.ts
5142
+ var exports_main = {};
5147
5143
  import { existsSync as existsSync4 } from "node:fs";
5148
5144
  import { resolve } from "node:path";
5149
5145
  import { config as loadEnv } from "dotenv";
@@ -5283,4 +5279,4 @@ var init_main = __esm(() => {
5283
5279
 
5284
5280
  // src/cli.ts
5285
5281
  process.env.DOTENV_CONFIG_QUIET = "true";
5286
- await Promise.resolve().then(() => (init_main(), {}));
5282
+ await Promise.resolve().then(() => (init_main(), exports_main));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1sat/cli",
3
- "version": "0.0.112",
3
+ "version": "0.0.114",
4
4
  "description": "CLI for 1Sat Ordinals SDK",
5
5
  "type": "module",
6
6
  "main": "./dist/cli.js",
@@ -27,20 +27,20 @@
27
27
  ],
28
28
  "license": "MIT",
29
29
  "dependencies": {
30
- "@1sat/actions": "0.0.211",
31
- "@1sat/client": "0.0.51",
32
- "@1sat/types": "0.0.43",
33
- "@1sat/wallet-node": "0.0.73",
34
- "@1sat/wallet-server": "0.0.49",
35
- "@bsv/sdk": "^2.1.9",
30
+ "@1sat/actions": "0.0.216",
31
+ "@1sat/client": "0.0.53",
32
+ "@1sat/types": "0.0.45",
33
+ "@1sat/wallet-node": "0.0.75",
34
+ "@1sat/wallet-server": "0.0.51",
35
+ "@bopen-io/messagebox-server": "^1.3.2",
36
+ "@bsv/sdk": "^2.6.0",
36
37
  "@bsv/wallet-toolbox": "npm:@bopen-io/wallet-toolbox@2.6.2-brc153.5",
37
- "chalk": "^5.0.0",
38
38
  "@clack/prompts": "^0.8.0",
39
39
  "bitcoin-backup": "^0.0.11",
40
+ "chalk": "^5.0.0",
40
41
  "dotenv": "^17.0.0",
41
42
  "evlog": "^2.10.0",
42
43
  "knex": "^3.1.0",
43
- "@bopen-io/messagebox-server": "^1.3.2",
44
44
  "pg": "^8.11.3",
45
45
  "sqlite3": "^6.0.1"
46
46
  },
@@ -73,6 +73,16 @@ export async function handleActionCommand(
73
73
  try {
74
74
  const result = await action.execute(ctx, input)
75
75
  output(result, opts)
76
+ if (
77
+ actionName === 'cancelOwnedListings' &&
78
+ result !== null &&
79
+ typeof result === 'object' &&
80
+ 'errors' in result &&
81
+ Array.isArray(result.errors) &&
82
+ result.errors.length > 0
83
+ ) {
84
+ process.exitCode = 1
85
+ }
76
86
  } finally {
77
87
  await destroy()
78
88
  }