@lidofinance/api-rpc-proxy 0.0.0-stage → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA,sFAAsF;AACtF,2DAA2D;AAC3D,6BAA6B;AAC7B,iEAAiE;AACjE,sFAAsF;AACtF,qFAAqF;;;;ACLrF,MAAM,oCAAc;AAEpB,MAAM,+BAAS,CAAC;IACd,IAAI;QACF,OAAO,IAAI,IAAI,KAAK;IACtB,EAAE,OAAM;QACN,OAAO;IACT;AACF;AAIO,MAAM,4CAAa,CAAC,OAAiB,KAAK,QAAQ,mCAAa;;;;;;;;;;;;ACZ/D,MAAM,4CAA4B;AAElC,MAAM,4CAAgC;AAEtC,MAAM,iDAAoB;AAAO;AAEjC,MAAM,kDAAgC;IAC3C,YAAY,OAAgB,CAAE;QAC5B,KAAK,CAAC,WAAW;IACnB;AACF;AAEO,MAAM,kDAAmC;IAC9C,YAAY,OAAgB,CAAE;QAC5B,KAAK,CAAC,WAAW;IACnB;AACF;AAEO,MAAM,kDAA4B;IACvC,YAAY,OAAgB,CAAE;QAC5B,KAAK,CAAC,WAAW;IACnB;AACF;AAEO,MAAM,kDAA0B;IACrC,YAAY,OAAgB,CAAE;QAC5B,KAAK,CAAC,WAAW;IACnB;AACF;;;AC5BO,MAAM,4CAA8B;AAKpC,MAAM,4CAAsB,OACjC,WACA;IAEA,IAAI,CAAE,CAAA,YAAY,CAAA,GAAI,OAAO;IAE7B,MAAM,aAAa,IAAI;IACvB,MAAM,QAAQ,WAAW,IAAM,WAAW,MAAM,IAAI,MAAM,CAAC,mBAAmB,EAAE,UAAU,GAAG,CAAC,IAAI;IAClG,IAAI;QACF,OAAO,MAAM,QAAQ,WAAW;IAClC,SAAU;QACR,aAAa;IACf;AACF;;;;;;ACLA,kFAAkF;AAClF,iFAAiF;A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M,YAAY;QAE7B;QACA,OAAO;IACT;IAEA,IAAI,IAAI,WAAW,OAAO,MAAM;QAC9B,MAAM,SAAS,MAAM;QACrB,MAAM,UAAU,OAAO,MAAM,CAAC,IAAM,EAAE;QACtC,6EAA6E;QAC7E,+EAA+E;QAC/E,sEAAsE;QACtE,OAAO,MAAM,OAAO,UAAU,MAAM,KAAK,KAAK;YAC5C,QAAQ,UAAU,OAAO;YACzB,QAAQ,OAAO,YAAY,OAAO,IAAI,CAAC,IAAM;oBAAC,EAAE;oBAAS,EAAE,KAAK,OAAO;iBAAc;QACvF;IACF;IAEA,IAAI,IAAI,YAAY,OAAO,MAAM;QAC/B,MAAM,UAAU,MAAM,QAAQ,SAAS;QAClC,MAAM,OAAO,KAAK,OAAO,gBAAgB,QAAQ,SAAS,aAAa,KAAK;IACnF;IAEA,MAAM,YAAY,CAAA,GAAA,yCAAS,EAAE;mBAC3B;sBACA;kBACA;QACA,SAAS;YACP,mBAAmB,QAAQ;YAC3B,mBAAmB,QAAQ;QAC7B;oBACA;sBACA;2BACA;IACF;IAEA,MAAM,eAAe,CAAA,GAAA,yCAAkB,EAAE;QACvC,KAAK,UAAU;QACf,WAAW,UAAU;QACrB,gBAAgB,UAAU;QAC1B,WAAW,IAAM,QAAQ,sBAAsB,IAAI;gBAAE,OAAO;YAAO;IACrE;IAMK,IAAI,SAAS,CAAC;QACjB,MAAM,QAAQ,cAAc;QAC5B,MAAM,KAAK,QAAQ;QACnB,OAAO,QAAQ;IACjB;AACF;;","sources":["packages/api/rpc-proxy/src/index.ts","packages/api/rpc-proxy/src/rpcFactory/rpcFactory.ts","packages/api/rpc-proxy/src/redactUrls.ts","packages/api/rpc-proxy/src/rpcFactory/errors.ts","packages/api/rpc-proxy/src/rpcFactory/upstreamTimeout.ts","packages/api/rpc-proxy/src/rpcFactory/validation.ts","packages/api/rpc-proxy/src/rpcFactory/types.ts","packages/api/rpc-proxy/src/rateLimit/rateLimit.ts","packages/api/rpc-proxy/src/rateLimit/constants.ts","packages/api/rpc-proxy/src/rateLimit/fixedWindowStore.ts","packages/api/rpc-proxy/src/rateLimit/getClientIp.ts","packages/api/rpc-proxy/src/health.ts","packages/api/rpc-proxy/src/metrics.ts","packages/api/rpc-proxy/src/routes.ts"],"sourcesContent":["export { rpcFactory } from './rpcFactory/rpcFactory'\nexport * from './rpcFactory/types'\nexport * from './rpcFactory/errors'\nexport {\n baseRequestValidationFactory,\n ethCallValidationFactory,\n ethGetLogsValidationFactory,\n rpcMethodsValidationFactory,\n shouldValidateRpcMethod,\n streamMaxSizeValidationFactory,\n} from './rpcFactory/validation'\n\nexport { createRateLimitHook } from './rateLimit/rateLimit'\nexport type { RateLimitOptions } from './rateLimit/rateLimit'\nexport { FixedWindowStore } from './rateLimit/fixedWindowStore'\nexport { getClientIp, normalizeIp } from './rateLimit/getClientIp'\nexport { RATE_LIMIT_ERROR_MESSAGE, RATE_LIMIT_HEADERS } from './rateLimit/constants'\n\nexport { probeChains } from './health'\nexport type { ChainProbeResult, ProbeChainsOptions } from './health'\n\nexport { createRpcProxyMetrics } from './metrics'\nexport type { CreateRpcProxyMetricsOptions, RpcProxyMetrics } from './metrics'\n\nexport { registerRpcProxyRoutes } from './routes'\nexport type { RegisterRpcProxyRoutesOptions } from './routes'\n","// RPC proxy factory adapted from the @lidofinance/next-api-wrapper rpcFactory pattern\n// (https://github.com/lidofinance/lido-frontend-template).\n// Changes from the original:\n// - Ported from Next.js API routes to Fastify request handlers\n// - Added per-chain contract-address allowlist (eth_call / eth_getLogs restriction)\n// - Integrated @lidofinance/api-rpc trackedFetchRpcFactory for prom-client metrics\nimport { Readable } from 'node:stream'\nimport { pipeline } from 'node:stream/promises'\nimport { ReadableStream } from 'node:stream/web'\nimport { iterateUrls } from '@lidofinance/rpc'\n\nimport { redactUrls } from '../redactUrls'\n\nimport { ClientError, DEFAULT_API_ERROR_MESSAGE, HEALTHY_RPC_SERVICES_ARE_OVER, SizeTooLargeError } from './errors'\nimport { DEFAULT_UPSTREAM_TIMEOUT_MS, withUpstreamTimeout } from './upstreamTimeout'\n\nimport type { RPCFactoryParams } from './types'\nimport {\n baseRequestValidationFactory,\n ethCallValidationFactory,\n ethGetLogsValidationFactory,\n rpcMethodsValidationFactory,\n shouldValidateRpcMethod,\n streamMaxSizeValidationFactory,\n} from './validation'\nimport type { FetchRpcInitBody } from '@lidofinance/rpc'\nimport type { FastifyReply, FastifyRequest } from 'fastify'\n\ntype RpcQuery = { chainId?: string }\n\nexport const rpcFactory = ({\n providers,\n fetchRPC,\n defaultChain,\n validation,\n serverLogger = console,\n metrics,\n upstreamTimeoutMs = DEFAULT_UPSTREAM_TIMEOUT_MS,\n}: RPCFactoryParams) => {\n const {\n allowedRPCMethods,\n allowedCallAddresses,\n allowedLogsAddresses,\n maxResponseSize = 1_000_000,\n maxBatchCount = 20,\n currentBlockTTLms = 60_000,\n maxGetLogsRange = 20_000,\n blockEmptyAddressGetLogs = true,\n } = validation\n\n // 'any' is an explicit opt-out: no method / address check\n const rpcMethods = allowedRPCMethods === 'any' ? undefined : allowedRPCMethods\n const callAddresses = allowedCallAddresses === 'any' ? undefined : allowedCallAddresses\n const logsAddresses = allowedLogsAddresses === 'any' ? undefined : allowedLogsAddresses\n\n const rpcRequestBlocked = metrics?.rpcRequestBlocked ?? {\n inc: (_labels: { reason: string }) => {},\n }\n const rpcRequestMethods = metrics?.rpcRequestMethods\n\n const validateBaseRequest = baseRequestValidationFactory(defaultChain, providers, maxBatchCount)\n const validateRpcMethod = rpcMethodsValidationFactory(rpcMethods)\n\n const validateEthCall =\n callAddresses && shouldValidateRpcMethod('eth_call', rpcMethods)\n ? ethCallValidationFactory(callAddresses)\n : undefined\n\n const validateEthGetLogs =\n (logsAddresses || blockEmptyAddressGetLogs) && shouldValidateRpcMethod('eth_getLogs', rpcMethods)\n ? ethGetLogsValidationFactory(logsAddresses, blockEmptyAddressGetLogs, maxGetLogsRange, currentBlockTTLms)\n : undefined\n\n const validateMaxSteamSize = streamMaxSizeValidationFactory(maxResponseSize)\n\n const requestRPC = (chainId: number, body: FetchRpcInitBody) =>\n iterateUrls(\n providers[chainId],\n (url: string) =>\n withUpstreamTimeout(upstreamTimeoutMs, (signal) =>\n fetchRPC(url, { body, ...(signal ? { signal } : {}) }, { chainId }),\n ),\n (error: unknown) => {\n const message = redactUrls(error instanceof Error ? error.message : String(error))\n serverLogger.warn(`[rpcFactory] provider failed for chain ${chainId}: ${message}`)\n },\n )\n\n return async (request: FastifyRequest<{ Querystring: RpcQuery }>, reply: FastifyReply): Promise<void> => {\n const abortController = new AbortController()\n try {\n const { chainId, requests } = validateBaseRequest(request)\n\n const validationContext = { chainId, rpcRequestBlocked, requestRPC }\n\n for (const req of requests) {\n validateRpcMethod(req, validationContext)\n rpcRequestMethods?.inc({ method: req.method })\n\n if (req.method === 'eth_call' && validateEthCall) {\n validateEthCall(req, validationContext)\n }\n if (req.method === 'eth_getLogs' && validateEthGetLogs) {\n await validateEthGetLogs(req, validationContext)\n }\n }\n\n const proxiedRPC = await requestRPC(chainId, request.body as FetchRpcInitBody)\n\n // iterateUrls returns the last response when no provider answered ok;\n // never relay a provider's error body to the client as a success.\n if (!proxiedRPC.ok) {\n await proxiedRPC.body?.cancel().catch(() => undefined)\n void reply.status(502).send(DEFAULT_API_ERROR_MESSAGE)\n return\n }\n\n // Reject a declared oversized body before streaming starts — once bytes are on the\n // wire the status can no longer change and the stream is only cut short.\n const contentLength = Number(proxiedRPC.headers.get('content-length'))\n if (contentLength > maxResponseSize) {\n await proxiedRPC.body?.cancel().catch(() => undefined)\n rpcRequestBlocked.inc({ reason: 'response too large' })\n throw new SizeTooLargeError(`Stream size exceeds the maximum limit of ${maxResponseSize} bytes`)\n }\n\n void reply.header('content-type', proxiedRPC.headers.get('content-type') ?? 'application/json')\n\n if (!proxiedRPC.body) {\n throw new Error('There are problems with RPC provider')\n }\n\n await pipeline(\n Readable.fromWeb(proxiedRPC.body as ReadableStream),\n validateMaxSteamSize(validationContext),\n reply.raw,\n { signal: abortController.signal },\n )\n } catch (error) {\n if (error instanceof ClientError) {\n if (!reply.raw.headersSent) {\n void reply\n .status(error instanceof SizeTooLargeError ? 413 : 400)\n .send(error.message ?? DEFAULT_API_ERROR_MESSAGE)\n }\n } else if (error instanceof Error) {\n serverLogger.error('[rpcFactory] ' + redactUrls(error.message ?? DEFAULT_API_ERROR_MESSAGE))\n if (!reply.sent) {\n void reply.status(500).send(DEFAULT_API_ERROR_MESSAGE)\n }\n } else {\n void reply.status(500).send(HEALTHY_RPC_SERVICES_ARE_OVER)\n }\n } finally {\n abortController.abort()\n }\n }\n}\n","const URL_PATTERN = /\\b(?:https?|wss?):\\/\\/[^\\s'\"<>]+/gi\n\nconst toHost = (url: string) => {\n try {\n return new URL(url).hostname\n } catch {\n return '<url>'\n }\n}\n\n// Provider URLs usually carry the API key in the path or query, so anything that\n// ends up in a log line is reduced to the provider's hostname.\nexport const redactUrls = (text: string) => text.replace(URL_PATTERN, toHost)\n","export const DEFAULT_API_ERROR_MESSAGE = 'Something went wrong. Sorry, try again later :('\n\nexport const HEALTHY_RPC_SERVICES_ARE_OVER = 'Healthy RPC services are over!'\n\nexport class ClientError extends Error {}\n\nexport class UnsupportedChainIdError extends ClientError {\n constructor(message?: string) {\n super(message || 'Unsupported chainId')\n }\n}\n\nexport class UnsupportedHTTPMethodError extends ClientError {\n constructor(message?: string) {\n super(message || 'Unsupported HTTP method')\n }\n}\n\nexport class InvalidRequestError extends ClientError {\n constructor(message?: string) {\n super(message || 'Invalid Request')\n }\n}\n\nexport class SizeTooLargeError extends ClientError {\n constructor(message?: string) {\n super(message || 'Response size too large')\n }\n}\n","export const DEFAULT_UPSTREAM_TIMEOUT_MS = 10_000\n\n// Runs `request` with a signal that aborts when the provider has not started answering within\n// timeoutMs. The timer stops once the request settles, i.e. when the response headers arrive,\n// so a long response body is never cut short. 0 turns the limit off.\nexport const withUpstreamTimeout = async <T>(\n timeoutMs: number,\n request: (signal?: AbortSignal) => Promise<T>,\n): Promise<T> => {\n if (!(timeoutMs > 0)) return request()\n\n const controller = new AbortController()\n const timer = setTimeout(() => controller.abort(new Error(`no response within ${timeoutMs} ms`)), timeoutMs)\n try {\n return await request(controller.signal)\n } finally {\n clearTimeout(timer)\n }\n}\n","import { Transform } from 'node:stream'\n\nimport { Cache } from 'memory-cache'\n\nimport { ClientError, InvalidRequestError, SizeTooLargeError, UnsupportedChainIdError } from './errors'\n\nimport type { RpcRequest, ValidationContext } from './types'\n\ntype BaseRequest = {\n query: { chainId?: string | string[] }\n body: unknown\n}\n\n// BigInt(0), not a 0n literal — this file is type-checked under the repo's shared\n// root tsconfig (target es5) whenever a sibling package without its own tsconfig\n// runs `tsc`, and BigInt literal syntax requires an ES2020+ target to parse.\nconst zeroBN = BigInt(0)\n\nconst HEX_BLOCK_NUMBER = /^0x[0-9a-fA-F]+$/\n// Tags that resolve within a few blocks of head, far below any sane maxGetLogsRange\nconst NEAR_HEAD_BLOCK_TAGS = new Set(['latest', 'safe', 'finalized', 'pending'])\n\nexport const baseRequestValidationFactory = (\n defaultChain: number | string,\n providers: Record<string, unknown>,\n maxBatchSize?: number,\n) => {\n return (req: BaseRequest) => {\n const rawChainId = Array.isArray(req.query.chainId) ? req.query.chainId[0] : req.query.chainId\n\n const chainId = Number(rawChainId || defaultChain)\n\n if (providers[chainId] == null) {\n throw new UnsupportedChainIdError()\n }\n\n const requests = Array.isArray(req.body) ? req.body : [req.body]\n\n if (typeof maxBatchSize === 'number' && requests.length > maxBatchSize) {\n throw new InvalidRequestError(`Too many batched requests`)\n }\n return { chainId, requests }\n }\n}\n\nexport const rpcMethodsValidationFactory = (allowedMethods?: string[]) => {\n const methodsMap = new Set(allowedMethods ?? [])\n\n return (request: RpcRequest, context: ValidationContext) => {\n const method = request.method\n if (typeof method !== 'string') {\n throw new InvalidRequestError(`RPC method isn't string`)\n }\n if (allowedMethods && !methodsMap.has(request.method)) {\n context.rpcRequestBlocked.inc({ reason: 'method not allowed' })\n throw new InvalidRequestError(`RPC method ${method} not allowed`)\n }\n }\n}\n\nexport const ethCallValidationFactory = (allowedAddress: Record<number, string[]>) => {\n const allowedCallAddressMap = createAllowedAddressMap(allowedAddress)\n\n return (request: RpcRequest, { chainId, rpcRequestBlocked }: ValidationContext) => {\n const { params } = request\n\n // Explicitly reject any request whose first param is not a well-formed tx object.\n // Using an early-return guard keeps the \"address allowed?\" check unconditionally\n // reachable and prevents future edits to the condition from accidentally creating\n // a path that forwards an unvalidated eth_call.\n const txObject = Array.isArray(params) ? params[0] : undefined\n\n if (\n txObject == null ||\n typeof txObject !== 'object' ||\n !('to' in txObject) ||\n typeof (txObject as Record<string, unknown>).to !== 'string'\n ) {\n throw new InvalidRequestError(`RPC method eth_call is invalid`)\n }\n\n const toAddress = (txObject as { to: string }).to\n\n if (!allowedCallAddressMap[chainId]?.has(toAddress.toLowerCase())) {\n rpcRequestBlocked.inc({ reason: 'address not allowed for eth_call' })\n throw new InvalidRequestError(`Address not allowed for eth_call`)\n }\n }\n}\n\nexport const ethGetLogsValidationFactory = (\n allowedAddress: Record<number, string[]> | undefined,\n blockEmptyAddressGetLogs: boolean | undefined,\n maxBlockRange: number | undefined,\n currentBlockTTL = 60_000,\n) => {\n const allowedAddressMap = createAllowedAddressMap(allowedAddress ?? {})\n const maxBlockRangeBN = maxBlockRange ? BigInt(maxBlockRange) : zeroBN\n const currentBlock = new Cache<number, bigint>()\n\n return async (request: RpcRequest, { chainId, rpcRequestBlocked, requestRPC }: ValidationContext) => {\n try {\n const params = request.params[0] as any\n const fromBlock: string = params.fromBlock\n const toBlock: string = params.toBlock ?? 'latest'\n\n if (blockEmptyAddressGetLogs || allowedAddress) {\n const address: string | string[] = params.address\n\n if (blockEmptyAddressGetLogs && !address)\n throw new InvalidRequestError(`RPC method eth_getLogs address is invalid`)\n\n const addresses = Array.isArray(address) ? address : [address]\n\n if (blockEmptyAddressGetLogs && addresses.length === 0) {\n throw new InvalidRequestError(`RPC method eth_getLogs address is invalid`)\n }\n if (\n allowedAddress &&\n addresses.some(\n (eventAddress) =>\n typeof eventAddress !== 'string' || !allowedAddressMap[chainId]?.has(eventAddress.toLowerCase()),\n )\n ) {\n rpcRequestBlocked.inc({ reason: 'address not allowed for eth_getLogs' })\n throw new InvalidRequestError(`Address not allowed for eth_getLogs`)\n }\n }\n\n if (maxBlockRange) {\n if (fromBlock === 'earliest') throw new InvalidRequestError(`RPC method eth_getLogs fromBlock is invalid`)\n // Anything that is neither a hex number nor a near-head tag would skip the range check\n if (!HEX_BLOCK_NUMBER.test(fromBlock) && !NEAR_HEAD_BLOCK_TAGS.has(fromBlock)) {\n throw new InvalidRequestError(`RPC method eth_getLogs fromBlock is invalid`)\n }\n\n if (fromBlock.startsWith('0x')) {\n const normalizedFromBlock = BigInt(fromBlock)\n let normalizedToBlock: bigint\n\n if (toBlock.startsWith('0x')) {\n normalizedToBlock = BigInt(toBlock)\n } else {\n const cached = currentBlock.get(chainId)\n if (cached) {\n normalizedToBlock = cached\n } else {\n normalizedToBlock = await requestRPC(chainId, {\n id: 1,\n jsonrpc: '2.0',\n method: 'eth_blockNumber',\n })\n .then((res) => res.json() as Promise<{ result: string }>)\n .then((res) => BigInt(res.result))\n currentBlock.put(chainId, normalizedToBlock, currentBlockTTL)\n }\n }\n\n const range = normalizedToBlock - normalizedFromBlock\n if (range < zeroBN || range > maxBlockRangeBN) {\n rpcRequestBlocked.inc({ reason: 'eth_getLogs range is invalid' })\n throw new InvalidRequestError(`RPC method eth_getLogs range is invalid`)\n }\n }\n }\n } catch (error) {\n if (error instanceof ClientError) throw error\n throw new InvalidRequestError(`RPC method eth_getLogs is invalid`)\n }\n }\n}\n\nexport const streamMaxSizeValidationFactory = (MAX_SIZE: number) => (context: ValidationContext) => {\n let bytesWritten = 0\n return new Transform({\n transform(chunk, _encoding, callback) {\n bytesWritten += chunk.length\n if (bytesWritten > MAX_SIZE) {\n context.rpcRequestBlocked.inc({ reason: 'response too large' })\n return callback(new SizeTooLargeError(`Stream size exceeds the maximum limit of ${MAX_SIZE} bytes`))\n }\n return callback(null, chunk)\n },\n flush(callback) {\n callback()\n },\n })\n}\n\n// utils\n\nexport const shouldValidateRpcMethod = (method: string, allowedRPCMethods?: string[]) =>\n !allowedRPCMethods || allowedRPCMethods.includes(method)\n\nconst createAllowedAddressMap = (allowedAddress: Record<number, string[]>) =>\n Object.entries(allowedAddress).reduce((acc, [chainId, addresses]) => {\n acc[chainId] = new Set(addresses.map((a) => a.toLowerCase()))\n return acc\n }, {} as Record<string, Set<string>>)\n","import type { FetchRpcInit, FetchRpcInitBody } from '@lidofinance/rpc'\n\nexport type RpcProviders = Record<string | number, [string, ...string[]]>\n\nexport type AddressAllowlist = Record<number, string[]> | 'any'\n\nexport type MethodAllowlist = string[] | 'any'\n\nexport type RPCFactoryValidationParams = {\n maxBatchCount?: number\n maxResponseSize?: number\n // Required: the allowed JSON-RPC methods, or 'any' to allow every method deliberately\n allowedRPCMethods: MethodAllowlist\n // Required: the per-chain address lists, or 'any' to allow every address\n // deliberately (e.g. user-deployed contracts)\n allowedCallAddresses: AddressAllowlist\n allowedLogsAddresses: AddressAllowlist\n blockEmptyAddressGetLogs?: boolean\n maxGetLogsRange?: number\n currentBlockTTLms?: number\n}\n\nexport type FetchRPC = (url: string, init: FetchRpcInit, meta: { chainId: number | string }) => Promise<Response>\n\nexport type RPCFactoryMetrics = {\n rpcRequestBlocked: RpcRequestBlockedCounter\n rpcRequestMethods?: { inc(labels: { method: string }): void }\n}\n\nexport type RPCFactoryParams = {\n providers: RpcProviders\n fetchRPC: FetchRPC\n defaultChain: string | number\n validation: RPCFactoryValidationParams\n serverLogger?: Pick<Console, 'warn' | 'error'>\n metrics?: RPCFactoryMetrics\n // Per-provider time limit (ms) for the provider to start answering; the response body is not timed.\n // A provider that exceeds it counts as failed and the next URL is tried. 10 000 by default, 0 turns it off.\n upstreamTimeoutMs?: number\n}\n\nexport type RpcRequest = {\n method: string\n params: unknown[]\n}\n\nexport type RpcRequestBlockedCounter = {\n inc(labels: { reason: string }): void\n}\n\nexport type ValidationContext = {\n chainId: number\n rpcRequestBlocked: RpcRequestBlockedCounter\n requestRPC: (chainId: number, body: FetchRpcInitBody) => Promise<Response>\n}\n","import { RATE_LIMIT_ERROR_MESSAGE, RATE_LIMIT_HEADERS } from './constants'\nimport { FixedWindowStore } from './fixedWindowStore'\nimport { getClientIp } from './getClientIp'\nimport type { FastifyReply, FastifyRequest } from 'fastify'\n\nexport type RateLimitOptions = {\n max: number\n windowSec: number\n customIpHeader?: string\n onBlocked?: (ip: string) => void\n}\n\n// Fixed-window per-IP limiter, adapted as a Fastify preHandler from\n// https://github.com/lidofinance/warehouse/blob/main/packages/next/ip-rate-limit\n// (a Next.js API-route wrapper — this repo has no Next.js, so the counting\n// and IP-extraction ideas are ported by hand rather than installed).\n// One store instance per createRateLimitHook call — call it once per route so\n// separate routes (e.g. /rpc and /api/csp-report) don't share a budget.\nexport const createRateLimitHook = ({ max, windowSec, customIpHeader, onBlocked }: RateLimitOptions) => {\n const store = new FixedWindowStore()\n\n return async (req: FastifyRequest, reply: FastifyReply): Promise<void> => {\n const ip = getClientIp(req, customIpHeader)\n const now = Date.now() / 1000\n const window = Math.floor(now / windowSec)\n const key = `${ip}:${window}`\n\n const count = store.increment(key, windowSec)\n const remaining = max - count\n const reset = (window + 1) * windowSec\n\n void reply.header(RATE_LIMIT_HEADERS.limit, String(max))\n void reply.header(RATE_LIMIT_HEADERS.remaining, String(Math.max(remaining, 0)))\n void reply.header(RATE_LIMIT_HEADERS.reset, String(reset))\n\n if (remaining < 0) {\n const retryAfter = Math.max(Math.ceil(reset - now), 0)\n void reply.header('Retry-After', String(retryAfter))\n onBlocked?.(ip)\n void reply.status(429).send(`${RATE_LIMIT_ERROR_MESSAGE} for ip:${ip}`)\n }\n }\n}\n","export const RATE_LIMIT_HEADERS = {\n limit: 'X-RateLimit-Limit',\n remaining: 'X-RateLimit-Remaining',\n reset: 'X-RateLimit-Reset',\n} as const\n\nexport const RATE_LIMIT_ERROR_MESSAGE = 'Rate limit exceeded'\n","type StoreEntry = { value: number; timeoutId: NodeJS.Timeout }\n\n// Fixed-window counter: each key auto-expires durationSec after it was last\n// touched, so no separate sweep/cron is needed to bound memory. Adapted from\n// https://github.com/lidofinance/warehouse/blob/main/packages/next/ip-rate-limit/src/storage.ts,\n// itself based on nestjs/throttler's setTimeout-per-key approach.\nexport class FixedWindowStore {\n private store = new Map<string, StoreEntry>()\n\n private set(key: string, value: number, durationSec: number) {\n clearTimeout(this.store.get(key)?.timeoutId)\n\n const timeoutId = setTimeout(() => this.store.delete(key), durationSec * 1000)\n // This is a cache-eviction timer, not pending work — it must not keep the\n // process alive on its own (matters for a long-running server, unlike the\n // serverless functions the ported design originally ran in).\n timeoutId.unref()\n\n this.store.set(key, { value, timeoutId })\n }\n\n get(key: string): number | undefined {\n return this.store.get(key)?.value\n }\n\n increment(key: string, durationSec: number): number {\n const next = (this.get(key) ?? 0) + 1\n this.set(key, next, durationSec)\n return next\n }\n}\n","import { isIP } from 'node:net'\nimport type { FastifyRequest } from 'fastify'\n\nexport const normalizeIp = (ip: string): string => ip.trim().replace(/^::ffff:/i, '')\n\nconst firstValidIp = (value: string | string[] | undefined): string | undefined => {\n const raw = Array.isArray(value) ? value[0] : value\n if (!raw) return undefined\n const candidate = normalizeIp(raw.split(',')[0] ?? '')\n return candidate && isIP(candidate) ? candidate : undefined\n}\n\n// req.ip is already the right answer for X-Forwarded-For: Fastify's trustProxy\n// option (see server/index.ts, set to TRUSTED_PROXY_HOPS) walks exactly that\n// many hops back through the header via @fastify/proxy-addr, which is the\n// correct way to find the real client through this app's one nginx hop. X-\n// Forwarded-For is never read directly here — a client can set that header to\n// anything, and only Fastify's hop-counted view of it is trustworthy.\n//\n// customIpHeader is for an edge/CDN in front of nginx (e.g. Cloudflare's\n// cf-connecting-ip) that knows the client's IP authoritatively, independent of\n// hop counting. It's validated with isIP so a spoofed or garbage value falls\n// through to req.ip instead of being trusted blindly — ported from\n// https://github.com/lidofinance/warehouse/blob/main/packages/next/ip-rate-limit/src/utils.ts,\n// adapted from Next's per-request customIpHeader to Fastify + trustProxy.\nexport const getClientIp = (req: FastifyRequest, customIpHeader?: string): string => {\n const customIp = customIpHeader ? firstValidIp(req.headers[customIpHeader.toLowerCase()]) : undefined\n\n return customIp ?? normalizeIp(req.ip || '0.0.0.0')\n}\n","import { redactUrls } from './redactUrls'\n\nimport type { FetchRPC, RpcProviders } from './rpcFactory/types'\n\nexport type ChainProbeResult = { chainId: string; ok: boolean }\n\nexport type ProbeChainsOptions = {\n fetchRPC: FetchRPC\n timeoutMs?: number\n onResult?: (result: ChainProbeResult) => void\n logger?: Pick<Console, 'warn'>\n}\n\nconst DEFAULT_HEALTH_TIMEOUT_MS = 5_000\n\n// Probes every configured URL per chain in parallel — matching the runtime fallback\n// semantics of iterateUrls in rpcFactory. A chain is healthy when at least one URL\n// responds, so a single-provider outage doesn't fail a proxy that has working fallbacks.\nexport const probeChains = async (\n providers: RpcProviders,\n { fetchRPC, timeoutMs = DEFAULT_HEALTH_TIMEOUT_MS, onResult, logger = console }: ProbeChainsOptions,\n): Promise<ChainProbeResult[]> => {\n const results = await Promise.all(\n Object.entries(providers).map(async ([chainId, urls]) => {\n const urlResults = await Promise.all(\n urls.map(async (url) => {\n try {\n const response = await fetchRPC(\n url,\n {\n body: { id: 1, jsonrpc: '2.0', method: 'eth_blockNumber', params: [] },\n signal: AbortSignal.timeout(timeoutMs),\n },\n { chainId },\n )\n const { result } = (await response.json()) as { result?: unknown }\n return response.ok && result != null\n } catch (error) {\n const reason = redactUrls(error instanceof Error ? error.message : String(error))\n logger.warn(`[health] probe failed for chain ${chainId} provider ${redactUrls(url)}: ${reason}`)\n return false\n }\n }),\n )\n const ok = urlResults.some(Boolean)\n return { chainId, ok }\n }),\n )\n for (const result of results) {\n onResult?.(result)\n }\n return results\n}\n","import { trackedFetchRpcFactory } from '@lidofinance/api-rpc'\nimport { Counter, Gauge, Histogram, Registry, collectDefaultMetrics } from 'prom-client'\n\nimport type { FetchRPC } from './rpcFactory/types'\n\nexport type RpcProxyMetrics = {\n registry: Registry\n fetchRPC: FetchRPC\n rpcRequestBlocked: Counter<'reason'>\n rpcRequestMethods: Counter<'method'>\n rateLimitBlockedCount: Counter<'route'>\n apiResponse: Histogram<'method' | 'route' | 'status'>\n rpcChainReachable: Gauge<'chainId'>\n}\n\nexport type CreateRpcProxyMetricsOptions = {\n // Prefix applied to every metric name registered by this factory, including the\n // request/response counters trackedFetchRpcFactory registers into `registry`.\n prefix: string\n registry?: Registry\n // Set false when the consuming app already calls prom-client's collectDefaultMetrics\n // itself (e.g. to combine it with its own startup metrics) — avoids double-registering.\n collectDefault?: boolean\n}\n\n// Prom-client metrics for a Fastify RPC proxy: blocked/allowed request counts,\n// per-IP rate-limit blocks, HTTP response timings and per-chain reachability —\n// plus a metrics-tracked fetchRPC (via @lidofinance/api-rpc) to pass into rpcFactory.\nexport const createRpcProxyMetrics = ({\n prefix,\n registry = new Registry(),\n collectDefault = true,\n}: CreateRpcProxyMetricsOptions): RpcProxyMetrics => {\n const rpcRequestBlocked = new Counter({\n name: `${prefix}rpc_request_blocked_total`,\n help: 'Number of blocked RPC requests by reason',\n labelNames: ['reason'] as const,\n registers: [registry],\n })\n\n // Client-requested RPC methods, counted at validation time — before a request is\n // blocked or forwarded. Distinct from fetchRPC's own request-methods counter (from\n // @lidofinance/api-rpc), which only counts methods that actually reached a provider.\n const rpcRequestMethods = new Counter({\n name: `${prefix}rpc_request_methods`,\n help: 'RPC methods requested by clients, by method',\n labelNames: ['method'] as const,\n registers: [registry],\n })\n\n const rateLimitBlockedCount = new Counter({\n name: `${prefix}rate_limit_blocked_total`,\n help: 'Number of requests rejected by the in-process per-IP rate limiter, by route',\n labelNames: ['route'] as const,\n registers: [registry],\n })\n\n const apiResponse = new Histogram({\n name: `${prefix}api_response_seconds`,\n help: 'API response time',\n buckets: [0.1, 0.2, 0.3, 0.6, 1, 1.5, 2, 5],\n labelNames: ['method', 'route', 'status'] as const,\n registers: [registry],\n })\n\n const rpcChainReachable = new Gauge({\n name: `${prefix}rpc_chain_reachable`,\n help: '1 if the RPC endpoint for the chain is reachable, 0 otherwise',\n labelNames: ['chainId'] as const,\n registers: [registry],\n })\n\n // Registers its own request/response/methods/result counters into `registry`.\n const fetchRPC = trackedFetchRpcFactory({ prefix, registry })\n\n if (collectDefault) {\n collectDefaultMetrics({ register: registry, prefix })\n }\n\n return {\n registry,\n fetchRPC,\n rpcRequestBlocked,\n rpcRequestMethods,\n rateLimitBlockedCount,\n apiResponse,\n rpcChainReachable,\n }\n}\n","import { getStatusLabel } from '@lidofinance/api-metrics'\n\nimport { probeChains } from './health'\nimport { createRateLimitHook } from './rateLimit/rateLimit'\nimport { rpcFactory } from './rpcFactory/rpcFactory'\n\nimport type { ChainProbeResult } from './health'\nimport type { RpcProxyMetrics } from './metrics'\nimport type { RPCFactoryValidationParams, FetchRPC, RpcProviders } from './rpcFactory/types'\nimport type { FastifyInstance } from 'fastify'\n\nconst DEFAULT_HEALTH_CACHE_MS = 5_000\n\nexport type RegisterRpcProxyRoutesOptions = {\n providers: RpcProviders\n defaultChain: string | number\n fetchRPC: FetchRPC\n metrics: RpcProxyMetrics\n validation: RPCFactoryValidationParams\n rateLimit: {\n max: number\n windowSec: number\n customIpHeader?: string\n }\n healthTimeoutMs?: number\n // How long (ms) a /health probe result is reused. /health is unauthenticated and outside the rate\n // limiter, so without this every GET costs one upstream call per configured URL.\n // 5 000 by default, 0 probes on every request.\n healthCacheMs?: number\n upstreamTimeoutMs?: number\n serverLogger?: Pick<Console, 'warn' | 'error'>\n}\n\n// Wires /health, /metrics and /rpc onto a Fastify instance. Anything app-specific —\n// CSP reporting, extra routes, the fastify() bootstrap itself — stays with the caller.\nexport const registerRpcProxyRoutes = (app: FastifyInstance, options: RegisterRpcProxyRoutesOptions) => {\n const {\n providers,\n defaultChain,\n fetchRPC,\n metrics,\n validation,\n rateLimit,\n healthTimeoutMs,\n healthCacheMs = DEFAULT_HEALTH_CACHE_MS,\n upstreamTimeoutMs,\n serverLogger,\n } = options\n\n // Route label uses the matched route template (e.g. \"/rpc\"), not request.url —\n // avoid request.url here because unmatched URLs (404s) can blow up label\n // cardinality, hence the 'unknown' fallback instead. status is the aggregated\n // 2xx/4xx/… class, not the exact code.\n app.addHook('onResponse', (request, reply, done) => {\n metrics.apiResponse.observe(\n {\n method: request.method,\n route: request.routeOptions.url ?? 'unknown',\n status: getStatusLabel(reply.statusCode),\n },\n reply.elapsedTime / 1000,\n )\n done()\n })\n\n // A probe in flight is shared by every request that arrives meanwhile, and its result is\n // reused for healthCacheMs after it settles, so /health cannot be used to multiply upstream calls.\n let cachedProbe: { checks: Promise<ChainProbeResult[]>; expiresAt: number } | undefined\n\n const probe = () => {\n if (cachedProbe && Date.now() < cachedProbe.expiresAt) return cachedProbe.checks\n\n const checks = probeChains(providers, {\n fetchRPC,\n timeoutMs: healthTimeoutMs,\n onResult: ({ chainId, ok }) => metrics.rpcChainReachable.set({ chainId }, ok ? 1 : 0),\n logger: serverLogger,\n })\n if (healthCacheMs > 0) {\n const entry = { checks, expiresAt: Infinity }\n cachedProbe = entry\n checks.then(\n () => (entry.expiresAt = Date.now() + healthCacheMs),\n () => (entry.expiresAt = 0),\n )\n }\n return checks\n }\n\n app.get('/health', async (_req, reply) => {\n const checks = await probe()\n const healthy = checks.every((c) => c.ok)\n // Structured JSON (status code still carries the pass/fail signal for simple\n // probes like a Dockerfile's `wget --spider`) so infra/dashboards hitting this\n // directly can see which chain is unreachable, not just an aggregate.\n return reply.status(healthy ? 200 : 503).send({\n status: healthy ? 'ok' : 'degraded',\n chains: Object.fromEntries(checks.map((c) => [c.chainId, c.ok ? 'ok' : 'unreachable'])),\n })\n })\n\n app.get('/metrics', async (_req, reply) => {\n const content = await metrics.registry.metrics()\n void reply.status(200).header('Content-Type', metrics.registry.contentType).send(content)\n })\n\n const handleRpc = rpcFactory({\n providers,\n defaultChain,\n fetchRPC,\n metrics: {\n rpcRequestBlocked: metrics.rpcRequestBlocked,\n rpcRequestMethods: metrics.rpcRequestMethods,\n },\n validation,\n serverLogger,\n upstreamTimeoutMs,\n })\n\n const rpcRateLimit = createRateLimitHook({\n max: rateLimit.max,\n windowSec: rateLimit.windowSec,\n customIpHeader: rateLimit.customIpHeader,\n onBlocked: () => metrics.rateLimitBlockedCount.inc({ route: '/rpc' }),\n })\n\n // Encapsulated in its own plugin context (rather than passed via the route's\n // `preHandler` option) so the rate-limit hook's untyped FastifyRequest doesn't\n // get unified with handleRpc's typed `Querystring: RpcQuery` generic — that\n // unification otherwise collapses to `unknown` and fails to typecheck.\n void app.register((scope) => {\n scope.addHook('preHandler', rpcRateLimit)\n scope.post('/rpc', handleRpc)\n return Promise.resolve()\n })\n}\n"],"names":[],"version":3,"file":"index.cjs.map","sourceRoot":"../../../../"}
@@ -0,0 +1,152 @@
1
+ import { FetchRpcInit, FetchRpcInitBody } from "@lidofinance/rpc";
2
+ import { Transform } from "node:stream";
3
+ import { FastifyReply, FastifyRequest, FastifyInstance } from "fastify";
4
+ import { Counter, Gauge, Histogram, Registry } from "prom-client";
5
+ export const DEFAULT_API_ERROR_MESSAGE = "Something went wrong. Sorry, try again later :(";
6
+ export const HEALTHY_RPC_SERVICES_ARE_OVER = "Healthy RPC services are over!";
7
+ export class ClientError extends Error {
8
+ }
9
+ export class UnsupportedChainIdError extends ClientError {
10
+ constructor(message?: string);
11
+ }
12
+ export class UnsupportedHTTPMethodError extends ClientError {
13
+ constructor(message?: string);
14
+ }
15
+ export class InvalidRequestError extends ClientError {
16
+ constructor(message?: string);
17
+ }
18
+ export class SizeTooLargeError extends ClientError {
19
+ constructor(message?: string);
20
+ }
21
+ export type RpcProviders = Record<string | number, [string, ...string[]]>;
22
+ export type AddressAllowlist = Record<number, string[]> | 'any';
23
+ export type MethodAllowlist = string[] | 'any';
24
+ export type RPCFactoryValidationParams = {
25
+ maxBatchCount?: number;
26
+ maxResponseSize?: number;
27
+ allowedRPCMethods: MethodAllowlist;
28
+ allowedCallAddresses: AddressAllowlist;
29
+ allowedLogsAddresses: AddressAllowlist;
30
+ blockEmptyAddressGetLogs?: boolean;
31
+ maxGetLogsRange?: number;
32
+ currentBlockTTLms?: number;
33
+ };
34
+ export type FetchRPC = (url: string, init: FetchRpcInit, meta: {
35
+ chainId: number | string;
36
+ }) => Promise<Response>;
37
+ export type RPCFactoryMetrics = {
38
+ rpcRequestBlocked: RpcRequestBlockedCounter;
39
+ rpcRequestMethods?: {
40
+ inc(labels: {
41
+ method: string;
42
+ }): void;
43
+ };
44
+ };
45
+ export type RPCFactoryParams = {
46
+ providers: RpcProviders;
47
+ fetchRPC: FetchRPC;
48
+ defaultChain: string | number;
49
+ validation: RPCFactoryValidationParams;
50
+ serverLogger?: Pick<Console, 'warn' | 'error'>;
51
+ metrics?: RPCFactoryMetrics;
52
+ upstreamTimeoutMs?: number;
53
+ };
54
+ export type RpcRequest = {
55
+ method: string;
56
+ params: unknown[];
57
+ };
58
+ export type RpcRequestBlockedCounter = {
59
+ inc(labels: {
60
+ reason: string;
61
+ }): void;
62
+ };
63
+ export type ValidationContext = {
64
+ chainId: number;
65
+ rpcRequestBlocked: RpcRequestBlockedCounter;
66
+ requestRPC: (chainId: number, body: FetchRpcInitBody) => Promise<Response>;
67
+ };
68
+ type BaseRequest = {
69
+ query: {
70
+ chainId?: string | string[];
71
+ };
72
+ body: unknown;
73
+ };
74
+ export const baseRequestValidationFactory: (defaultChain: number | string, providers: Record<string, unknown>, maxBatchSize?: number) => (req: BaseRequest) => {
75
+ chainId: number;
76
+ requests: any[];
77
+ };
78
+ export const rpcMethodsValidationFactory: (allowedMethods?: string[]) => (request: RpcRequest, context: ValidationContext) => void;
79
+ export const ethCallValidationFactory: (allowedAddress: Record<number, string[]>) => (request: RpcRequest, { chainId, rpcRequestBlocked }: ValidationContext) => void;
80
+ export const ethGetLogsValidationFactory: (allowedAddress: Record<number, string[]> | undefined, blockEmptyAddressGetLogs: boolean | undefined, maxBlockRange: number | undefined, currentBlockTTL?: number) => (request: RpcRequest, { chainId, rpcRequestBlocked, requestRPC }: ValidationContext) => Promise<void>;
81
+ export const streamMaxSizeValidationFactory: (MAX_SIZE: number) => (context: ValidationContext) => Transform;
82
+ export const shouldValidateRpcMethod: (method: string, allowedRPCMethods?: string[]) => boolean;
83
+ type RpcQuery = {
84
+ chainId?: string;
85
+ };
86
+ export const rpcFactory: ({ providers, fetchRPC, defaultChain, validation, serverLogger, metrics, upstreamTimeoutMs, }: RPCFactoryParams) => (request: FastifyRequest<{
87
+ Querystring: RpcQuery;
88
+ }>, reply: FastifyReply) => Promise<void>;
89
+ export const RATE_LIMIT_HEADERS: {
90
+ readonly limit: "X-RateLimit-Limit";
91
+ readonly remaining: "X-RateLimit-Remaining";
92
+ readonly reset: "X-RateLimit-Reset";
93
+ };
94
+ export const RATE_LIMIT_ERROR_MESSAGE = "Rate limit exceeded";
95
+ export class FixedWindowStore {
96
+ get(key: string): number | undefined;
97
+ increment(key: string, durationSec: number): number;
98
+ }
99
+ export const normalizeIp: (ip: string) => string;
100
+ export const getClientIp: (req: FastifyRequest, customIpHeader?: string) => string;
101
+ export type RateLimitOptions = {
102
+ max: number;
103
+ windowSec: number;
104
+ customIpHeader?: string;
105
+ onBlocked?: (ip: string) => void;
106
+ };
107
+ export const createRateLimitHook: ({ max, windowSec, customIpHeader, onBlocked }: RateLimitOptions) => (req: FastifyRequest, reply: FastifyReply) => Promise<void>;
108
+ export type ChainProbeResult = {
109
+ chainId: string;
110
+ ok: boolean;
111
+ };
112
+ export type ProbeChainsOptions = {
113
+ fetchRPC: FetchRPC;
114
+ timeoutMs?: number;
115
+ onResult?: (result: ChainProbeResult) => void;
116
+ logger?: Pick<Console, 'warn'>;
117
+ };
118
+ export const probeChains: (providers: RpcProviders, { fetchRPC, timeoutMs, onResult, logger }: ProbeChainsOptions) => Promise<ChainProbeResult[]>;
119
+ export type RpcProxyMetrics = {
120
+ registry: Registry;
121
+ fetchRPC: FetchRPC;
122
+ rpcRequestBlocked: Counter<'reason'>;
123
+ rpcRequestMethods: Counter<'method'>;
124
+ rateLimitBlockedCount: Counter<'route'>;
125
+ apiResponse: Histogram<'method' | 'route' | 'status'>;
126
+ rpcChainReachable: Gauge<'chainId'>;
127
+ };
128
+ export type CreateRpcProxyMetricsOptions = {
129
+ prefix: string;
130
+ registry?: Registry;
131
+ collectDefault?: boolean;
132
+ };
133
+ export const createRpcProxyMetrics: ({ prefix, registry, collectDefault, }: CreateRpcProxyMetricsOptions) => RpcProxyMetrics;
134
+ export type RegisterRpcProxyRoutesOptions = {
135
+ providers: RpcProviders;
136
+ defaultChain: string | number;
137
+ fetchRPC: FetchRPC;
138
+ metrics: RpcProxyMetrics;
139
+ validation: RPCFactoryValidationParams;
140
+ rateLimit: {
141
+ max: number;
142
+ windowSec: number;
143
+ customIpHeader?: string;
144
+ };
145
+ healthTimeoutMs?: number;
146
+ healthCacheMs?: number;
147
+ upstreamTimeoutMs?: number;
148
+ serverLogger?: Pick<Console, 'warn' | 'error'>;
149
+ };
150
+ export const registerRpcProxyRoutes: (app: FastifyInstance, options: RegisterRpcProxyRoutesOptions) => void;
151
+
152
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;ACAA,OAAO,MAAM,6EAA6E,CAAA;AAE1F,OAAO,MAAM,gEAAgE,CAAA;AAE7E,wBAAyB,SAAQ,KAAK;CAAG;AAEzC,oCAAqC,SAAQ,WAAW;gBAC1C,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,uCAAwC,SAAQ,WAAW;gBAC7C,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,gCAAiC,SAAQ,WAAW;gBACtC,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED,8BAA+B,SAAQ,WAAW;gBACpC,OAAO,CAAC,EAAE,MAAM;CAG7B;AE1BD,2BAA2B,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC,CAAA;AAEzE,+B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A;IACvC,WAAW,EAAE,UAAU,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC,CAAA;IACrD,iBAAiB,EAAE,MAAM,SAAS,CAAC,CAAA;CACpC,CAAA;AAED,2CAA2C;IAGzC,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,QAAQ,CAAA;IAGnB,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB,CAAA;AAKD,OAAO,MAAM,+DAIV,4BAA4B,KAAG,eAwDjC,CAAA;AC3ED,4CAA4C;IAC1C,SAAS,EAAE,YAAY,CAAA;IACvB,YAAY,EAAE,MAAM,GAAG,MAAM,CAAA;IAC7B,QAAQ,EAAE,QAAQ,CAAA;IAClB,OAAO,EAAE,eAAe,CAAA;IACxB,UAAU,EAAE,0BAA0B,CAAA;IACtC,SAAS,EAAE;QACT,GAAG,EAAE,MAAM,CAAA;QACX,SAAS,EAAE,MAAM,CAAA;QACjB,cAAc,CAAC,EAAE,MAAM,CAAA;KACxB,CAAA;IACD,eAAe,CAAC,EAAE,MAAM,CAAA;IAIxB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,YAAY,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,CAAA;CAC/C,CAAA;AAID,OAAO,MAAM,8BAA+B,eAAe,WAAW,6BAA6B,SAoGlG,CAAA","sources":["packages/api/rpc-proxy/src/src/redactUrls.ts","packages/api/rpc-proxy/src/src/rpcFactory/errors.ts","packages/api/rpc-proxy/src/src/rpcFactory/upstreamTimeout.ts","packages/api/rpc-proxy/src/src/rpcFactory/types.ts","packages/api/rpc-proxy/src/src/rpcFactory/validation.ts","packages/api/rpc-proxy/src/src/rpcFactory/rpcFactory.ts","packages/api/rpc-proxy/src/src/rateLimit/constants.ts","packages/api/rpc-proxy/src/src/rateLimit/fixedWindowStore.ts","packages/api/rpc-proxy/src/src/rateLimit/getClientIp.ts","packages/api/rpc-proxy/src/src/rateLimit/rateLimit.ts","packages/api/rpc-proxy/src/src/health.ts","packages/api/rpc-proxy/src/src/metrics.ts","packages/api/rpc-proxy/src/src/routes.ts","packages/api/rpc-proxy/src/src/index.ts","packages/api/rpc-proxy/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,"export { rpcFactory } from './rpcFactory/rpcFactory'\nexport * from './rpcFactory/types'\nexport * from './rpcFactory/errors'\nexport {\n baseRequestValidationFactory,\n ethCallValidationFactory,\n ethGetLogsValidationFactory,\n rpcMethodsValidationFactory,\n shouldValidateRpcMethod,\n streamMaxSizeValidationFactory,\n} from './rpcFactory/validation'\n\nexport { createRateLimitHook } from './rateLimit/rateLimit'\nexport type { RateLimitOptions } from './rateLimit/rateLimit'\nexport { FixedWindowStore } from './rateLimit/fixedWindowStore'\nexport { getClientIp, normalizeIp } from './rateLimit/getClientIp'\nexport { RATE_LIMIT_ERROR_MESSAGE, RATE_LIMIT_HEADERS } from './rateLimit/constants'\n\nexport { probeChains } from './health'\nexport type { ChainProbeResult, ProbeChainsOptions } from './health'\n\nexport { createRpcProxyMetrics } from './metrics'\nexport type { CreateRpcProxyMetricsOptions, RpcProxyMetrics } from './metrics'\n\nexport { registerRpcProxyRoutes } from './routes'\nexport type { RegisterRpcProxyRoutesOptions } from './routes'\n"],"names":[],"version":3,"file":"index.d.ts.map","sourceRoot":"../../../../"}