@1sat/wallet-toolbox 0.0.41 → 0.0.43

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.
@@ -5,7 +5,7 @@
5
5
  * (browser extension) and 1sat-website (React app).
6
6
  */
7
7
  import { PrivateKey } from "@bsv/sdk";
8
- import { Monitor, type PermissionsManagerConfig, Wallet, WalletPermissionsManager } from "@bsv/wallet-toolbox-mobile/out/src/index.client.js";
8
+ import { Monitor, type PermissionsManagerConfig, StorageClient, Wallet, WalletPermissionsManager, WalletStorageManager } from "@bsv/wallet-toolbox-mobile/out/src/index.client.js";
9
9
  import { OneSatServices } from "../services/OneSatServices";
10
10
  import { type FullSyncResult, type FullSyncStage } from "./fullSync";
11
11
  type Chain = "main" | "test";
@@ -49,6 +49,10 @@ export interface WebWalletResult {
49
49
  destroy: () => Promise<void>;
50
50
  /** Full sync with remote backup (only available if remoteStorageUrl was provided and connected) */
51
51
  fullSync?: (onProgress?: (stage: FullSyncStage, message: string) => void) => Promise<FullSyncResult>;
52
+ /** Storage manager (for debugging/diagnostics) */
53
+ storage: WalletStorageManager;
54
+ /** Remote storage client (for debugging/diagnostics, undefined if not connected) */
55
+ remoteStorage?: StorageClient;
52
56
  }
53
57
  /**
54
58
  * Create a web wallet with storage, services, permissions, and monitor.
@@ -235,5 +235,7 @@ export async function createWebWallet(config) {
235
235
  monitor,
236
236
  destroy,
237
237
  fullSync: fullSyncFn,
238
+ storage,
239
+ remoteStorage: remoteClient,
238
240
  };
239
241
  }
@@ -44,6 +44,23 @@ export async function fullSync(options) {
44
44
  args.since = undefined;
45
45
  // Get chunk from local storage
46
46
  const chunk = await storage.runAsSync(async (sync) => sync.getSyncChunk(args));
47
+ // DEBUG CHECKPOINT 2: Log PUSH chunk contents
48
+ const pushBaskets = chunk.outputBaskets || [];
49
+ const pushOutputs = chunk.outputs || [];
50
+ const push1SatOutputs = pushOutputs.filter((o) => o.satoshis === 1);
51
+ console.log("=== CHECKPOINT 2: PUSH CHUNK ===");
52
+ console.log("[PUSH] Output Baskets:", pushBaskets.length);
53
+ for (const b of pushBaskets) {
54
+ console.log(` Basket: id=${b.basketId}, name="${b.name}"`);
55
+ }
56
+ console.log("[PUSH] Total Outputs:", pushOutputs.length);
57
+ console.log("[PUSH] Outputs with basketId:", pushOutputs.filter((o) => o.basketId != null).length);
58
+ console.log("[PUSH] 1-sat Outputs:", push1SatOutputs.length);
59
+ console.log("[PUSH] 1-sat with basketId:", push1SatOutputs.filter((o) => o.basketId != null).length);
60
+ for (const o of push1SatOutputs) {
61
+ console.log(` 1sat Output: outputId=${o.outputId}, basketId=${o.basketId}, txid=${o.txid?.slice(0, 16)}...${o.vout}`);
62
+ }
63
+ console.log("=== END CHECKPOINT 2 ===");
47
64
  // Send chunk to remote
48
65
  const result = await remoteStorage.processSyncChunk(args, chunk);
49
66
  pushInserts += result.inserts;
@@ -79,6 +96,30 @@ export async function fullSync(options) {
79
96
  });
80
97
  // Step 3: Pull from remote (full pull due to reset state)
81
98
  onProgress?.("pulling", "Pulling all data from remote...");
99
+ // DEBUG CHECKPOINT 3: Intercept PULL chunks from remote
100
+ const originalGetSyncChunk = remoteStorage.getSyncChunk?.bind(remoteStorage);
101
+ if (originalGetSyncChunk) {
102
+ remoteStorage.getSyncChunk = async function (args) {
103
+ const chunk = (await originalGetSyncChunk(args));
104
+ const pullBaskets = chunk.outputBaskets || [];
105
+ const pullOutputs = chunk.outputs || [];
106
+ const pull1SatOutputs = pullOutputs.filter((o) => o.satoshis === 1);
107
+ console.log("=== CHECKPOINT 3: PULL CHUNK ===");
108
+ console.log("[PULL] Output Baskets:", pullBaskets.length);
109
+ for (const b of pullBaskets) {
110
+ console.log(` Basket: id=${b.basketId}, name="${b.name}"`);
111
+ }
112
+ console.log("[PULL] Total Outputs:", pullOutputs.length);
113
+ console.log("[PULL] Outputs with basketId:", pullOutputs.filter((o) => o.basketId != null).length);
114
+ console.log("[PULL] 1-sat Outputs:", pull1SatOutputs.length);
115
+ console.log("[PULL] 1-sat with basketId:", pull1SatOutputs.filter((o) => o.basketId != null).length);
116
+ for (const o of pull1SatOutputs) {
117
+ console.log(` 1sat Output: outputId=${o.outputId}, basketId=${o.basketId}, txid=${o.txid?.slice(0, 16)}...${o.vout}`);
118
+ }
119
+ console.log("=== END CHECKPOINT 3 ===");
120
+ return chunk;
121
+ };
122
+ }
82
123
  const pullResult = await storage.syncFromReader(identityKey, remoteStorage);
83
124
  onProgress?.("pulling", `Pulled ${pullResult.inserts} inserts, ${pullResult.updates} updates`);
84
125
  // Step 4: Complete
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1sat/wallet-toolbox",
3
- "version": "0.0.41",
3
+ "version": "0.0.43",
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.19"
47
+ "@bsv/wallet-toolbox-mobile": "npm:@bopen-io/wallet-toolbox-mobile@^1.7.20-idb-fix.20"
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.17",
57
- "@bsv/wallet-toolbox-mobile": "npm:@bopen-io/wallet-toolbox-mobile@^1.7.20-idb-fix.19",
56
+ "@bsv/wallet-toolbox": "npm:@bopen-io/wallet-toolbox@^1.7.20-idb-fix.20",
57
+ "@bsv/wallet-toolbox-mobile": "npm:@bopen-io/wallet-toolbox-mobile@^1.7.20-idb-fix.20",
58
58
  "@types/bun": "^1.3.4",
59
59
  "@types/chrome": "^0.1.32",
60
60
  "typescript": "^5.9.3"