Skip to content

Commit

Permalink
add validation
Browse files Browse the repository at this point in the history
  • Loading branch information
luu-alex committed Nov 5, 2023
1 parent d8422a6 commit f2de1bf
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/web3/src/web3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ export class Web3<
let context: Web3ContextObject;
let dataFormat: DataFormat = DEFAULT_RETURN_FORMAT;

// add validation so its not a breaking change
if (!isNullish(addressOrOptionsOrContext) && typeof addressOrOptionsOrContext !== 'object' && typeof addressOrOptionsOrContext !== 'string') {
throw new InvalidMethodParamsError();
}

if (typeof addressOrOptionsOrContext === 'string') {
address = addressOrOptionsOrContext;
}
Expand Down

0 comments on commit f2de1bf

Please sign in to comment.