From 7d150ac2fb5a323cb3dfe8743e2391d2e30cb9ad Mon Sep 17 00:00:00 2001 From: Maarten Zuidhoorn Date: Wed, 15 Nov 2023 16:19:13 +0100 Subject: [PATCH] Don't send undefined params --- jest.config.js | 6 +++--- src/BaseProvider.ts | 15 +++++++++++---- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/jest.config.js b/jest.config.js index 24a52259..0559a85a 100644 --- a/jest.config.js +++ b/jest.config.js @@ -45,10 +45,10 @@ const baseConfig = { // An object that configures minimum threshold enforcement for coverage results coverageThreshold: { global: { - branches: 64.78, + branches: 65.11, functions: 65.65, - lines: 66.66, - statements: 66.74, + lines: 66.74, + statements: 66.81, }, }, diff --git a/src/BaseProvider.ts b/src/BaseProvider.ts index a530f1f9..1605e080 100644 --- a/src/BaseProvider.ts +++ b/src/BaseProvider.ts @@ -208,11 +208,18 @@ export abstract class BaseProvider extends SafeEventEmitter { }); } + const payload = + params === undefined + ? { + method, + } + : { + method, + params, + }; + return new Promise((resolve, reject) => { - this._rpcRequest( - { method, params }, - getRpcPromiseCallback(resolve, reject), - ); + this._rpcRequest(payload, getRpcPromiseCallback(resolve, reject)); }); }