From d919279cd9b1a9b38599abe94b7024251fef481b Mon Sep 17 00:00:00 2001 From: p70436464-prog Date: Mon, 31 Aug 2026 09:12:07 +0100 Subject: [PATCH] fix: Wrap all RPC methods with rate-limit logic --- src/soroban.ts | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/soroban.ts b/src/soroban.ts index 9792d54..266c3c0 100644 --- a/src/soroban.ts +++ b/src/soroban.ts @@ -100,19 +100,12 @@ export function createRpcServer(rpcUrl: string): SorobanRpc.Server { const server = getServer(rpcUrl); - const ASYNC_METHODS = [ - 'getAccount', - 'getEvents', - 'simulateTransaction', - 'getTransaction', - 'getLatestLedger', - 'getNetwork', - ]; + const EXCLUDED_METHODS = ['constructor']; const proxied = new Proxy(server, { get(target, propKey, receiver) { const origMethod = Reflect.get(target, propKey, receiver) as unknown; - if (typeof origMethod === 'function' && typeof propKey === 'string' && ASYNC_METHODS.includes(propKey)) { + if (typeof origMethod === 'function' && typeof propKey === 'string' && !EXCLUDED_METHODS.includes(propKey)) { return async function (...args: unknown[]) { const MAX_RETRIES = 3; let delay = 500;