``` feat: add websocket tests, PoA metrics, marketplace endpoints, and enhanced observability - Add comprehensive websocket tests for blocks and transactions streams including multi-subscriber and high-volume scenarios - Extend PoA consensus with per-proposer block metrics and rotation tracking - Add latest block interval gauge and RPC error spike alerting - Enhance mock coordinator
34 lines
832 B
TypeScript
34 lines
832 B
TypeScript
export interface MarketplaceSession {
|
|
token: string;
|
|
expiresAt: number;
|
|
}
|
|
|
|
const STORAGE_KEY = "marketplace-session";
|
|
|
|
export function saveSession(session: MarketplaceSession): void {
|
|
localStorage.setItem(STORAGE_KEY, JSON.stringify(session));
|
|
}
|
|
|
|
export function loadSession(): MarketplaceSession | null {
|
|
const raw = localStorage.getItem(STORAGE_KEY);
|
|
if (!raw) {
|
|
return null;
|
|
}
|
|
try {
|
|
const data = JSON.parse(raw) as MarketplaceSession;
|
|
if (typeof data.token === "string" && typeof data.expiresAt === "number") {
|
|
if (data.expiresAt > Date.now()) {
|
|
return data;
|
|
}
|
|
clearSession();
|
|
}
|
|
} catch (error) {
|
|
console.warn("Failed to parse stored marketplace session", error);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
export function clearSession(): void {
|
|
localStorage.removeItem(STORAGE_KEY);
|
|
}
|