Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core.mjs:7380 ERROR ProviderNotFoundError: Provider not found #798

Open
foodisready opened this issue Jan 6, 2025 · 0 comments
Open

core.mjs:7380 ERROR ProviderNotFoundError: Provider not found #798

foodisready opened this issue Jan 6, 2025 · 0 comments

Comments

@foodisready
Copy link

foodisready commented Jan 6, 2025

I had this working a few months back, not sure what changes in mobile Chrome, now it's complaining. The same code still works on desktop Chrome though. Any help is appreciated.

core.mjs:7380 ERROR ProviderNotFoundError: Provider not found.

Version: @wagmi/core@2.16.3
at injected.js:71:23
at Generator.next ()
at asyncGeneratorStep (asyncToGenerator.js:3:1)
at _next (asyncToGenerator.js:17:1)
at _ZoneDelegate.invoke (zone.js:369:28)
at Object.onInvoke (core.mjs:7227:33)
at _ZoneDelegate.invoke (zone.js:368:34)
at ZoneImpl.run (zone.js:111:43)
at zone.js:2538:40
at _ZoneDelegate.invokeTask (zone.js:402:33)
Here is my code

import {
  connect,
  disconnect,
  getAccount,
  injected,
  signMessage,
} from "@wagmi/core";
import { http, createConfig } from "@wagmi/core";
import { fraxtalTestnet, mainnet, sepolia } from "@wagmi/core/chains";
import { metaMask } from '@wagmi/connectors';

auth() {
    return new Observable((observer) => {
      (async() => {
        const config = createConfig({
          chains: [mainnet, sepolia],
          transports: {
            [mainnet.id]: http(),
            [sepolia.id]: http(),
          },
          connectors: [metaMask({useDeeplink: true})],
        });
        const { isConnected } = getAccount(config);
        const provider = await connect(config, { connector: injected() }); // enabling the web3 provider metamask

        const userData = {
          address: provider.accounts[0],
          chain: provider.chainId,
        };
        observer.next({ user: userData });
        observer.complete();
   })
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant