@1sat/cli 0.0.14 → 0.0.16

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.14",
3
+ "version": "0.0.16",
4
4
  "description": "CLI for 1Sat Ordinals SDK",
5
5
  "type": "module",
6
6
  "main": "./src/cli.ts",
@@ -16,7 +16,7 @@
16
16
  "keywords": ["1sat", "bsv", "ordinals", "cli"],
17
17
  "license": "MIT",
18
18
  "dependencies": {
19
- "@1sat/actions": "0.0.62",
19
+ "@1sat/actions": "0.0.70",
20
20
  "@1sat/client": "0.0.17",
21
21
  "@1sat/types": "0.0.14",
22
22
  "@1sat/wallet-node": ">=0.0.13",
@@ -174,13 +174,28 @@ export async function handleMcpProxyCommand(): Promise<void> {
174
174
  reqLog.emit()
175
175
 
176
176
  if (contentType.includes('text/event-stream')) {
177
- const text = await res.text()
178
- for (const eventLine of text.split('\n')) {
179
- if (eventLine.startsWith('data: ')) {
180
- const data = eventLine.slice(6).trim()
181
- if (data) process.stdout.write(`${data}\n`)
177
+ // Stream SSE events incrementally — res.text() would hang
178
+ // because SSE connections stay open indefinitely
179
+ const sseReader = res.body!.getReader()
180
+ const sseDecoder = new TextDecoder()
181
+ let sseBuf = ''
182
+ while (true) {
183
+ const { done: sseDone, value: sseValue } = await sseReader.read()
184
+ if (sseDone) break
185
+ sseBuf += sseDecoder.decode(sseValue, { stream: true })
186
+ const sseLines = sseBuf.split('\n')
187
+ sseBuf = sseLines.pop()!
188
+ for (const sseLine of sseLines) {
189
+ if (sseLine.startsWith('data: ')) {
190
+ const data = sseLine.slice(6).trim()
191
+ if (data) process.stdout.write(`${data}\n`)
192
+ }
182
193
  }
183
194
  }
195
+ if (sseBuf.startsWith('data: ')) {
196
+ const data = sseBuf.slice(6).trim()
197
+ if (data) process.stdout.write(`${data}\n`)
198
+ }
184
199
  } else {
185
200
  const body = await res.text()
186
201
  if (body.trim()) process.stdout.write(`${body.trim()}\n`)
@@ -106,11 +106,29 @@ async function sweepScan(args: string[], opts: GlobalFlags): Promise<void> {
106
106
  }
107
107
  }
108
108
 
109
+ console.log(
110
+ `\n ${formatLabel('RUN Tokens:')} ${result.run.length}`,
111
+ )
112
+ if (result.run.length > 0) {
113
+ const runSats = result.run.reduce((sum, r) => sum + r.satoshis, 0)
114
+ console.log(
115
+ ` ${formatLabel('Total locked:')} ${formatValue(runSats)} satoshis (not sweepable)`,
116
+ )
117
+ for (const r of result.run) {
118
+ console.log(
119
+ ` ${formatValue(r.outpoint)} ${formatLabel(`${r.satoshis} sats`)}`,
120
+ )
121
+ }
122
+ }
123
+
109
124
  const total =
110
125
  result.funding.length +
111
126
  result.ordinals.length +
112
127
  result.bsv21Tokens.reduce((n, t) => n + t.inputs.length, 0)
113
- console.log(`\n ${total} total UTXO(s) found.`)
128
+ console.log(`\n ${total} sweepable UTXO(s) found.`)
129
+ if (result.run.length > 0) {
130
+ console.log(` ${result.run.length} RUN token output(s) excluded.`)
131
+ }
114
132
  } finally {
115
133
  await destroy()
116
134
  }
@@ -147,6 +165,9 @@ async function sweepImport(args: string[], opts: GlobalFlags): Promise<void> {
147
165
  const hasTokens = scan.bsv21Tokens.length > 0
148
166
 
149
167
  if (!hasFunding && !hasOrdinals && !hasTokens) {
168
+ if (scan.run.length > 0) {
169
+ fatal(`No sweepable UTXOs found at ${address} (${scan.run.length} RUN token output(s) excluded)`)
170
+ }
150
171
  fatal(`No UTXOs found at ${address}`)
151
172
  }
152
173
 
@@ -162,6 +183,9 @@ async function sweepImport(args: string[], opts: GlobalFlags): Promise<void> {
162
183
  )
163
184
  }
164
185
  }
186
+ if (scan.run.length > 0) {
187
+ parts.push(`${scan.run.length} RUN token output(s) excluded`)
188
+ }
165
189
 
166
190
  if (!opts.yes) {
167
191
  const ok = await confirm({