Skip to content

Commit

Permalink
Don't send undefined params (#290)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrtenz authored Nov 15, 2023
1 parent ae74a05 commit d5d5de4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
6 changes: 3 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
},

Expand Down
15 changes: 11 additions & 4 deletions src/BaseProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,18 @@ export abstract class BaseProvider extends SafeEventEmitter {
});
}

const payload =
params === undefined
? {
method,
}
: {
method,
params,
};

return new Promise<T>((resolve, reject) => {
this._rpcRequest(
{ method, params },
getRpcPromiseCallback(resolve, reject),
);
this._rpcRequest(payload, getRpcPromiseCallback(resolve, reject));
});
}

Expand Down

0 comments on commit d5d5de4

Please sign in to comment.