@cdr-kit/react/Hooks/useTimeWindowState

useTimeWindowState

Reads a TimeWindowCondition vault's [startTs, endTs] window + ticks a 1-second client-side timer to surface opensInMs/closesInMs.
import { useTimeWindowState } from "@cdr-kit/react"

Signature

type
function useTimeWindowState(uuid: number, address?: Hex): {
startTs?: bigint;
endTs?: bigint;      // 0 = open-ended after startTs
blockBased?: boolean;
isOpen: boolean;
opensInMs: number;    // 0 if already open or unconfigured
closesInMs: number;   // 0 if open-ended or already closed
isLoading: boolean;
};

Block-based windows

For blockBased: true windows, opensInMs/closesInMs return 0block.number isn't ticked client-side. Read the raw block bounds from the result object.