@1sat/wallet-toolbox 0.0.68 → 0.0.70

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.
@@ -83,43 +83,24 @@ export async function createWebWallet(config) {
83
83
  services: oneSatServices,
84
84
  });
85
85
  // 6. Attempt remote storage connection AFTER wallet exists
86
+ // Push-only backup: no sync on startup, just connect for incremental backups
87
+ // Use fullSync() explicitly to restore from backup when needed
86
88
  let remoteClient;
87
89
  if (config.remoteStorageUrl) {
88
90
  console.log(`[createWebWallet] Attempting remote storage connection to ${config.remoteStorageUrl}`);
89
91
  try {
90
- // Create StorageClient with the REAL wallet (not a temp wallet)
91
- // StorageClient captures the wallet at construction for signing requests
92
92
  remoteClient = new StorageClient(underlyingWallet, config.remoteStorageUrl);
93
93
  const timeoutPromise = new Promise((_, reject) => setTimeout(() => reject(new Error("Remote storage connection timeout")), DEFAULT_REMOTE_STORAGE_TIMEOUT));
94
94
  await Promise.race([remoteClient.makeAvailable(), timeoutPromise]);
95
- // Add remote storage to the existing storage manager using public API
95
+ // Add remote as backup destination (push-only, no pull)
96
96
  await storage.addWalletStorageProvider(remoteClient);
97
- console.log("[createWebWallet] Remote storage connected successfully");
98
- // Bidirectional sync: pull first, then push
99
- // Pull builds idMap via natural key matching (reference for transactions)
100
- // Push sends local changes to remote
101
- console.log("[createWebWallet] Pulling from remote...");
102
- const pullResult = await storage.syncFromReader(identityPubKey, remoteClient);
103
- console.log(`[createWebWallet] Pulled: ${pullResult.inserts} inserts, ${pullResult.updates} updates`);
104
- console.log("[createWebWallet] Pushing to remote...");
105
- await storage.updateBackups(undefined, (msg) => {
106
- console.log("[createWebWallet] Push:", msg);
107
- return msg;
108
- });
109
- console.log("[createWebWallet] Push complete");
97
+ console.log("[createWebWallet] Remote backup connected");
110
98
  }
111
99
  catch (err) {
112
- console.log("[createWebWallet] Remote storage connection failed:", err instanceof Error ? err.message : err);
100
+ console.log("[createWebWallet] Remote backup connection failed:", err instanceof Error ? err.message : err);
113
101
  remoteClient = undefined;
114
102
  }
115
103
  }
116
- // Log storage state for debugging
117
- console.log("[createWebWallet] Storage state:", {
118
- activeKey: storage.getActiveStore(),
119
- backups: storage.getBackupStores().length,
120
- conflictingActives: storage.getConflictingStores().length,
121
- isActiveEnabled: storage.isActiveEnabled,
122
- });
123
104
  // Helper to sync to remote backup using public updateBackups API
124
105
  const syncToBackup = async (context) => {
125
106
  if (storage.getBackupStores().length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1sat/wallet-toolbox",
3
- "version": "0.0.68",
3
+ "version": "0.0.70",
4
4
  "description": "BSV wallet library extending @bsv/wallet-toolbox with 1Sat Ordinals protocol support",
5
5
  "author": "1Sat Team",
6
6
  "license": "MIT",