UNPKG

bitcoin-inscription-viewer

Version:

🔍 A robust, production-ready React/TypeScript library for viewing Bitcoin Ordinals inscriptions with advanced optimization features including LRU caching, LaserEyes wallet integration, virtual scrolling, and performance monitoring

50 lines 1.36 kB
/** * Request Throttler - Prevents API request flooding * Implements a token bucket algorithm for rate limiting */ export declare class RequestThrottler { private tokens; private lastRefill; private readonly maxTokens; private readonly refillRate; private readonly refillInterval; constructor(maxTokens?: number, refillRate?: number); /** * Check if a request can be made and consume a token if available */ canMakeRequest(): boolean; /** * Wait until a token becomes available */ waitForToken(): Promise<void>; /** * Get the time to wait for the next token */ getWaitTime(): number; /** * Refill tokens based on elapsed time */ private refillTokens; /** * Get current token count */ getTokenCount(): number; /** * Reset the throttler */ reset(): void; } export declare const ordinalsThrottler: RequestThrottler; /** * Throttled fetch wrapper for ordinals.com */ export declare function throttledFetch(url: string, options?: RequestInit): Promise<Response>; /** * Check if throttler allows immediate request */ export declare function canMakeOrdinalsRequest(): boolean; /** * Get wait time for next ordinals request */ export declare function getOrdinalsWaitTime(): number; //# sourceMappingURL=requestThrottler.d.ts.map