@1sat/wallet-toolbox 0.0.59 → 0.0.60

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.
@@ -124,6 +124,7 @@ export const sweepBsv = {
124
124
  firstBeef.mergeBeef(additionalBeef);
125
125
  }
126
126
  console.log(`[sweep] Merged BEEF valid=${firstBeef.isValid()}, txs=${firstBeef.txs.length}`);
127
+ console.log(`[sweep] BEEF structure:\n${firstBeef.toLogString()}`);
127
128
  // Build input descriptors (we'll sign after getting the final transaction)
128
129
  const inputDescriptors = inputs.map((input) => {
129
130
  const [txid, voutStr] = input.outpoint.split("_");
@@ -216,6 +217,15 @@ export const sweepBsv = {
216
217
  };
217
218
  }
218
219
  catch (error) {
220
+ // Log detailed error info for WERR_REVIEW_ACTIONS
221
+ if (error && typeof error === "object" && "sendWithResults" in error) {
222
+ const werr = error;
223
+ console.error("[sweep] WERR_REVIEW_ACTIONS details:", {
224
+ message: werr.message,
225
+ txid: werr.txid,
226
+ sendWithResults: JSON.stringify(werr.sendWithResults, null, 2),
227
+ });
228
+ }
219
229
  return {
220
230
  error: error instanceof Error ? error.message : "unknown-error",
221
231
  };
@@ -28,8 +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
+ /** Unique identifier for this storage instance. Must be persisted by the consuming application and reused across sessions. Different devices should use different values to isolate sync state. */
32
+ storageIdentityKey: string;
33
33
  /** Callback when a transaction is broadcasted (called after remote sync if connected) */
34
34
  onTransactionBroadcasted?: (txid: string) => void;
35
35
  /** Callback when a transaction is proven (called after remote sync if connected) */
@@ -71,7 +71,7 @@ export async function createWebWallet(config) {
71
71
  const storageOptions = StorageProvider.createStorageBaseOptions(chain);
72
72
  storageOptions.feeModel = feeModel;
73
73
  const localStorage = new StorageIdb(storageOptions);
74
- await localStorage.migrate(DEFAULT_DATABASE_NAME, identityPubKey);
74
+ await localStorage.migrate(DEFAULT_DATABASE_NAME, config.storageIdentityKey);
75
75
  // 4. Create storage manager with local-only storage initially (empty backups)
76
76
  const storage = new WalletStorageManager(identityPubKey, localStorage, []);
77
77
  await storage.makeAvailable();
@@ -89,8 +89,7 @@ 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
- // deviceId isolates sync state per device to prevent ID mapping corruption
93
- remoteClient = new StorageClient(underlyingWallet, config.remoteStorageUrl, config.deviceId);
92
+ remoteClient = new StorageClient(underlyingWallet, config.remoteStorageUrl);
94
93
  const timeoutPromise = new Promise((_, reject) => setTimeout(() => reject(new Error("Remote storage connection timeout")), DEFAULT_REMOTE_STORAGE_TIMEOUT));
95
94
  await Promise.race([remoteClient.makeAvailable(), timeoutPromise]);
96
95
  // 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.59",
3
+ "version": "0.0.60",
4
4
  "description": "BSV wallet library extending @bsv/wallet-toolbox with 1Sat Ordinals protocol support",
5
5
  "author": "1Sat Team",
6
6
  "license": "MIT",