@1sat/wallet-toolbox 0.0.28 → 0.0.30
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/ordinals/index.js +26 -12
- package/dist/api/sweep/index.js +7 -5
- package/package.json +4 -4
|
@@ -181,18 +181,30 @@ export async function buildTransferOrdinals(ctx, request) {
|
|
|
181
181
|
}
|
|
182
182
|
const sourceName = extractName(ordinal.customInstructions);
|
|
183
183
|
inputs.push({ outpoint, inputDescription: "Ordinal to transfer", unlockingScriptLength: 108 });
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
184
|
+
// Only track output in wallet when transferring to a counterparty (wallet can derive keys to spend it)
|
|
185
|
+
// External address transfers are NOT tracked since the wallet cannot spend them
|
|
186
|
+
if (counterparty) {
|
|
187
|
+
outputs.push({
|
|
188
|
+
lockingScript: new P2PKH().lock(recipientAddress).toHex(),
|
|
189
|
+
satoshis: 1,
|
|
190
|
+
outputDescription: "Ordinal transfer",
|
|
191
|
+
basket: ORDINALS_BASKET,
|
|
192
|
+
tags,
|
|
193
|
+
customInstructions: JSON.stringify({
|
|
194
|
+
protocolID: ONESAT_PROTOCOL,
|
|
195
|
+
keyID: outpoint,
|
|
196
|
+
...(sourceName && { name: sourceName }),
|
|
197
|
+
}),
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
// External address - output is not tracked in wallet
|
|
202
|
+
outputs.push({
|
|
203
|
+
lockingScript: new P2PKH().lock(recipientAddress).toHex(),
|
|
204
|
+
satoshis: 1,
|
|
205
|
+
outputDescription: "Ordinal transfer to external address",
|
|
206
|
+
});
|
|
207
|
+
}
|
|
196
208
|
}
|
|
197
209
|
return {
|
|
198
210
|
description: transfers.length === 1 ? "Transfer ordinal" : `Transfer ${transfers.length} ordinals`,
|
|
@@ -337,10 +349,12 @@ export const transferOrdinals = {
|
|
|
337
349
|
const spends = {};
|
|
338
350
|
for (let i = 0; i < input.transfers.length; i++) {
|
|
339
351
|
const { ordinal } = input.transfers[i];
|
|
352
|
+
console.log(`[transferOrdinals] Input ${i}: outpoint=${ordinal.outpoint}, customInstructions=${ordinal.customInstructions}`);
|
|
340
353
|
if (!ordinal.customInstructions) {
|
|
341
354
|
return { error: `missing-custom-instructions-for-${ordinal.outpoint}` };
|
|
342
355
|
}
|
|
343
356
|
const { protocolID, keyID } = JSON.parse(ordinal.customInstructions);
|
|
357
|
+
console.log(`[transferOrdinals] Input ${i}: protocolID=${JSON.stringify(protocolID)}, keyID=${keyID}`);
|
|
344
358
|
const unlocking = await signP2PKHInput(ctx, tx, i, protocolID, keyID);
|
|
345
359
|
if (typeof unlocking !== "string")
|
|
346
360
|
return unlocking;
|
package/dist/api/sweep/index.js
CHANGED
|
@@ -310,17 +310,19 @@ export const sweepOrdinals = {
|
|
|
310
310
|
tags.push(`type:${input.contentType}`);
|
|
311
311
|
if (input.origin)
|
|
312
312
|
tags.push(`origin:${input.origin}`);
|
|
313
|
+
const customInstructions = JSON.stringify({
|
|
314
|
+
protocolID: ONESAT_PROTOCOL,
|
|
315
|
+
keyID: input.outpoint,
|
|
316
|
+
...(input.name && { name: input.name.slice(0, 64) }),
|
|
317
|
+
});
|
|
318
|
+
console.log(`[sweepOrdinals] Output for ${input.outpoint}: keyID=${input.outpoint}, customInstructions=${customInstructions}`);
|
|
313
319
|
outputs.push({
|
|
314
320
|
lockingScript: lockingScript.toHex(),
|
|
315
321
|
satoshis: 1,
|
|
316
322
|
outputDescription: `Ordinal ${input.origin ?? input.outpoint}`,
|
|
317
323
|
basket: "1sat",
|
|
318
324
|
tags,
|
|
319
|
-
customInstructions
|
|
320
|
-
protocolID: ONESAT_PROTOCOL,
|
|
321
|
-
keyID: input.outpoint,
|
|
322
|
-
...(input.name && { name: input.name.slice(0, 64) }),
|
|
323
|
-
}),
|
|
325
|
+
customInstructions,
|
|
324
326
|
});
|
|
325
327
|
}
|
|
326
328
|
const beefData = firstBeef.toBinary();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1sat/wallet-toolbox",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.30",
|
|
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.16"
|
|
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.16",
|
|
57
|
+
"@bsv/wallet-toolbox-mobile": "npm:@bopen-io/wallet-toolbox-mobile@^1.7.20-idb-fix.16",
|
|
58
58
|
"@types/bun": "^1.3.4",
|
|
59
59
|
"@types/chrome": "^0.1.32",
|
|
60
60
|
"typescript": "^5.9.3"
|