/** * Extracts the minimum `time` (ms epoch) across all dex entries in a raw * clearingHouse API response. * * The MCP response is keyed by venue (e.g. `{ main: { …, time }, xyz: { …, time } }`). * Each dex entry carries its own `time` from the Hyperliquid clearinghouseState * API, indicating how fresh the data is. * * We take the **minimum** as a defensive measure: if any dex returned stale * data the entire response is conservatively marked with the oldest timestamp, * so downstream staleness checks can discard the whole response. * * Returns `0` when no valid time is found (e.g. response shape is unexpected * or the upstream stops providing timestamps). */ export declare function extractMinClearingHouseTime(raw: Record): number; /** * Stateful guard that detects stale clearingHouse API responses by comparing * the response timestamp against the most recent known-fresh timestamp for * the same key (wallet address). * * The Hyperliquid clearinghouseState API occasionally returns a response * whose timestamp is **older** than a previously observed one. Processing * such stale data causes downstream consumers to misinterpret disappeared * positions as closes and reappearing positions as new opens. * * Usage: * ```ts * const guard = createClearingHouseStalenessGuard(); * if (guard.isStale(address, responseTime)) { return null; } * ``` * * When either `responseTime` or the stored last time is `0` (unavailable), * the check is skipped so callers degrade gracefully if the upstream stops * providing timestamps. */ export declare function createClearingHouseStalenessGuard(): { /** * Returns `true` if `responseTime` is stale (older than the last * accepted time for `key`). Also updates internal tracking when the * response is fresh. */ isStale(key: string, responseTime: number): boolean; /** Returns the last accepted time for a key, or `0` if never seen. */ getLastTime(key: string): number; }; //# sourceMappingURL=clearing-house-staleness.d.ts.map