@1sat/wallet-toolbox 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/dist/api/sweep/index.js +30 -2
- package/package.json +1 -1
package/dist/api/sweep/index.js
CHANGED
|
@@ -328,13 +328,41 @@ export const sweepOrdinals = {
|
|
|
328
328
|
const beefData = firstBeef.toBinary();
|
|
329
329
|
// Create action to get signable transaction
|
|
330
330
|
// CRITICAL: randomizeOutputs must be false to preserve ordinal satoshi positions
|
|
331
|
-
const
|
|
331
|
+
const createActionArgs = {
|
|
332
332
|
description: `Sweep ${inputs.length} ordinal${inputs.length !== 1 ? "s" : ""}`,
|
|
333
333
|
inputBEEF: beefData,
|
|
334
334
|
inputs: inputDescriptors,
|
|
335
335
|
outputs,
|
|
336
336
|
options: { signAndProcess: false, randomizeOutputs: false },
|
|
337
|
-
}
|
|
337
|
+
};
|
|
338
|
+
console.log(`[sweepOrdinals] === CREATE ACTION ARGS ===`);
|
|
339
|
+
console.log(`[sweepOrdinals] description: ${createActionArgs.description}`);
|
|
340
|
+
console.log(`[sweepOrdinals] inputBEEF length: ${beefData.length} bytes`);
|
|
341
|
+
console.log(`[sweepOrdinals] inputs count: ${inputDescriptors.length}`);
|
|
342
|
+
console.log(`[sweepOrdinals] outputs count: ${outputs.length}`);
|
|
343
|
+
console.log(`[sweepOrdinals] inputs:`, JSON.stringify(inputDescriptors, null, 2));
|
|
344
|
+
console.log(`[sweepOrdinals] outputs:`, JSON.stringify(outputs, null, 2));
|
|
345
|
+
console.log(`[sweepOrdinals] options:`, JSON.stringify(createActionArgs.options));
|
|
346
|
+
console.log(`[sweepOrdinals] Calling createAction...`);
|
|
347
|
+
let createResult;
|
|
348
|
+
try {
|
|
349
|
+
createResult = await ctx.wallet.createAction(createActionArgs);
|
|
350
|
+
console.log(`[sweepOrdinals] createAction returned:`, JSON.stringify(createResult, (key, value) => {
|
|
351
|
+
// Don't stringify large binary data
|
|
352
|
+
if (key === 'tx' && value instanceof Uint8Array)
|
|
353
|
+
return `<Uint8Array ${value.length} bytes>`;
|
|
354
|
+
if (key === 'tx' && Array.isArray(value))
|
|
355
|
+
return `<Array ${value.length} bytes>`;
|
|
356
|
+
return value;
|
|
357
|
+
}, 2));
|
|
358
|
+
}
|
|
359
|
+
catch (createError) {
|
|
360
|
+
console.error(`[sweepOrdinals] createAction threw:`, createError);
|
|
361
|
+
const errorMsg = createError instanceof Error ? createError.message : String(createError);
|
|
362
|
+
const errorStack = createError instanceof Error ? createError.stack : undefined;
|
|
363
|
+
console.error(`[sweepOrdinals] Stack:`, errorStack);
|
|
364
|
+
return { error: `createAction failed: ${errorMsg}` };
|
|
365
|
+
}
|
|
338
366
|
if ("error" in createResult && createResult.error) {
|
|
339
367
|
return { error: String(createResult.error) };
|
|
340
368
|
}
|