[SOLVED] ErrorOn - How to Authenticate User with Metamask

Hello Moralis community. Please solve this problem fast! I am receiving an error I can not resolve myself. My coding experience is limited. Attached is an image of the code compiled in Visual Studio Code that does look very similar to the youtube tutorial but I notice that the β€œconst { provider, webSocketProvider } = configureChains(” has the error as the colour of provider & webSocketProvider appear as a blue color not yellow.

I am also attaching this image as this is what I see on local.3000

Hi @4-Art

As per the latest wagmi sdk version createClient has been replace with createConfig.
Here is an example code on how to update wagmi code as per the latest wagmi version. Please try similar to this.

Check the wagmi docs for more details

import "@/styles/globals.css";

import { createConfig, configureChains, mainnet } from "wagmi";
import { publicProvider } from "wagmi/providers/public";
import { InjectedConnector } from "wagmi/connectors/injected";
import { WalletConnectConnector } from "wagmi/connectors/walletConnect";
const { chains, publicClient } = configureChains([mainnet], [publicProvider()]);
import { WagmiConfig } from "wagmi";

const config = createConfig({
  connectors: [
    new InjectedConnector({ chains }),
    new WalletConnectConnector({
      chains,
      options: {
        projectId: "...",
      },
    }),
  ],
  publicClient,
});

export default function App({ Component, pageProps }) {
  return (
    <>
      <WagmiConfig config={config}>
        <Component {...pageProps} />
      </WagmiConfig>
    </>
  );
}

Thank you for this speedy help. I will start another thread in regards to the next issue I run into.

1 Like