@1sat/wallet-toolbox 0.0.64 → 0.0.65

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.
@@ -73,7 +73,7 @@ export async function createWebWallet(config) {
73
73
  const localStorage = new StorageIdb(storageOptions);
74
74
  await localStorage.migrate(DEFAULT_DATABASE_NAME, config.storageIdentityKey);
75
75
  // 4. Create storage manager with local-only storage initially (empty backups)
76
- const storage = new WalletStorageManager(identityPubKey, localStorage, []);
76
+ let storage = new WalletStorageManager(identityPubKey, localStorage, []);
77
77
  await storage.makeAvailable();
78
78
  // 5. Create the underlying Wallet FIRST (needed for StorageClient signing)
79
79
  const underlyingWallet = new Wallet({
@@ -118,8 +118,8 @@ export async function createWebWallet(config) {
118
118
  })),
119
119
  });
120
120
  // 7. Handle conflicting actives or sync to backups
121
- const conflictingStores = storage.getConflictingStores();
122
- const backupStores = storage.getBackupStores();
121
+ let conflictingStores = storage.getConflictingStores();
122
+ let backupStores = storage.getBackupStores();
123
123
  if (conflictingStores.length > 0) {
124
124
  const localKey = storage.getActiveStore();
125
125
  console.log("[createWebWallet] Resolving conflicting actives...");
@@ -132,6 +132,19 @@ export async function createWebWallet(config) {
132
132
  }
133
133
  catch (err) {
134
134
  console.log("[createWebWallet] Conflict resolution failed:", err instanceof Error ? err.message : err);
135
+ // FALLBACK: If conflict resolution fails, operate in local-only mode
136
+ // This allows the wallet to function even when remote sync is broken
137
+ console.log("[createWebWallet] Falling back to local-only mode (remote disabled)");
138
+ // Recreate storage manager with only local storage to clear conflicts
139
+ storage = new WalletStorageManager(identityPubKey, localStorage, []);
140
+ await storage.makeAvailable();
141
+ // Update the wallet's storage reference
142
+ underlyingWallet.storage = storage;
143
+ remoteClient = undefined;
144
+ // Refresh conflict state
145
+ conflictingStores = storage.getConflictingStores();
146
+ backupStores = storage.getBackupStores();
147
+ console.log("[createWebWallet] Local-only mode active, isActiveEnabled:", storage.isActiveEnabled);
135
148
  }
136
149
  }
137
150
  else if (backupStores.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1sat/wallet-toolbox",
3
- "version": "0.0.64",
3
+ "version": "0.0.65",
4
4
  "description": "BSV wallet library extending @bsv/wallet-toolbox with 1Sat Ordinals protocol support",
5
5
  "author": "1Sat Team",
6
6
  "license": "MIT",