import { c as EIP1193RequestFn, o as Transport, s as TransportConfig, u as RpcSchema } from "../../entryPointVersion-Cm2jyUEb.mjs"; import { g as MaybePromise } from "../../misc-BASHpEmW.mjs"; import { t as PublicClient } from "../../createPublicClient-B-Rn2OS7.mjs"; //#region node_modules/.pnpm/viem@2.47.6_typescript@6.0.2_zod@4.3.6/node_modules/viem/_types/utils/rpc/http.d.ts type HttpRpcClientOptions = { /** Override for the fetch function used to make requests. */fetchFn?: ((input: string | URL | Request, init?: RequestInit) => Promise) | undefined; /** Request configuration to pass to `fetch`. */ fetchOptions?: Omit | undefined; /** A callback to handle the request. */ onRequest?: ((request: Request, init: RequestInit) => MaybePromise) | undefined; /** A callback to handle the response. */ onResponse?: ((response: Response) => Promise | void) | undefined; /** The timeout (in ms) for the request. */ timeout?: number | undefined; }; //#endregion //#region node_modules/.pnpm/viem@2.47.6_typescript@6.0.2_zod@4.3.6/node_modules/viem/_types/clients/transports/http.d.ts type HttpTransportConfig = { /** * Whether to enable Batch JSON-RPC. * @link https://www.jsonrpc.org/specification#batch */ batch?: boolean | { /** The maximum number of JSON-RPC requests to send in a batch. @default 1_000 */batchSize?: number | undefined; /** The maximum number of milliseconds to wait before sending a batch. @default 0 */ wait?: number | undefined; } | undefined; fetchFn?: HttpRpcClientOptions['fetchFn'] | undefined; /** * Request configuration to pass to `fetch`. * @link https://developer.mozilla.org/en-US/docs/Web/API/fetch */ fetchOptions?: HttpRpcClientOptions['fetchOptions'] | undefined; /** A callback to handle the response from `fetch`. */ onFetchRequest?: HttpRpcClientOptions['onRequest'] | undefined; /** A callback to handle the response from `fetch`. */ onFetchResponse?: HttpRpcClientOptions['onResponse'] | undefined; /** The key of the HTTP transport. */ key?: TransportConfig['key'] | undefined; /** Methods to include or exclude from executing RPC requests. */ methods?: TransportConfig['methods'] | undefined; /** The name of the HTTP transport. */ name?: TransportConfig['name'] | undefined; /** Whether to return JSON RPC errors as responses instead of throwing. */ raw?: raw | boolean | undefined; /** The max number of times to retry. */ retryCount?: TransportConfig['retryCount'] | undefined; /** The base delay (in ms) between retries. */ retryDelay?: TransportConfig['retryDelay'] | undefined; /** Typed JSON-RPC schema for the transport. */ rpcSchema?: rpcSchema | RpcSchema | undefined; /** The timeout (in ms) for the HTTP request. Default: 10_000 */ timeout?: TransportConfig['timeout'] | undefined; }; type HttpTransport = Transport<'http', { fetchOptions?: HttpTransportConfig['fetchOptions'] | undefined; url?: string | undefined; }, EIP1193RequestFn>; /** * @description Creates a HTTP transport that connects to a JSON-RPC API. */ declare function http(/** URL of the JSON-RPC API. Defaults to the chain's public RPC URL. */ url?: string | undefined, config?: HttpTransportConfig): HttpTransport; //#endregion //#region extensions/crypto/src/services/rpc-provider.d.ts interface RpcProviderConfig { url: string; name: string; priority: number; apiKeyEnv?: string; fullUrlEnv?: string; } interface RpcManagerConfig { /** Provider overrides per chain ID. Key is chain ID number as string. */ providers?: Record; /** Global timeout for RPC calls in ms. Default 3000. */ timeoutMs?: number; /** Max consecutive failures before circuit opens. Default 5. */ circuitThreshold?: number; /** How long circuit stays open in ms. Default 300_000 (5 min). */ circuitResetMs?: number; /** Enable MEV protection via private transaction RPCs (Flashbots, MEV Blocker). * When true, write transactions on supported chains route through private mempools. * Default: true. */ mevProtection?: boolean; } interface MevRpcConfig { url: string; name: string; /** Which chain IDs this MEV RPC supports */ chains: number[]; } declare class RpcManager { private config; private clientCache; constructor(userConfig?: RpcManagerConfig); /** Resolve a chain name or ID to a numeric chain ID. */ resolveChainId(chainInput: string | number): number; /** Get the ordered list of providers for a chain, filtered by health. */ getProviders(chainId: number): RpcProviderConfig[]; /** Build the full RPC URL for a provider (append API key if needed). */ buildUrl(provider: RpcProviderConfig): string; /** * Get a viem PublicClient for the given chain. * Tries providers in priority order, failing over on errors. */ getClient(chainInput?: string | number): Promise; /** Clear all cached clients (useful when switching chains). */ clearCache(): void; /** Get health status of all providers (for diagnostics). */ getHealthReport(chainId: number): Array<{ name: string; url: string; available: boolean; failures: number; circuitOpen: boolean; }>; /** List supported chain IDs. */ getSupportedChains(): number[]; /** Check if MEV protection is enabled. */ isMevProtectionEnabled(): boolean; /** * Get MEV-protected RPC URLs for a chain. * Returns private transaction RPCs that bypass the public mempool. * Falls back to empty array if no MEV RPCs are available for the chain. */ getMevRpcs(chainId: number): MevRpcConfig[]; /** * Get a viem http transport configured for MEV-protected submission. * Uses Flashbots Protect (primary) with MEV Blocker as fallback. * Returns null if no MEV RPCs are available for the chain. */ getMevTransport(chainId: number): ReturnType | null; /** * Record a MEV RPC failure (for circuit breaker tracking). */ recordMevFailure(chainId: number, rpcName: string, isRateLimit?: boolean): void; /** * Record a MEV RPC success. */ recordMevSuccess(chainId: number, rpcName: string): void; } declare function getRpcManager(config?: RpcManagerConfig): RpcManager; declare function resetRpcManager(): void; //#endregion export { MevRpcConfig, RpcManager, RpcManagerConfig, RpcProviderConfig, getRpcManager, resetRpcManager }; //# sourceMappingURL=rpc-provider.d.mts.map