@unicitylabs/sphere-sdk 0.2.0 → 0.2.2

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.
@@ -569,6 +569,10 @@ declare class VestingClassifier {
569
569
  * Clear all caches
570
570
  */
571
571
  clearCaches(): void;
572
+ /**
573
+ * Destroy caches and delete the IndexedDB database entirely.
574
+ */
575
+ destroy(): Promise<void>;
572
576
  }
573
577
  declare const vestingClassifier: VestingClassifier;
574
578
 
package/dist/l1/index.js CHANGED
@@ -855,6 +855,24 @@ var VestingClassifier = class {
855
855
  tx.objectStore(this.storeName).clear();
856
856
  }
857
857
  }
858
+ /**
859
+ * Destroy caches and delete the IndexedDB database entirely.
860
+ */
861
+ async destroy() {
862
+ this.memoryCache.clear();
863
+ if (this.db) {
864
+ this.db.close();
865
+ this.db = null;
866
+ }
867
+ if (typeof indexedDB !== "undefined") {
868
+ await new Promise((resolve) => {
869
+ const req = indexedDB.deleteDatabase(this.dbName);
870
+ req.onsuccess = () => resolve();
871
+ req.onerror = () => resolve();
872
+ req.onblocked = () => resolve();
873
+ });
874
+ }
875
+ }
858
876
  };
859
877
  var vestingClassifier = new VestingClassifier();
860
878