@1sat/wallet-toolbox 0.0.56 → 0.0.58

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.
@@ -203,6 +203,7 @@ export async function buildTransferOrdinals(ctx, request) {
203
203
  lockingScript: new P2PKH().lock(recipientAddress).toHex(),
204
204
  satoshis: 1,
205
205
  outputDescription: "Ordinal transfer to external address",
206
+ tags: [],
206
207
  });
207
208
  }
208
209
  }
@@ -377,7 +378,18 @@ export const transferOrdinals = {
377
378
  if (!ordinal.customInstructions) {
378
379
  return { error: `missing-custom-instructions-for-${ordinal.outpoint}` };
379
380
  }
380
- const { protocolID, keyID } = JSON.parse(ordinal.customInstructions);
381
+ // Parse and validate customInstructions
382
+ let parsed;
383
+ try {
384
+ parsed = JSON.parse(ordinal.customInstructions);
385
+ }
386
+ catch {
387
+ return { error: `invalid-custom-instructions-not-json-for-${ordinal.outpoint}` };
388
+ }
389
+ const { protocolID, keyID } = parsed;
390
+ if (!protocolID || !keyID) {
391
+ return { error: `invalid-custom-instructions-missing-protocol-or-key-for-${ordinal.outpoint}` };
392
+ }
381
393
  console.log(`[transferOrdinals] Input ${i}: protocolID=${JSON.stringify(protocolID)}, keyID=${keyID}`);
382
394
  const unlocking = await signP2PKHInput(ctx, tx, i, protocolID, keyID);
383
395
  if (typeof unlocking !== "string")
@@ -677,6 +689,7 @@ export const purchaseOrdinal = {
677
689
  lockingScript: payoutLockingScript.toHex(),
678
690
  satoshis: payoutSatoshis,
679
691
  outputDescription: "Payment to seller",
692
+ tags: [],
680
693
  });
681
694
  if (marketplaceAddress && marketplaceRate && marketplaceRate > 0) {
682
695
  const marketFee = Math.ceil(payoutSatoshis * marketplaceRate);
@@ -685,6 +698,7 @@ export const purchaseOrdinal = {
685
698
  lockingScript: p2pkh.lock(marketplaceAddress).toHex(),
686
699
  satoshis: marketFee,
687
700
  outputDescription: "Marketplace fee",
701
+ tags: [],
688
702
  });
689
703
  }
690
704
  }
@@ -96,6 +96,7 @@ export const sendBsv = {
96
96
  lockingScript: lockingScript.toHex(),
97
97
  satoshis: req.satoshis,
98
98
  outputDescription: `Payment of ${req.satoshis} sats`,
99
+ tags: [],
99
100
  });
100
101
  }
101
102
  const result = await ctx.wallet.createAction({
@@ -600,6 +600,7 @@ export const sweepBsv21 = {
600
600
  lockingScript: p2pkh.lock(fundAddress).toHex(),
601
601
  satoshis: BSV21_FEE_SATS,
602
602
  outputDescription: "Overlay processing fee",
603
+ tags: [],
603
604
  });
604
605
  const beefData = firstBeef.toBinary();
605
606
  // Create action to get signable transaction
@@ -259,6 +259,7 @@ export const sendBsv21 = {
259
259
  lockingScript: p2pkh.lock(fundAddress).toHex(),
260
260
  satoshis: BSV21_FEE_SATS,
261
261
  outputDescription: "Overlay processing fee",
262
+ tags: [],
262
263
  });
263
264
  const change = totalIn - amount;
264
265
  if (change > 0n) {
@@ -415,6 +416,7 @@ export const purchaseBsv21 = {
415
416
  lockingScript: payoutLockingScript.toHex(),
416
417
  satoshis: payoutSatoshis,
417
418
  outputDescription: "Payment to seller",
419
+ tags: [],
418
420
  });
419
421
  if (marketplaceAddress && marketplaceRate && marketplaceRate > 0) {
420
422
  const marketFee = Math.ceil(payoutSatoshis * marketplaceRate);
@@ -423,6 +425,7 @@ export const purchaseBsv21 = {
423
425
  lockingScript: p2pkh.lock(marketplaceAddress).toHex(),
424
426
  satoshis: marketFee,
425
427
  outputDescription: "Marketplace fee",
428
+ tags: [],
426
429
  });
427
430
  }
428
431
  }
@@ -28,6 +28,8 @@ export interface WebWalletConfig {
28
28
  };
29
29
  /** Remote storage URL. If provided, attempts to connect for cloud backup. */
30
30
  remoteStorageUrl?: string;
31
+ /** Device ID for sync isolation. Each device should have a unique ID to prevent sync corruption. */
32
+ deviceId?: string;
31
33
  /** Callback when a transaction is broadcasted (called after remote sync if connected) */
32
34
  onTransactionBroadcasted?: (txid: string) => void;
33
35
  /** Callback when a transaction is proven (called after remote sync if connected) */
@@ -89,7 +89,8 @@ export async function createWebWallet(config) {
89
89
  try {
90
90
  // Create StorageClient with the REAL wallet (not a temp wallet)
91
91
  // StorageClient captures the wallet at construction for signing requests
92
- remoteClient = new StorageClient(underlyingWallet, config.remoteStorageUrl);
92
+ // deviceId isolates sync state per device to prevent ID mapping corruption
93
+ remoteClient = new StorageClient(underlyingWallet, config.remoteStorageUrl, config.deviceId);
93
94
  const timeoutPromise = new Promise((_, reject) => setTimeout(() => reject(new Error("Remote storage connection timeout")), DEFAULT_REMOTE_STORAGE_TIMEOUT));
94
95
  await Promise.race([remoteClient.makeAvailable(), timeoutPromise]);
95
96
  // Add remote storage to the existing storage manager using public API
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1sat/wallet-toolbox",
3
- "version": "0.0.56",
3
+ "version": "0.0.58",
4
4
  "description": "BSV wallet library extending @bsv/wallet-toolbox with 1Sat Ordinals protocol support",
5
5
  "author": "1Sat Team",
6
6
  "license": "MIT",
@@ -38,14 +38,14 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "@1sat/wallet-toolbox": "0.0.52",
41
- "@bopen-io/templates": "^1.1.6",
42
- "@bsv/sdk": "^1.10.1",
41
+ "@bopen-io/templates": "^1.1.7",
42
+ "@bsv/sdk": "^1.10.2",
43
43
  "@msgpack/msgpack": "^3.1.3",
44
44
  "buffer": "^6.0.3",
45
45
  "fflate": "^0.8.2"
46
46
  },
47
47
  "peerDependencies": {
48
- "@bsv/wallet-toolbox-mobile": "npm:@bopen-io/wallet-toolbox-mobile@^1.7.20-idb-fix.30"
48
+ "@bsv/wallet-toolbox-mobile": "npm:@bopen-io/wallet-toolbox-mobile@^1.7.22-idb-fix.1"
49
49
  },
50
50
  "peerDependenciesMeta": {
51
51
  "@bsv/wallet-toolbox-mobile": {
@@ -54,8 +54,8 @@
54
54
  },
55
55
  "devDependencies": {
56
56
  "@biomejs/biome": "^1.9.4",
57
- "@bsv/wallet-toolbox": "npm:@bopen-io/wallet-toolbox@^1.7.20-idb-fix.30",
58
- "@bsv/wallet-toolbox-mobile": "npm:@bopen-io/wallet-toolbox-mobile@^1.7.20-idb-fix.30",
57
+ "@bsv/wallet-toolbox": "npm:@bopen-io/wallet-toolbox@^1.7.22-idb-fix.1",
58
+ "@bsv/wallet-toolbox-mobile": "npm:@bopen-io/wallet-toolbox-mobile@^1.7.22-idb-fix.1",
59
59
  "@types/bun": "^1.3.4",
60
60
  "@types/chrome": "^0.1.32",
61
61
  "typescript": "^5.9.3"