@1sat/cli 0.0.113 → 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
@@ -1043,8 +1043,6 @@ var init_help = __esm(() => {
1043
1043
  {
1044
1044
  name: "sell",
1045
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.",
1048
1046
  args: [
1049
1047
  { flag: "--id", values: "<tracking-id>", required: true },
1050
1048
  { flag: "--price", values: "<sats>", required: true },
@@ -1257,8 +1255,6 @@ var init_help = __esm(() => {
1257
1255
  {
1258
1256
  name: "sell",
1259
1257
  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.",
1262
1258
  args: [
1263
1259
  { flag: "--id", values: "<tracking-id>", required: true },
1264
1260
  { flag: "--price", values: "<satoshis>", required: true },
@@ -2441,9 +2437,10 @@ import {
2441
2437
  internalizeOpns,
2442
2438
  listOpns,
2443
2439
  registerOpns,
2440
+ sellOpns,
2444
2441
  sendOpns
2445
2442
  } from "@1sat/actions";
2446
- import { ORDLOCK_LISTING_CREATE_DISABLED, P1SAT_PROTOCOL } from "@1sat/types";
2443
+ import { P1SAT_PROTOCOL } from "@1sat/types";
2447
2444
  import { confirm as confirm4, isCancel as isCancel5 } from "@clack/prompts";
2448
2445
  async function handleOpnsCommand(args, opts) {
2449
2446
  const [subcommand, ...rest] = args;
@@ -2580,8 +2577,37 @@ async function opnsCancelListingCmd(args, opts) {
2580
2577
  await destroy();
2581
2578
  }
2582
2579
  }
2583
- async function opnsSell(_args, _opts) {
2584
- fatal(ORDLOCK_LISTING_CREATE_DISABLED);
2580
+ async function opnsSell(args, opts) {
2581
+ const id = requireId(args);
2582
+ const priceStr = extractFlag(args, "--price");
2583
+ const payAddress = extractFlag(args, "--pay-address");
2584
+ if (!priceStr)
2585
+ fatal("Missing --price <satoshis>");
2586
+ const price = Number(priceStr);
2587
+ if (!Number.isFinite(price) || price <= 0) {
2588
+ fatal("--price must be a positive number");
2589
+ }
2590
+ if (!opts.yes) {
2591
+ const ok = await confirm4({
2592
+ message: `List OpNS id ${id} for sale at ${price} satoshis?`
2593
+ });
2594
+ if (isCancel5(ok) || !ok)
2595
+ fatal("Listing cancelled.");
2596
+ }
2597
+ const privateKey = await loadKey();
2598
+ const { ctx, destroy } = await loadContext(privateKey, { chain: opts.chain });
2599
+ try {
2600
+ const result = await sellOpns.execute(ctx, {
2601
+ id,
2602
+ price,
2603
+ ...payAddress && { payAddress }
2604
+ });
2605
+ if (result.error)
2606
+ fatal(result.error);
2607
+ output(opts.json ? result : { txid: result.txid }, opts);
2608
+ } finally {
2609
+ await destroy();
2610
+ }
2585
2611
  }
2586
2612
  async function opnsSend(args, opts) {
2587
2613
  const id = requireId(args);
@@ -2682,9 +2708,9 @@ import {
2682
2708
  getDisplayValue as getDisplayValue2,
2683
2709
  inscribe,
2684
2710
  listOrdinals,
2711
+ sellOrdinal,
2685
2712
  sendOrdinals
2686
2713
  } from "@1sat/actions";
2687
- import { ORDLOCK_LISTING_CREATE_DISABLED as ORDLOCK_LISTING_CREATE_DISABLED2 } from "@1sat/types";
2688
2714
  import { Utils as Utils3 } from "@bsv/sdk";
2689
2715
  import { confirm as confirm5, isCancel as isCancel6 } from "@clack/prompts";
2690
2716
  async function handleOrdinalsCommand(args, opts) {
@@ -2847,8 +2873,37 @@ async function ordinalsSend(args, opts) {
2847
2873
  await destroy();
2848
2874
  }
2849
2875
  }
2850
- async function ordinalsSell(_args, _opts) {
2851
- fatal(ORDLOCK_LISTING_CREATE_DISABLED2);
2876
+ async function ordinalsSell(args, opts) {
2877
+ const id = requireId2(args);
2878
+ const priceStr = extractFlag(args, "--price");
2879
+ const payAddress = extractFlag(args, "--pay-address");
2880
+ if (!priceStr)
2881
+ fatal("Missing --price <satoshis>");
2882
+ const price = Number(priceStr);
2883
+ if (!Number.isFinite(price) || price <= 0) {
2884
+ fatal("--price must be a positive number");
2885
+ }
2886
+ if (!opts.yes) {
2887
+ const ok = await confirm5({
2888
+ message: `List ordinal id ${id} for sale at ${price} satoshis?`
2889
+ });
2890
+ if (isCancel6(ok) || !ok)
2891
+ fatal("Listing cancelled.");
2892
+ }
2893
+ const privateKey = await loadKey();
2894
+ const { ctx, destroy } = await loadContext(privateKey, { chain: opts.chain });
2895
+ try {
2896
+ const result = await sellOrdinal.execute(ctx, {
2897
+ id,
2898
+ price,
2899
+ ...payAddress && { payAddress }
2900
+ });
2901
+ if (result.error)
2902
+ fatal(result.error);
2903
+ output(opts.json ? result : { txid: result.txid }, opts);
2904
+ } finally {
2905
+ await destroy();
2906
+ }
2852
2907
  }
2853
2908
  async function ordinalsCancel(args, opts) {
2854
2909
  const id = requireId2(args);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1sat/cli",
3
- "version": "0.0.113",
3
+ "version": "0.0.114",
4
4
  "description": "CLI for 1Sat Ordinals SDK",
5
5
  "type": "module",
6
6
  "main": "./dist/cli.js",
@@ -27,13 +27,13 @@
27
27
  ],
28
28
  "license": "MIT",
29
29
  "dependencies": {
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",
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
35
  "@bopen-io/messagebox-server": "^1.3.2",
36
- "@bsv/sdk": "^2.5.0",
36
+ "@bsv/sdk": "^2.6.0",
37
37
  "@bsv/wallet-toolbox": "npm:@bopen-io/wallet-toolbox@2.6.2-brc153.5",
38
38
  "@clack/prompts": "^0.8.0",
39
39
  "bitcoin-backup": "^0.0.11",
@@ -10,9 +10,10 @@ import {
10
10
  internalizeOpns,
11
11
  listOpns,
12
12
  registerOpns,
13
+ sellOpns,
13
14
  sendOpns,
14
15
  } from '@1sat/actions'
15
- import { ORDLOCK_LISTING_CREATE_DISABLED, P1SAT_PROTOCOL } from '@1sat/types'
16
+ import { P1SAT_PROTOCOL } from '@1sat/types'
16
17
  import { confirm, isCancel } from '@clack/prompts'
17
18
  import type { GlobalFlags } from '../args.js'
18
19
  import { extractFlag } from '../args.js'
@@ -193,8 +194,38 @@ async function opnsCancelListingCmd(
193
194
  }
194
195
  }
195
196
 
196
- async function opnsSell(_args: string[], _opts: GlobalFlags): Promise<void> {
197
- fatal(ORDLOCK_LISTING_CREATE_DISABLED)
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
+ }
198
229
  }
199
230
 
200
231
  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,
14
15
  sendOrdinals,
15
16
  } 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,11 +245,38 @@ async function ordinalsSend(args: string[], opts: GlobalFlags): Promise<void> {
245
245
  }
246
246
  }
247
247
 
248
- async function ordinalsSell(
249
- _args: string[],
250
- _opts: GlobalFlags,
251
- ): Promise<void> {
252
- fatal(ORDLOCK_LISTING_CREATE_DISABLED)
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
+ }
253
280
  }
254
281
 
255
282
  async function ordinalsCancel(
package/src/help.ts CHANGED
@@ -393,9 +393,6 @@ 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.',
399
396
  args: [
400
397
  { flag: '--id', values: '<tracking-id>', required: true },
401
398
  { flag: '--price', values: '<sats>', required: true },
@@ -620,9 +617,6 @@ export const COMMANDS: CommandSpec[] = [
620
617
  {
621
618
  name: 'sell',
622
619
  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.',
626
620
  args: [
627
621
  { flag: '--id', values: '<tracking-id>', required: true },
628
622
  { flag: '--price', values: '<satoshis>', required: true },