@1sat/wallet-toolbox 0.0.30 → 0.0.31
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 +23 -1
- package/package.json +4 -4
package/dist/api/sweep/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Functions for sweeping assets from external wallets into a BRC-100 wallet.
|
|
5
5
|
*/
|
|
6
|
-
import { P2PKH, PrivateKey, PublicKey, Transaction, } from "@bsv/sdk";
|
|
6
|
+
import { P2PKH, PrivateKey, PublicKey, Transaction, Utils, } from "@bsv/sdk";
|
|
7
7
|
import { BSV21 } from "@bopen-io/templates";
|
|
8
8
|
import { ONESAT_PROTOCOL, BSV21_PROTOCOL, BSV21_FEE_SATS, BSV21_BASKET } from "../constants";
|
|
9
9
|
import { deriveFundAddress } from "../../indexers";
|
|
@@ -343,6 +343,26 @@ export const sweepOrdinals = {
|
|
|
343
343
|
}
|
|
344
344
|
// Sign each input with our external key
|
|
345
345
|
const tx = Transaction.fromBEEF(createResult.signableTransaction.tx);
|
|
346
|
+
// Log transaction structure for debugging
|
|
347
|
+
console.log(`[sweepOrdinals] === Transaction Structure ===`);
|
|
348
|
+
console.log(`[sweepOrdinals] Inputs (${tx.inputs.length}):`);
|
|
349
|
+
let totalInputSats = 0;
|
|
350
|
+
for (let i = 0; i < tx.inputs.length; i++) {
|
|
351
|
+
const inp = tx.inputs[i];
|
|
352
|
+
const sats = inp.sourceTransaction?.outputs[inp.sourceOutputIndex]?.satoshis ?? 0;
|
|
353
|
+
totalInputSats += sats;
|
|
354
|
+
console.log(` [${i}] ${inp.sourceTXID}:${inp.sourceOutputIndex} = ${sats} sats`);
|
|
355
|
+
}
|
|
356
|
+
console.log(`[sweepOrdinals] Outputs (${tx.outputs.length}):`);
|
|
357
|
+
let totalOutputSats = 0;
|
|
358
|
+
for (let i = 0; i < tx.outputs.length; i++) {
|
|
359
|
+
const out = tx.outputs[i];
|
|
360
|
+
totalOutputSats += out.satoshis ?? 0;
|
|
361
|
+
console.log(` [${i}] ${out.satoshis} sats, script len=${out.lockingScript?.toHex().length ?? 0}`);
|
|
362
|
+
}
|
|
363
|
+
console.log(`[sweepOrdinals] Total in: ${totalInputSats}, Total out: ${totalOutputSats}, Fee: ${totalInputSats - totalOutputSats}`);
|
|
364
|
+
console.log(`[sweepOrdinals] Signable tx hex: ${Utils.toHex(createResult.signableTransaction.tx)}`);
|
|
365
|
+
console.log(`[sweepOrdinals] ==============================`);
|
|
346
366
|
// Build a set of outpoints we control
|
|
347
367
|
const ourOutpoints = new Set(inputs.map((input) => {
|
|
348
368
|
const [txid, vout] = input.outpoint.split("_");
|
|
@@ -358,6 +378,8 @@ export const sweepOrdinals = {
|
|
|
358
378
|
}
|
|
359
379
|
}
|
|
360
380
|
await tx.sign();
|
|
381
|
+
// Log signed transaction
|
|
382
|
+
console.log(`[sweepOrdinals] Signed tx hex: ${tx.toHex()}`);
|
|
361
383
|
// Extract unlocking scripts for signAction
|
|
362
384
|
const spends = {};
|
|
363
385
|
for (let i = 0; i < tx.inputs.length; i++) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1sat/wallet-toolbox",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.31",
|
|
4
4
|
"description": "BSV wallet library extending @bsv/wallet-toolbox with 1Sat Ordinals protocol support",
|
|
5
5
|
"author": "1Sat Team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"fflate": "^0.8.2"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"@bsv/wallet-toolbox-mobile": "npm:@bopen-io/wallet-toolbox-mobile@^1.7.20-idb-fix.
|
|
47
|
+
"@bsv/wallet-toolbox-mobile": "npm:@bopen-io/wallet-toolbox-mobile@^1.7.20-idb-fix.17"
|
|
48
48
|
},
|
|
49
49
|
"peerDependenciesMeta": {
|
|
50
50
|
"@bsv/wallet-toolbox-mobile": {
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@biomejs/biome": "^1.9.4",
|
|
56
|
-
"@bsv/wallet-toolbox": "npm:@bopen-io/wallet-toolbox@^1.7.20-idb-fix.
|
|
57
|
-
"@bsv/wallet-toolbox-mobile": "npm:@bopen-io/wallet-toolbox-mobile@^1.7.20-idb-fix.
|
|
56
|
+
"@bsv/wallet-toolbox": "npm:@bopen-io/wallet-toolbox@^1.7.20-idb-fix.17",
|
|
57
|
+
"@bsv/wallet-toolbox-mobile": "npm:@bopen-io/wallet-toolbox-mobile@^1.7.20-idb-fix.17",
|
|
58
58
|
"@types/bun": "^1.3.4",
|
|
59
59
|
"@types/chrome": "^0.1.32",
|
|
60
60
|
"typescript": "^5.9.3"
|