UNPKG

@pavlovcik/permit2-rpc-manager

Version:

Intelligent RPC manager with Permit2 validation and advanced fallback strategy

40 lines 1.36 kB
import { RpcSelector } from "./rpc-selector.ts"; export interface Permit2RpcManagerOptions { cacheTtlMs?: number; latencyTimeoutMs?: number; requestTimeoutMs?: number; nodeCachePath?: string; localStorageKey?: string; logLevel?: "debug" | "info" | "warn" | "error" | "none"; initialRpcData?: { rpcs: { [chainId: string]: string[]; }; }; runtimeFailureCooldownMs?: number; } export declare class Permit2RpcManager { private dataSource; private cacheManager; private latencyTester; rpcSelector: RpcSelector; private requestTimeoutMs; private logLevel; private configuredLogLevelValue; private runtimeFailureCooldownMs; private rpcIndexMap; private runtimeFailedRpcMap; constructor(options?: Permit2RpcManagerOptions); private _log; /** * Sends a JSON-RPC request, trying available RPCs in a round-robin fashion based on the ranked list. * Handles fallback by iterating through the list. */ send<T = any>(chainId: number, method: string, params?: any[]): Promise<T>; /** * Executes a single JSON-RPC call to the specified URL. * Made public temporarily FOR TESTING PURPOSES ONLY. */ executeRpcCall<T>(url: string, method: string, params: any[]): Promise<T>; } //# sourceMappingURL=permit2-rpc-manager.d.ts.map