@1sat/wallet-toolbox 0.0.35 → 0.0.36
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.
- package/dist/wallet/factory.d.ts +1 -1
- package/dist/wallet/factory.js +27 -2
- package/package.json +1 -1
package/dist/wallet/factory.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export interface WebWalletConfig {
|
|
|
21
21
|
adminOriginator: string;
|
|
22
22
|
/** Permission configuration for WalletPermissionsManager */
|
|
23
23
|
permissionsConfig: PermissionsManagerConfig;
|
|
24
|
-
/** Fee model. Default: { model: 'sat/kb', value:
|
|
24
|
+
/** Fee model. Default: { model: 'sat/kb', value: 100 } */
|
|
25
25
|
feeModel?: {
|
|
26
26
|
model: "sat/kb";
|
|
27
27
|
value: number;
|
package/dist/wallet/factory.js
CHANGED
|
@@ -162,13 +162,38 @@ export async function createWebWallet(config) {
|
|
|
162
162
|
unprovenAttemptsLimitMain: 144,
|
|
163
163
|
});
|
|
164
164
|
monitor.addDefaultTasks();
|
|
165
|
-
// 9.
|
|
165
|
+
// 9. Wire up monitor callbacks to sync to remote backup
|
|
166
|
+
if (remoteClient) {
|
|
167
|
+
monitor.onTransactionBroadcasted = async (result) => {
|
|
168
|
+
console.log("[Monitor] Transaction broadcasted:", result.txid);
|
|
169
|
+
try {
|
|
170
|
+
const auth = await storage.getAuth();
|
|
171
|
+
await storage.syncToWriter(auth, remoteClient);
|
|
172
|
+
console.log("[Monitor] Synced to backup after broadcast");
|
|
173
|
+
}
|
|
174
|
+
catch (err) {
|
|
175
|
+
console.warn("[Monitor] Failed to sync after broadcast:", err);
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
monitor.onTransactionProven = async (status) => {
|
|
179
|
+
console.log("[Monitor] Transaction proven:", status.txid, "block", status.blockHeight);
|
|
180
|
+
try {
|
|
181
|
+
const auth = await storage.getAuth();
|
|
182
|
+
await storage.syncToWriter(auth, remoteClient);
|
|
183
|
+
console.log("[Monitor] Synced to backup after confirmation");
|
|
184
|
+
}
|
|
185
|
+
catch (err) {
|
|
186
|
+
console.warn("[Monitor] Failed to sync after confirmation:", err);
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
// 10. Create cleanup function
|
|
166
191
|
const destroy = async () => {
|
|
167
192
|
monitor.stopTasks();
|
|
168
193
|
await monitor.destroy();
|
|
169
194
|
await underlyingWallet.destroy();
|
|
170
195
|
};
|
|
171
|
-
//
|
|
196
|
+
// 11. Create fullSync function if remote storage is connected
|
|
172
197
|
const fullSyncFn = remoteClient
|
|
173
198
|
? async (onProgress) => {
|
|
174
199
|
return fullSync({
|