Skip to content

Commit

Permalink
Assert BrowserProvider receives an EIP-1193 provider to fail early wh…
Browse files Browse the repository at this point in the history
…en passing undefined ethereum object.
  • Loading branch information
ricmoo committed Feb 2, 2024
1 parent 095de51 commit b69f43b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src.ts/providers/provider-browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ export class BrowserProvider extends JsonRpcApiPollingProvider {
* %%network%%.
*/
constructor(ethereum: Eip1193Provider, network?: Networkish) {
assertArgument(ethereum && ethereum.request, "invalid EIP-1193 provider", "ethereum", ethereum);

super(network, { batchMaxCount: 1 });

this.#request = async (method: string, params: Array<any> | Record<string, any>) => {
Expand Down

0 comments on commit b69f43b

Please sign in to comment.