diff --git a/yarn-project/foundation/src/json-rpc/client/safe_json_rpc_client.ts b/yarn-project/foundation/src/json-rpc/client/safe_json_rpc_client.ts index 2de143063b6b..c1bd31c4c12a 100644 --- a/yarn-project/foundation/src/json-rpc/client/safe_json_rpc_client.ts +++ b/yarn-project/foundation/src/json-rpc/client/safe_json_rpc_client.ts @@ -44,18 +44,10 @@ export function createSafeJsonRpcClient( return (schema as ApiSchema)[methodName].returnType().parse(res.result); }; - // Intercept any RPC methods with a proxy - const proxy = new Proxy( - {}, - { - get: (target, method: string) => { - if (['then', 'catch'].includes(method)) { - return Reflect.get(target, method); - } - return (...params: any[]) => request(method, params); - }, - }, - ) as T; + const proxy: any = {}; + for (const method of Object.keys(schema)) { + proxy[method] = (...params: any[]) => request(method, params); + } - return proxy; + return proxy as T; }