Assert BrowserProvider receives an EIP-1193 provider to fail early when passing undefined ethereum object.

This commit is contained in:
Richard Moore 2024-02-02 03:10:40 -05:00
parent 095de51e60
commit b69f43bc6f

@ -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>) => {