@1sat/cli 0.0.112 → 0.0.113

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
  }
@@ -1048,6 +1043,8 @@ var init_help = __esm(() => {
1048
1043
  {
1049
1044
  name: "sell",
1050
1045
  description: "List an ordinal for sale (OrdLock)",
1046
+ unavailable: true,
1047
+ notes: "OrdLock listing create is disabled. Buy and cancel of existing listings remain available.",
1051
1048
  args: [
1052
1049
  { flag: "--id", values: "<tracking-id>", required: true },
1053
1050
  { flag: "--price", values: "<sats>", required: true },
@@ -1260,6 +1257,8 @@ var init_help = __esm(() => {
1260
1257
  {
1261
1258
  name: "sell",
1262
1259
  description: "List an OpNS name for sale",
1260
+ unavailable: true,
1261
+ notes: "OrdLock listing create is disabled. Buy and cancel of existing listings remain available.",
1263
1262
  args: [
1264
1263
  { flag: "--id", values: "<tracking-id>", required: true },
1265
1264
  { flag: "--price", values: "<satoshis>", required: true },
@@ -1441,7 +1440,7 @@ function createApprovalAuth(wallet) {
1441
1440
  get(target, property) {
1442
1441
  if (property === "createAction")
1443
1442
  return async (...args) => {
1444
- const satoshis = args[0].outputs?.reduce((sum, output) => sum + output.satoshis, 0) ?? 0;
1443
+ const satoshis = args[0].outputs?.reduce((sum, output2) => sum + output2.satoshis, 0) ?? 0;
1445
1444
  if (!Number.isSafeInteger(satoshis) || satoshis <= 0)
1446
1445
  throw new Error("Invalid HTTP payment amount");
1447
1446
  if (approved === false)
@@ -1965,15 +1964,15 @@ async function handleInitCommand(_args, opts) {
1965
1964
  }
1966
1965
  let wif;
1967
1966
  if (keySource === "generate") {
1968
- const pk = PrivateKey2.fromRandom();
1969
- wif = pk.toWif();
1970
- const address = pk.toPublicKey().toAddress();
1967
+ const pk2 = PrivateKey2.fromRandom();
1968
+ wif = pk2.toWif();
1969
+ const address2 = pk2.toPublicKey().toAddress();
1971
1970
  console.log();
1972
1971
  console.log(formatWarning(" IMPORTANT: Back up your private key!"));
1973
1972
  console.log(formatWarning(" If you lose it, your funds are gone forever."));
1974
1973
  console.log();
1975
1974
  console.log(` ${formatValue("WIF:")} ${wif}`);
1976
- console.log(` ${formatValue("Address:")} ${address}`);
1975
+ console.log(` ${formatValue("Address:")} ${address2}`);
1977
1976
  console.log();
1978
1977
  const confirmed = await confirm2({
1979
1978
  message: "Have you saved your private key somewhere safe?"
@@ -2442,10 +2441,9 @@ import {
2442
2441
  internalizeOpns,
2443
2442
  listOpns,
2444
2443
  registerOpns,
2445
- sellOpns,
2446
2444
  sendOpns
2447
2445
  } from "@1sat/actions";
2448
- import { P1SAT_PROTOCOL } from "@1sat/types";
2446
+ import { ORDLOCK_LISTING_CREATE_DISABLED, P1SAT_PROTOCOL } from "@1sat/types";
2449
2447
  import { confirm as confirm4, isCancel as isCancel5 } from "@clack/prompts";
2450
2448
  async function handleOpnsCommand(args, opts) {
2451
2449
  const [subcommand, ...rest] = args;
@@ -2582,37 +2580,8 @@ async function opnsCancelListingCmd(args, opts) {
2582
2580
  await destroy();
2583
2581
  }
2584
2582
  }
2585
- async function opnsSell(args, opts) {
2586
- const id = requireId(args);
2587
- const priceStr = extractFlag(args, "--price");
2588
- const payAddress = extractFlag(args, "--pay-address");
2589
- if (!priceStr)
2590
- fatal("Missing --price <satoshis>");
2591
- const price = Number(priceStr);
2592
- if (!Number.isFinite(price) || price <= 0) {
2593
- fatal("--price must be a positive number");
2594
- }
2595
- if (!opts.yes) {
2596
- const ok = await confirm4({
2597
- message: `List OpNS id ${id} for sale at ${price} satoshis?`
2598
- });
2599
- if (isCancel5(ok) || !ok)
2600
- fatal("Listing cancelled.");
2601
- }
2602
- const privateKey = await loadKey();
2603
- const { ctx, destroy } = await loadContext(privateKey, { chain: opts.chain });
2604
- try {
2605
- const result = await sellOpns.execute(ctx, {
2606
- id,
2607
- price,
2608
- ...payAddress && { payAddress }
2609
- });
2610
- if (result.error)
2611
- fatal(result.error);
2612
- output(opts.json ? result : { txid: result.txid }, opts);
2613
- } finally {
2614
- await destroy();
2615
- }
2583
+ async function opnsSell(_args, _opts) {
2584
+ fatal(ORDLOCK_LISTING_CREATE_DISABLED);
2616
2585
  }
2617
2586
  async function opnsSend(args, opts) {
2618
2587
  const id = requireId(args);
@@ -2713,9 +2682,9 @@ import {
2713
2682
  getDisplayValue as getDisplayValue2,
2714
2683
  inscribe,
2715
2684
  listOrdinals,
2716
- sellOrdinal,
2717
2685
  sendOrdinals
2718
2686
  } from "@1sat/actions";
2687
+ import { ORDLOCK_LISTING_CREATE_DISABLED as ORDLOCK_LISTING_CREATE_DISABLED2 } from "@1sat/types";
2719
2688
  import { Utils as Utils3 } from "@bsv/sdk";
2720
2689
  import { confirm as confirm5, isCancel as isCancel6 } from "@clack/prompts";
2721
2690
  async function handleOrdinalsCommand(args, opts) {
@@ -2878,37 +2847,8 @@ async function ordinalsSend(args, opts) {
2878
2847
  await destroy();
2879
2848
  }
2880
2849
  }
2881
- async function ordinalsSell(args, opts) {
2882
- const id = requireId2(args);
2883
- const priceStr = extractFlag(args, "--price");
2884
- const payAddress = extractFlag(args, "--pay-address");
2885
- if (!priceStr)
2886
- fatal("Missing --price <satoshis>");
2887
- const price = Number(priceStr);
2888
- if (!Number.isFinite(price) || price <= 0) {
2889
- fatal("--price must be a positive number");
2890
- }
2891
- if (!opts.yes) {
2892
- const ok = await confirm5({
2893
- message: `List ordinal id ${id} for sale at ${price} satoshis?`
2894
- });
2895
- if (isCancel6(ok) || !ok)
2896
- fatal("Listing cancelled.");
2897
- }
2898
- const privateKey = await loadKey();
2899
- const { ctx, destroy } = await loadContext(privateKey, { chain: opts.chain });
2900
- try {
2901
- const result = await sellOrdinal.execute(ctx, {
2902
- id,
2903
- price,
2904
- ...payAddress && { payAddress }
2905
- });
2906
- if (result.error)
2907
- fatal(result.error);
2908
- output(opts.json ? result : { txid: result.txid }, opts);
2909
- } finally {
2910
- await destroy();
2911
- }
2850
+ async function ordinalsSell(_args, _opts) {
2851
+ fatal(ORDLOCK_LISTING_CREATE_DISABLED2);
2912
2852
  }
2913
2853
  async function ordinalsCancel(args, opts) {
2914
2854
  const id = requireId2(args);
@@ -3699,7 +3639,7 @@ async function startWalletServer(resolved, walletResult, accounts, mode) {
3699
3639
  ttlSeconds: sessionStoreCfg.ttlSeconds
3700
3640
  } : undefined;
3701
3641
  if (mode === "wallet") {
3702
- const handle = createWalletServer({
3642
+ const handle2 = createWalletServer({
3703
3643
  wallet: walletResult.wallet,
3704
3644
  storage: walletResult.getActiveStorage(),
3705
3645
  serverIdentityKey: walletResult.wallet.identityKey,
@@ -3709,10 +3649,10 @@ async function startWalletServer(resolved, walletResult, accounts, mode) {
3709
3649
  accounts: accounts?.walletServerAccounts,
3710
3650
  sessionStore
3711
3651
  });
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() };
3652
+ const port2 = await handle2.start();
3653
+ const notes2 = [resolved.accounts.enabled ? "accounts: on" : ""].filter(Boolean).join(", ");
3654
+ console.log(`[wallet] listening on ${resolved.host}:${port2}${notes2 ? ` (${notes2})` : ""}`);
3655
+ return { stop: () => handle2.stop() };
3716
3656
  }
3717
3657
  const serverCfg = config.server ?? {};
3718
3658
  const paymailCfg = serverCfg.paymail;
@@ -4885,8 +4825,8 @@ async function walletListOutputs(args, opts) {
4885
4825
  ${result.totalOutputs} total outputs in basket '${basket}':
4886
4826
  `);
4887
4827
  for (const out of result.outputs) {
4888
- const tags = out.tags?.join(", ") || "none";
4889
- console.log(` ${out.outpoint} | ${out.satoshis} sats | tags: ${tags}`);
4828
+ const tags2 = out.tags?.join(", ") || "none";
4829
+ console.log(` ${out.outpoint} | ${out.satoshis} sats | tags: ${tags2}`);
4890
4830
  }
4891
4831
  console.log();
4892
4832
  }
@@ -5144,6 +5084,7 @@ var init_wallet = __esm(() => {
5144
5084
  });
5145
5085
 
5146
5086
  // src/main.ts
5087
+ var exports_main = {};
5147
5088
  import { existsSync as existsSync4 } from "node:fs";
5148
5089
  import { resolve } from "node:path";
5149
5090
  import { config as loadEnv } from "dotenv";
@@ -5283,4 +5224,4 @@ var init_main = __esm(() => {
5283
5224
 
5284
5225
  // src/cli.ts
5285
5226
  process.env.DOTENV_CONFIG_QUIET = "true";
5286
- await Promise.resolve().then(() => (init_main(), {}));
5227
+ 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.113",
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.214",
31
+ "@1sat/client": "0.0.52",
32
+ "@1sat/types": "0.0.44",
33
+ "@1sat/wallet-node": "0.0.74",
34
+ "@1sat/wallet-server": "0.0.50",
35
+ "@bopen-io/messagebox-server": "^1.3.2",
36
+ "@bsv/sdk": "^2.5.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
  }
@@ -10,10 +10,9 @@ import {
10
10
  internalizeOpns,
11
11
  listOpns,
12
12
  registerOpns,
13
- sellOpns,
14
13
  sendOpns,
15
14
  } from '@1sat/actions'
16
- import { P1SAT_PROTOCOL } from '@1sat/types'
15
+ import { ORDLOCK_LISTING_CREATE_DISABLED, P1SAT_PROTOCOL } from '@1sat/types'
17
16
  import { confirm, isCancel } from '@clack/prompts'
18
17
  import type { GlobalFlags } from '../args.js'
19
18
  import { extractFlag } from '../args.js'
@@ -194,38 +193,8 @@ async function opnsCancelListingCmd(
194
193
  }
195
194
  }
196
195
 
197
- async function opnsSell(args: string[], opts: GlobalFlags): Promise<void> {
198
- const id = requireId(args)
199
- const priceStr = extractFlag(args, '--price')
200
- const payAddress = extractFlag(args, '--pay-address')
201
-
202
- if (!priceStr) fatal('Missing --price <satoshis>')
203
- const price = Number(priceStr)
204
- if (!Number.isFinite(price) || price <= 0) {
205
- fatal('--price must be a positive number')
206
- }
207
-
208
- if (!opts.yes) {
209
- const ok = await confirm({
210
- message: `List OpNS id ${id} for sale at ${price} satoshis?`,
211
- })
212
- if (isCancel(ok) || !ok) fatal('Listing cancelled.')
213
- }
214
-
215
- const privateKey = await loadKey()
216
- const { ctx, destroy } = await loadContext(privateKey, { chain: opts.chain })
217
-
218
- try {
219
- const result = await sellOpns.execute(ctx, {
220
- id,
221
- price,
222
- ...(payAddress && { payAddress }),
223
- })
224
- if (result.error) fatal(result.error)
225
- output(opts.json ? result : { txid: result.txid }, opts)
226
- } finally {
227
- await destroy()
228
- }
196
+ async function opnsSell(_args: string[], _opts: GlobalFlags): Promise<void> {
197
+ fatal(ORDLOCK_LISTING_CREATE_DISABLED)
229
198
  }
230
199
 
231
200
  async function opnsSend(args: string[], opts: GlobalFlags): Promise<void> {
@@ -11,9 +11,9 @@ import {
11
11
  getDisplayValue,
12
12
  inscribe,
13
13
  listOrdinals,
14
- sellOrdinal,
15
14
  sendOrdinals,
16
15
  } from '@1sat/actions'
16
+ import { ORDLOCK_LISTING_CREATE_DISABLED } from '@1sat/types'
17
17
  import { Utils } from '@bsv/sdk'
18
18
  import { confirm, isCancel } from '@clack/prompts'
19
19
  import type { GlobalFlags } from '../args.js'
@@ -245,38 +245,11 @@ async function ordinalsSend(args: string[], opts: GlobalFlags): Promise<void> {
245
245
  }
246
246
  }
247
247
 
248
- async function ordinalsSell(args: string[], opts: GlobalFlags): Promise<void> {
249
- const id = requireId(args)
250
- const priceStr = extractFlag(args, '--price')
251
- const payAddress = extractFlag(args, '--pay-address')
252
-
253
- if (!priceStr) fatal('Missing --price <satoshis>')
254
- const price = Number(priceStr)
255
- if (!Number.isFinite(price) || price <= 0) {
256
- fatal('--price must be a positive number')
257
- }
258
-
259
- if (!opts.yes) {
260
- const ok = await confirm({
261
- message: `List ordinal id ${id} for sale at ${price} satoshis?`,
262
- })
263
- if (isCancel(ok) || !ok) fatal('Listing cancelled.')
264
- }
265
-
266
- const privateKey = await loadKey()
267
- const { ctx, destroy } = await loadContext(privateKey, { chain: opts.chain })
268
-
269
- try {
270
- const result = await sellOrdinal.execute(ctx, {
271
- id,
272
- price,
273
- ...(payAddress && { payAddress }),
274
- })
275
- if (result.error) fatal(result.error)
276
- output(opts.json ? result : { txid: result.txid }, opts)
277
- } finally {
278
- await destroy()
279
- }
248
+ async function ordinalsSell(
249
+ _args: string[],
250
+ _opts: GlobalFlags,
251
+ ): Promise<void> {
252
+ fatal(ORDLOCK_LISTING_CREATE_DISABLED)
280
253
  }
281
254
 
282
255
  async function ordinalsCancel(
package/src/help.ts CHANGED
@@ -393,6 +393,9 @@ export const COMMANDS: CommandSpec[] = [
393
393
  {
394
394
  name: 'sell',
395
395
  description: 'List an ordinal for sale (OrdLock)',
396
+ unavailable: true,
397
+ notes:
398
+ 'OrdLock listing create is disabled. Buy and cancel of existing listings remain available.',
396
399
  args: [
397
400
  { flag: '--id', values: '<tracking-id>', required: true },
398
401
  { flag: '--price', values: '<sats>', required: true },
@@ -617,6 +620,9 @@ export const COMMANDS: CommandSpec[] = [
617
620
  {
618
621
  name: 'sell',
619
622
  description: 'List an OpNS name for sale',
623
+ unavailable: true,
624
+ notes:
625
+ 'OrdLock listing create is disabled. Buy and cancel of existing listings remain available.',
620
626
  args: [
621
627
  { flag: '--id', values: '<tracking-id>', required: true },
622
628
  { flag: '--price', values: '<satoshis>', required: true },