@unicitylabs/sphere-sdk 0.4.2 → 0.4.4
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/core/index.cjs +37 -10
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +37 -10
- package/dist/core/index.js.map +1 -1
- package/dist/impl/browser/index.cjs +183 -104
- package/dist/impl/browser/index.cjs.map +1 -1
- package/dist/impl/browser/index.js +183 -104
- package/dist/impl/browser/index.js.map +1 -1
- package/dist/index.cjs +37 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +37 -10
- package/dist/index.js.map +1 -1
- package/dist/l1/index.cjs +21 -3
- package/dist/l1/index.cjs.map +1 -1
- package/dist/l1/index.js +21 -3
- package/dist/l1/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1011,6 +1011,12 @@ var VestingClassifier = class {
|
|
|
1011
1011
|
};
|
|
1012
1012
|
request.onsuccess = (event) => {
|
|
1013
1013
|
this.db = event.target.result;
|
|
1014
|
+
this.db.onversionchange = () => {
|
|
1015
|
+
if (this.db) {
|
|
1016
|
+
this.db.close();
|
|
1017
|
+
this.db = null;
|
|
1018
|
+
}
|
|
1019
|
+
};
|
|
1014
1020
|
resolve();
|
|
1015
1021
|
};
|
|
1016
1022
|
request.onerror = () => reject(request.error);
|
|
@@ -1219,9 +1225,21 @@ var VestingClassifier = class {
|
|
|
1219
1225
|
if (typeof indexedDB !== "undefined") {
|
|
1220
1226
|
await new Promise((resolve) => {
|
|
1221
1227
|
const req = indexedDB.deleteDatabase(this.dbName);
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1228
|
+
const timer = setTimeout(() => {
|
|
1229
|
+
console.warn(`[VestingClassifier] destroy: deleteDatabase timed out for ${this.dbName}`);
|
|
1230
|
+
resolve();
|
|
1231
|
+
}, 3e3);
|
|
1232
|
+
req.onsuccess = () => {
|
|
1233
|
+
clearTimeout(timer);
|
|
1234
|
+
resolve();
|
|
1235
|
+
};
|
|
1236
|
+
req.onerror = () => {
|
|
1237
|
+
clearTimeout(timer);
|
|
1238
|
+
resolve();
|
|
1239
|
+
};
|
|
1240
|
+
req.onblocked = () => {
|
|
1241
|
+
console.warn(`[VestingClassifier] destroy: deleteDatabase blocked for ${this.dbName}, waiting...`);
|
|
1242
|
+
};
|
|
1225
1243
|
});
|
|
1226
1244
|
}
|
|
1227
1245
|
}
|
|
@@ -12895,14 +12913,17 @@ var Sphere = class _Sphere {
|
|
|
12895
12913
|
if (!wasConnected) {
|
|
12896
12914
|
await storage.connect();
|
|
12897
12915
|
}
|
|
12898
|
-
|
|
12899
|
-
|
|
12900
|
-
|
|
12901
|
-
|
|
12902
|
-
|
|
12903
|
-
|
|
12916
|
+
try {
|
|
12917
|
+
const mnemonic = await storage.get(STORAGE_KEYS_GLOBAL.MNEMONIC);
|
|
12918
|
+
if (mnemonic) return true;
|
|
12919
|
+
const masterKey = await storage.get(STORAGE_KEYS_GLOBAL.MASTER_KEY);
|
|
12920
|
+
if (masterKey) return true;
|
|
12921
|
+
return false;
|
|
12922
|
+
} finally {
|
|
12923
|
+
if (!wasConnected) {
|
|
12924
|
+
await storage.disconnect();
|
|
12925
|
+
}
|
|
12904
12926
|
}
|
|
12905
|
-
return false;
|
|
12906
12927
|
} catch {
|
|
12907
12928
|
return false;
|
|
12908
12929
|
}
|
|
@@ -13036,6 +13057,9 @@ var Sphere = class _Sphere {
|
|
|
13036
13057
|
if (await _Sphere.exists(options.storage)) {
|
|
13037
13058
|
throw new Error("Wallet already exists. Use Sphere.load() or Sphere.clear() first.");
|
|
13038
13059
|
}
|
|
13060
|
+
if (!options.storage.isConnected()) {
|
|
13061
|
+
await options.storage.connect();
|
|
13062
|
+
}
|
|
13039
13063
|
_Sphere.configureTokenRegistry(options.storage, options.network);
|
|
13040
13064
|
const groupChatConfig = _Sphere.resolveGroupChatConfig(options.groupChat, options.network);
|
|
13041
13065
|
const marketConfig = _Sphere.resolveMarketConfig(options.market);
|
|
@@ -13087,6 +13111,9 @@ var Sphere = class _Sphere {
|
|
|
13087
13111
|
marketConfig
|
|
13088
13112
|
);
|
|
13089
13113
|
sphere._password = options.password ?? null;
|
|
13114
|
+
if (!options.storage.isConnected()) {
|
|
13115
|
+
await options.storage.connect();
|
|
13116
|
+
}
|
|
13090
13117
|
await sphere.loadIdentityFromStorage();
|
|
13091
13118
|
await sphere.initializeProviders();
|
|
13092
13119
|
await sphere.initializeModules();
|