@miden-sdk/miden-sdk 0.13.2 → 0.13.3

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.
Binary file
package/dist/index.d.ts CHANGED
@@ -55,6 +55,15 @@ type MidenArrayConstructors = {
55
55
 
56
56
  export declare const MidenArrays: MidenArrayConstructors;
57
57
 
58
+ /** Payload delivered to {@link WebClient.onStateChanged} listeners. */
59
+ export interface StateChangedEvent {
60
+ type: "stateChanged";
61
+ /** The mutating operation that triggered the event. */
62
+ operation?: string;
63
+ /** The store / database name that was mutated. */
64
+ storeName: string;
65
+ }
66
+
58
67
  // WebClient wrapper class that uses a worker and forwards missing methods to WASM.
59
68
  export declare class WebClient extends WasmWebClient {
60
69
  /**
@@ -125,7 +134,26 @@ export declare class WebClient extends WasmWebClient {
125
134
  syncStateWithTimeout(timeoutMs?: number): Promise<SyncSummary>;
126
135
 
127
136
  /**
128
- * Terminates the underlying worker.
137
+ * Replace the sign callback on a live client instance.
138
+ * This allows hot-swapping the signer without recreating the client.
139
+ */
140
+ setSignCb(signCb: SignCallback | null | undefined): void;
141
+
142
+ /**
143
+ * Register a listener that fires when another browser tab mutates the same
144
+ * IndexedDB database (cross-tab BroadcastChannel notification, Layer 3).
145
+ *
146
+ * The WebClient automatically calls `syncState()` on cross-tab changes,
147
+ * so in-memory state is already refreshed when your callback runs. Use
148
+ * this for additional work like re-fetching accounts or updating UI.
149
+ *
150
+ * @param callback - Invoked with a {@link StateChangedEvent} payload.
151
+ * @returns An unsubscribe function — call it to remove the listener.
152
+ */
153
+ onStateChanged(callback: (event: StateChangedEvent) => void): () => void;
154
+
155
+ /**
156
+ * Terminates the underlying worker and cleans up the BroadcastChannel.
129
157
  */
130
158
  terminate(): void;
131
159
  }