mirror of
https://github.com/luxfi/wc-core.git
synced 2026-10-30 15:12:42 +00:00
23 lines
653 B
JavaScript
23 lines
653 B
JavaScript
import { isWalletConnectSession, getLocal, setLocal, removeLocal } from "@luxwallet/wc-utils";
|
|
class SessionStorage {
|
|
constructor(storageId = "walletconnect") {
|
|
this.storageId = storageId;
|
|
}
|
|
getSession() {
|
|
let session = null;
|
|
const json = getLocal(this.storageId);
|
|
if (json && isWalletConnectSession(json)) {
|
|
session = json;
|
|
}
|
|
return session;
|
|
}
|
|
setSession(session) {
|
|
setLocal(this.storageId, session);
|
|
return session;
|
|
}
|
|
removeSession() {
|
|
removeLocal(this.storageId);
|
|
}
|
|
}
|
|
export default SessionStorage;
|
|
//# sourceMappingURL=storage.js.map
|