@1sat/wallet-toolbox 0.0.37 → 0.0.38
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.js +12 -4
- package/package.json +3 -3
package/dist/wallet/factory.js
CHANGED
|
@@ -162,14 +162,23 @@ export async function createWebWallet(config) {
|
|
|
162
162
|
unprovenAttemptsLimitMain: 144,
|
|
163
163
|
});
|
|
164
164
|
monitor.addDefaultTasks();
|
|
165
|
+
// Helper to sync to remote backup using updateBackups (same as initialization)
|
|
166
|
+
const syncToBackup = async (context) => {
|
|
167
|
+
const storageAny = storage;
|
|
168
|
+
if (storageAny._backups?.length && storageAny.updateBackups) {
|
|
169
|
+
await storageAny.updateBackups(undefined, (msg) => {
|
|
170
|
+
console.log(`[Monitor] ${context}:`, msg);
|
|
171
|
+
return msg;
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
};
|
|
165
175
|
// 9. Wire up monitor callbacks - sync to remote first, then call user callbacks
|
|
166
176
|
monitor.onTransactionBroadcasted = async (result) => {
|
|
167
177
|
console.log("[Monitor] Transaction broadcasted:", result.txid);
|
|
168
178
|
// Sync to remote backup first (if connected)
|
|
169
179
|
if (remoteClient) {
|
|
170
180
|
try {
|
|
171
|
-
|
|
172
|
-
await storage.syncToWriter(auth, remoteClient);
|
|
181
|
+
await syncToBackup("Backup after broadcast");
|
|
173
182
|
console.log("[Monitor] Synced to backup after broadcast");
|
|
174
183
|
}
|
|
175
184
|
catch (err) {
|
|
@@ -191,8 +200,7 @@ export async function createWebWallet(config) {
|
|
|
191
200
|
// Sync to remote backup first (if connected)
|
|
192
201
|
if (remoteClient) {
|
|
193
202
|
try {
|
|
194
|
-
|
|
195
|
-
await storage.syncToWriter(auth, remoteClient);
|
|
203
|
+
await syncToBackup("Backup after confirmation");
|
|
196
204
|
console.log("[Monitor] Synced to backup after confirmation");
|
|
197
205
|
}
|
|
198
206
|
catch (err) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1sat/wallet-toolbox",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.38",
|
|
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.
|
|
47
|
+
"@bsv/wallet-toolbox-mobile": "npm:@bopen-io/wallet-toolbox-mobile@^1.7.20-idb-fix.19"
|
|
48
48
|
},
|
|
49
49
|
"peerDependenciesMeta": {
|
|
50
50
|
"@bsv/wallet-toolbox-mobile": {
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@biomejs/biome": "^1.9.4",
|
|
56
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.
|
|
57
|
+
"@bsv/wallet-toolbox-mobile": "npm:@bopen-io/wallet-toolbox-mobile@^1.7.20-idb-fix.19",
|
|
58
58
|
"@types/bun": "^1.3.4",
|
|
59
59
|
"@types/chrome": "^0.1.32",
|
|
60
60
|
"typescript": "^5.9.3"
|