@1sat/cli 0.0.104 → 0.0.106

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
@@ -3940,9 +3940,10 @@ async function sweepImport(args, opts) {
3940
3940
  if (!wif)
3941
3941
  fatal("Missing --wif <private-key>");
3942
3942
  let address;
3943
+ let sweepKey;
3943
3944
  try {
3944
- const pk = PrivateKey4.fromWif(wif);
3945
- address = pk.toPublicKey().toAddress();
3945
+ sweepKey = PrivateKey4.fromWif(wif);
3946
+ address = sweepKey.toPublicKey().toAddress();
3946
3947
  } catch {
3947
3948
  fatal("Invalid WIF private key");
3948
3949
  }
@@ -3990,7 +3991,8 @@ async function sweepImport(args, opts) {
3990
3991
  const txids = [];
3991
3992
  if (hasFunding) {
3992
3993
  const inputs = await prepareSweepInputs(ctx, scan.funding);
3993
- const result = await sweepBsv.execute(ctx, { inputs, wif });
3994
+ const keys = inputs.map(() => sweepKey);
3995
+ const result = await sweepBsv.execute(ctx, { inputs, keys });
3994
3996
  if (result.error) {
3995
3997
  fatal(`BSV sweep failed: ${result.error}`);
3996
3998
  }
@@ -3999,7 +4001,8 @@ async function sweepImport(args, opts) {
3999
4001
  }
4000
4002
  if (hasOrdinals) {
4001
4003
  const inputs = await prepareSweepInputs(ctx, scan.ordinals);
4002
- const result = await sweepOrdinals.execute(ctx, { inputs, wif });
4004
+ const keys = inputs.map(() => sweepKey);
4005
+ const result = await sweepOrdinals.execute(ctx, { inputs, keys });
4003
4006
  if (result.error) {
4004
4007
  fatal(`Ordinals sweep failed: ${result.error}`);
4005
4008
  }
@@ -4010,12 +4013,14 @@ async function sweepImport(args, opts) {
4010
4013
  for (const token of scan.bsv21Tokens) {
4011
4014
  if (!token.isActive || token.outputs.length === 0)
4012
4015
  continue;
4013
- const inputs = token.outputs.map((out) => ({
4014
- outpoint: out.outpoint,
4016
+ const base = await prepareSweepInputs(ctx, token.outputs);
4017
+ const inputs = base.map((b) => ({
4018
+ ...b,
4015
4019
  tokenId: token.tokenId,
4016
- amount: token.amounts.get(out.outpoint) ?? "0"
4020
+ amount: token.amounts.get(b.outpoint) ?? "0"
4017
4021
  }));
4018
- const result = await sweepBsv21.execute(ctx, { inputs, wif });
4022
+ const keys = inputs.map(() => sweepKey);
4023
+ const result = await sweepBsv21.execute(ctx, { inputs, keys });
4019
4024
  if (result.error) {
4020
4025
  fatal(`Token sweep failed (${token.symbol ?? token.tokenId.slice(0, 12)}): ${result.error}`);
4021
4026
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1sat/cli",
3
- "version": "0.0.104",
3
+ "version": "0.0.106",
4
4
  "description": "CLI for 1Sat Ordinals SDK",
5
5
  "type": "module",
6
6
  "main": "./dist/cli.js",
@@ -27,7 +27,7 @@
27
27
  ],
28
28
  "license": "MIT",
29
29
  "dependencies": {
30
- "@1sat/actions": "0.0.204",
30
+ "@1sat/actions": "0.0.205",
31
31
  "@1sat/client": "0.0.51",
32
32
  "@1sat/types": "0.0.41",
33
33
  "@1sat/wallet-node": "0.0.72",
@@ -135,9 +135,10 @@ async function sweepImport(args: string[], opts: GlobalFlags): Promise<void> {
135
135
  if (!wif) fatal('Missing --wif <private-key>')
136
136
 
137
137
  let address: string
138
+ let sweepKey: PrivateKey
138
139
  try {
139
- const pk = PrivateKey.fromWif(wif)
140
- address = pk.toPublicKey().toAddress()
140
+ sweepKey = PrivateKey.fromWif(wif)
141
+ address = sweepKey.toPublicKey().toAddress()
141
142
  } catch {
142
143
  fatal('Invalid WIF private key')
143
144
  }
@@ -200,7 +201,8 @@ async function sweepImport(args: string[], opts: GlobalFlags): Promise<void> {
200
201
  // Sweep BSV funding UTXOs
201
202
  if (hasFunding) {
202
203
  const inputs = await prepareSweepInputs(ctx, scan.funding)
203
- const result = await sweepBsv.execute(ctx, { inputs, wif })
204
+ const keys = inputs.map(() => sweepKey)
205
+ const result = await sweepBsv.execute(ctx, { inputs, keys })
204
206
  if (result.error) {
205
207
  fatal(`BSV sweep failed: ${result.error}`)
206
208
  }
@@ -210,7 +212,8 @@ async function sweepImport(args: string[], opts: GlobalFlags): Promise<void> {
210
212
  // Sweep ordinals
211
213
  if (hasOrdinals) {
212
214
  const inputs = await prepareSweepInputs(ctx, scan.ordinals)
213
- const result = await sweepOrdinals.execute(ctx, { inputs, wif })
215
+ const keys = inputs.map(() => sweepKey)
216
+ const result = await sweepOrdinals.execute(ctx, { inputs, keys })
214
217
  if (result.error) {
215
218
  fatal(`Ordinals sweep failed: ${result.error}`)
216
219
  }
@@ -222,13 +225,15 @@ async function sweepImport(args: string[], opts: GlobalFlags): Promise<void> {
222
225
  for (const token of scan.bsv21Tokens) {
223
226
  if (!token.isActive || token.outputs.length === 0) continue
224
227
 
225
- const inputs = token.outputs.map((out) => ({
226
- outpoint: out.outpoint,
228
+ const base = await prepareSweepInputs(ctx, token.outputs)
229
+ const inputs = base.map((b) => ({
230
+ ...b,
227
231
  tokenId: token.tokenId,
228
- amount: token.amounts.get(out.outpoint) ?? '0',
232
+ amount: token.amounts.get(b.outpoint) ?? '0',
229
233
  }))
234
+ const keys = inputs.map(() => sweepKey)
230
235
 
231
- const result = await sweepBsv21.execute(ctx, { inputs, wif })
236
+ const result = await sweepBsv21.execute(ctx, { inputs, keys })
232
237
  if (result.error) {
233
238
  fatal(
234
239
  `Token sweep failed (${token.symbol ?? token.tokenId.slice(0, 12)}): ${result.error}`,