diff --git a/.changeset/rich-dolls-argue.md b/.changeset/rich-dolls-argue.md new file mode 100644 index 0000000000..08fd02661c --- /dev/null +++ b/.changeset/rich-dolls-argue.md @@ -0,0 +1,5 @@ +--- +"@wagmi/core": patch +--- + +Added guard for missing `provider.on` for `injected` connector. diff --git a/packages/core/src/connectors/injected.ts b/packages/core/src/connectors/injected.ts index 5ffcd36f46..84fdc06e8e 100644 --- a/packages/core/src/connectors/injected.ts +++ b/packages/core/src/connectors/injected.ts @@ -151,7 +151,7 @@ export function injected(parameters: InjectedParameters = {}) { async setup() { const provider = await this.getProvider() // Only start listening for events if `target` is set, otherwise `injected()` will also receive events - if (provider && parameters.target) { + if (provider?.on && parameters.target) { if (!connect) { connect = this.onConnect.bind(this) provider.on('connect', connect)