aboutsummaryrefslogtreecommitdiffstats
path: root/src/wallet.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/wallet.js')
-rw-r--r--src/wallet.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/wallet.js b/src/wallet.js
index 8b88477..bdcb451 100644
--- a/src/wallet.js
+++ b/src/wallet.js
@@ -23,6 +23,7 @@ import { concatBytes } from '@scure/btc-signer/utils.js';
import { Api, pool, getBackend, explorerWeb, electrumCandidates } from './api.js';
import { ElectrumApi } from './electrum.js';
+import { cacheStorage } from './cache-store.js';
import { schnorr } from '@noble/curves/secp256k1';
// Resolve a same-origin '/path' WebSocket URL to an absolute ws(s):// URL against
@@ -1226,11 +1227,13 @@ export class Wallet {
}
// Namespaced per-wallet persisted state for features (swaps, ark, ...).
featureStateKey(name) { return this._cacheKey() + ':' + name; }
+ // Rebuildable caches (profiles, reports, …) live in IndexedDB through
+ // cacheStorage; everything else stays in localStorage. See cache-store.js.
loadFeatureState(name, fallback = null) {
- try { const v = JSON.parse(localStorage.getItem(this.featureStateKey(name)) || 'null'); return v == null ? fallback : v; } catch { return fallback; }
+ try { const v = JSON.parse(cacheStorage.getItem(this.featureStateKey(name)) || 'null'); return v == null ? fallback : v; } catch { return fallback; }
}
saveFeatureState(name, value) {
- try { localStorage.setItem(this.featureStateKey(name), JSON.stringify(value)); } catch {}
+ try { cacheStorage.setItem(this.featureStateKey(name), JSON.stringify(value)); } catch {}
}