/** * Shared cache for the user's BlockRun-provisioned phone numbers. * * Why a cache: `POST /v1/phone/numbers/list` costs $0.001 per call. The * panel ticks countdowns once per minute and the terminal status bar * re-renders on every prompt cycle — both surfaces hitting the gateway * directly would burn pointless micropayments. We hit the gateway only * on cache-miss, panel-reload, or after a state-changing call (buy / * renew / release). * * Storage: ~/.blockrun/phone-numbers.json. Read by both the Ink terminal * status bar and the web panel, so they always agree on which numbers * the wallet owns and how many days remain. */ import { type Chain } from '../config.js'; export interface PhoneNumberRecord { phone_number: string; chain: Chain; expires_at: string; active: boolean; } interface CacheFile { fetchedAt: number; wallet: string; chain: Chain; numbers: PhoneNumberRecord[]; } /** 6 hours — long enough to not thrash the gateway, short enough that * a number provisioned on another device shows up the same day. */ export declare const CACHE_TTL_MS: number; export declare function readCache(): CacheFile | null; export declare function writeCache(data: { wallet: string; chain: Chain; numbers: PhoneNumberRecord[]; }): void; export declare function clearCache(): void; export declare function isFresh(cache: CacheFile | null, wallet: string, chain: Chain): boolean; /** * Compute days-remaining for a number's lease. Negative when expired. * UI uses this for the colour ladder (green / amber / red). */ export declare function daysRemaining(expiresAt: string): number; export {};