@1sat/cli 0.0.46 → 0.0.47

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1sat/cli",
3
- "version": "0.0.46",
3
+ "version": "0.0.47",
4
4
  "description": "CLI for 1Sat Ordinals SDK",
5
5
  "type": "module",
6
6
  "main": "./src/cli.ts",
@@ -25,8 +25,8 @@
25
25
  ],
26
26
  "license": "MIT",
27
27
  "dependencies": {
28
- "@1sat/actions": "0.0.112",
29
- "@1sat/client": "0.0.25",
28
+ "@1sat/actions": "0.0.113",
29
+ "@1sat/client": "0.0.26",
30
30
  "@1sat/types": "0.0.18",
31
31
  "@1sat/wallet-node": "0.0.40",
32
32
  "@1sat/wallet-server": "0.0.10",
@@ -5,6 +5,7 @@
5
5
  import { readFileSync } from 'node:fs'
6
6
  import { basename, extname } from 'node:path'
7
7
  import {
8
+ burnOrdinals,
8
9
  cancelListing,
9
10
  deriveDepositAddresses,
10
11
  getDisplayValue,
@@ -17,7 +18,7 @@ import {
17
18
  import { Utils } from '@bsv/sdk'
18
19
  import { confirm, isCancel } from '@clack/prompts'
19
20
  import type { GlobalFlags } from '../args'
20
- import { extractFlag, hasFlag } from '../args'
21
+ import { extractFlag, extractFlags, hasFlag } from '../args'
21
22
  import { loadContext } from '../context'
22
23
  import { printCommandHelp } from '../help'
23
24
  import { loadKey } from '../keys'
@@ -42,6 +43,8 @@ export async function handleOrdinalsCommand(
42
43
  return ordinalsCancel(rest, opts)
43
44
  case 'buy':
44
45
  return ordinalsBuy(rest, opts)
46
+ case 'burn':
47
+ return ordinalsBurn(rest, opts)
45
48
  default:
46
49
  printCommandHelp('ordinals', {
47
50
  list: 'List owned ordinals/inscriptions',
@@ -50,6 +53,7 @@ export async function handleOrdinalsCommand(
50
53
  sell: 'List an ordinal for sale (--outpoint <op> --price <sats>)',
51
54
  cancel: 'Cancel an ordinal listing (--outpoint <op>)',
52
55
  buy: 'Purchase a listed ordinal (--outpoint <op>)',
56
+ burn: 'Burn ordinals permanently (--outpoints <op1,op2,...>)',
53
57
  })
54
58
  if (subcommand && subcommand !== 'help') {
55
59
  process.exit(1)
@@ -381,3 +385,46 @@ async function ordinalsBuy(args: string[], opts: GlobalFlags): Promise<void> {
381
385
  await destroy()
382
386
  }
383
387
  }
388
+
389
+ async function ordinalsBurn(args: string[], opts: GlobalFlags): Promise<void> {
390
+ const outpoints = extractFlags(args, '--outpoints')
391
+ if (!outpoints.length) {
392
+ fatal('Missing --outpoints <txid.vout[,txid.vout...]>')
393
+ }
394
+
395
+ if (!opts.yes) {
396
+ const ok = await confirm({
397
+ message: `Burn ${outpoints.length} ordinal(s) permanently? This cannot be undone.`,
398
+ })
399
+ if (isCancel(ok) || !ok) {
400
+ fatal('Burn cancelled.')
401
+ }
402
+ }
403
+
404
+ const privateKey = await loadKey()
405
+ const { ctx, destroy } = await loadContext(privateKey, {
406
+ chain: opts.chain,
407
+ })
408
+
409
+ try {
410
+ const ordinalsResult = await getOrdinals.execute(ctx, { limit: 10000 })
411
+ const selected = outpoints.map((op) => {
412
+ const match = ordinalsResult.outputs.find((o) => o.outpoint === op)
413
+ if (!match) fatal(`Ordinal not found in wallet: ${op}`)
414
+ return match
415
+ })
416
+
417
+ const result = await burnOrdinals.execute(ctx, {
418
+ ordinals: selected,
419
+ inputBEEF: ordinalsResult.BEEF as number[] | undefined,
420
+ })
421
+
422
+ if (result.error) {
423
+ fatal(result.error)
424
+ }
425
+
426
+ output(opts.json ? result : { txid: result.txid }, opts)
427
+ } finally {
428
+ await destroy()
429
+ }
430
+ }