import { useCallback, useEffect } from "react"; import { proxy, ref, useSnapshot } from "valtio"; import { Select } from "."; import state, { ILog, transactionsState } from "../state"; import { extractJSON } from "../utils/json"; import LogBox from "./LogBox"; interface ISelect { label: string; value: T; } export interface IStreamState { selectedAccount: ISelect | null; status: "idle" | "opened" | "closed"; statusChangeTimestamp?: number; logs: ILog[]; socket?: WebSocket; } export const streamState = proxy({ selectedAccount: null as ISelect | null, status: "idle", logs: [] as ILog[], }); const DebugStream = () => { const { selectedAccount, logs, socket } = useSnapshot(streamState); const { activeHeader: activeTxTab } = useSnapshot(transactionsState); const { accounts } = useSnapshot(state); const accountOptions = accounts.map(acc => ({ label: acc.name, value: acc.address, })); const renderNav = () => ( <>