@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/core/index.cjs
CHANGED
|
@@ -793,6 +793,12 @@ var VestingClassifier = class {
|
|
|
793
793
|
};
|
|
794
794
|
request.onsuccess = (event) => {
|
|
795
795
|
this.db = event.target.result;
|
|
796
|
+
this.db.onversionchange = () => {
|
|
797
|
+
if (this.db) {
|
|
798
|
+
this.db.close();
|
|
799
|
+
this.db = null;
|
|
800
|
+
}
|
|
801
|
+
};
|
|
796
802
|
resolve();
|
|
797
803
|
};
|
|
798
804
|
request.onerror = () => reject(request.error);
|
|
@@ -1001,9 +1007,21 @@ var VestingClassifier = class {
|
|
|
1001
1007
|
if (typeof indexedDB !== "undefined") {
|
|
1002
1008
|
await new Promise((resolve) => {
|
|
1003
1009
|
const req = indexedDB.deleteDatabase(this.dbName);
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1010
|
+
const timer = setTimeout(() => {
|
|
1011
|
+
console.warn(`[VestingClassifier] destroy: deleteDatabase timed out for ${this.dbName}`);
|
|
1012
|
+
resolve();
|
|
1013
|
+
}, 3e3);
|
|
1014
|
+
req.onsuccess = () => {
|
|
1015
|
+
clearTimeout(timer);
|
|
1016
|
+
resolve();
|
|
1017
|
+
};
|
|
1018
|
+
req.onerror = () => {
|
|
1019
|
+
clearTimeout(timer);
|
|
1020
|
+
resolve();
|
|
1021
|
+
};
|
|
1022
|
+
req.onblocked = () => {
|
|
1023
|
+
console.warn(`[VestingClassifier] destroy: deleteDatabase blocked for ${this.dbName}, waiting...`);
|
|
1024
|
+
};
|
|
1007
1025
|
});
|
|
1008
1026
|
}
|
|
1009
1027
|
}
|
|
@@ -12618,14 +12636,17 @@ var Sphere = class _Sphere {
|
|
|
12618
12636
|
if (!wasConnected) {
|
|
12619
12637
|
await storage.connect();
|
|
12620
12638
|
}
|
|
12621
|
-
|
|
12622
|
-
|
|
12623
|
-
|
|
12624
|
-
|
|
12625
|
-
|
|
12626
|
-
|
|
12639
|
+
try {
|
|
12640
|
+
const mnemonic = await storage.get(STORAGE_KEYS_GLOBAL.MNEMONIC);
|
|
12641
|
+
if (mnemonic) return true;
|
|
12642
|
+
const masterKey = await storage.get(STORAGE_KEYS_GLOBAL.MASTER_KEY);
|
|
12643
|
+
if (masterKey) return true;
|
|
12644
|
+
return false;
|
|
12645
|
+
} finally {
|
|
12646
|
+
if (!wasConnected) {
|
|
12647
|
+
await storage.disconnect();
|
|
12648
|
+
}
|
|
12627
12649
|
}
|
|
12628
|
-
return false;
|
|
12629
12650
|
} catch {
|
|
12630
12651
|
return false;
|
|
12631
12652
|
}
|
|
@@ -12759,6 +12780,9 @@ var Sphere = class _Sphere {
|
|
|
12759
12780
|
if (await _Sphere.exists(options.storage)) {
|
|
12760
12781
|
throw new Error("Wallet already exists. Use Sphere.load() or Sphere.clear() first.");
|
|
12761
12782
|
}
|
|
12783
|
+
if (!options.storage.isConnected()) {
|
|
12784
|
+
await options.storage.connect();
|
|
12785
|
+
}
|
|
12762
12786
|
_Sphere.configureTokenRegistry(options.storage, options.network);
|
|
12763
12787
|
const groupChatConfig = _Sphere.resolveGroupChatConfig(options.groupChat, options.network);
|
|
12764
12788
|
const marketConfig = _Sphere.resolveMarketConfig(options.market);
|
|
@@ -12810,6 +12834,9 @@ var Sphere = class _Sphere {
|
|
|
12810
12834
|
marketConfig
|
|
12811
12835
|
);
|
|
12812
12836
|
sphere._password = options.password ?? null;
|
|
12837
|
+
if (!options.storage.isConnected()) {
|
|
12838
|
+
await options.storage.connect();
|
|
12839
|
+
}
|
|
12813
12840
|
await sphere.loadIdentityFromStorage();
|
|
12814
12841
|
await sphere.initializeProviders();
|
|
12815
12842
|
await sphere.initializeModules();
|