@palindromepay/sdk 2.0.2 → 2.0.3

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.
@@ -911,9 +911,14 @@ export declare class PalindromePaySDK {
911
911
  tokenDecimalsCacheSize: number;
912
912
  };
913
913
  /**
914
- * Clear all caches
914
+ * Clear the Apollo cache. Call this when switching wallets to prevent
915
+ * "Store error: database unavailable" errors.
915
916
  */
916
- clearAllCaches(): void;
917
+ clearApolloCache(): Promise<void>;
918
+ /**
919
+ * Clear all caches including Apollo cache. Call when switching wallets.
920
+ */
921
+ clearAllCaches(): Promise<void>;
917
922
  /**
918
923
  * Clear escrow cache only
919
924
  */
@@ -2169,15 +2169,29 @@ class PalindromePaySDK {
2169
2169
  };
2170
2170
  }
2171
2171
  /**
2172
- * Clear all caches
2172
+ * Clear the Apollo cache. Call this when switching wallets to prevent
2173
+ * "Store error: database unavailable" errors.
2173
2174
  */
2174
- clearAllCaches() {
2175
+ async clearApolloCache() {
2176
+ try {
2177
+ await this.apollo.clearStore();
2178
+ }
2179
+ catch (error) {
2180
+ // If clearStore fails, reset the client entirely
2181
+ this.apollo.stop();
2182
+ await this.apollo.resetStore();
2183
+ }
2184
+ }
2185
+ /**
2186
+ * Clear all caches including Apollo cache. Call when switching wallets.
2187
+ */
2188
+ async clearAllCaches() {
2175
2189
  this.escrowCache.clear();
2176
2190
  this.tokenDecimalsCache.clear();
2177
2191
  this.feeReceiverCache = null;
2178
2192
  this.cachedFeeBps = null;
2179
2193
  this.multicallSupported = null;
2180
- // Note: walletBytecodeHashCache is immutable and never needs clearing
2194
+ await this.clearApolloCache();
2181
2195
  }
2182
2196
  /**
2183
2197
  * Clear escrow cache only
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@palindromepay/sdk",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "TypeScript SDK for PalindromeCryptoEscrow - Secure blockchain escrow with buyer/seller protection",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",