Skip to content

Commit b69f43b

Browse files
committedFeb 2, 2024
Assert BrowserProvider receives an EIP-1193 provider to fail early when passing undefined ethereum object.
1 parent 095de51 commit b69f43b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed
 

‎src.ts/providers/provider-browser.ts

+2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ export class BrowserProvider extends JsonRpcApiPollingProvider {
4949
* %%network%%.
5050
*/
5151
constructor(ethereum: Eip1193Provider, network?: Networkish) {
52+
assertArgument(ethereum && ethereum.request, "invalid EIP-1193 provider", "ethereum", ethereum);
53+
5254
super(network, { batchMaxCount: 1 });
5355

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

0 commit comments

Comments
 (0)
Please sign in to comment.