TypeError: Cannot read properties of undefined (reading 'init')

How to solve this error
image

@limbachiyachintan500 Thanks for your recent post.

Is this for React or Reactnative? Can you share the implmentation code and which example from our repository are you following for your code?

import { useQuery } from "@tanstack/react-query"
import { ECDSAProvider, getRPCProviderOwner } from "@zerodevapp/sdk"
import { formatEther } from "viem"

import { useWeb3AuthSigner } from "~/context/web3-auth-signer"
import { env } from "~/env.mjs"
import { alchemy } from "~/utils/alchemy"

const WETH_TOKEN_ADDRESS = "0xF54e919cDB1Eb2C2df9F73555c6BbDB26F797fcf"

export default function useWallet() {
  const { web3AuthSigner, accountAddress, setAccountAddress } =
    useWeb3AuthSigner()

  const data = useQuery({
    queryKey: ["wallet"],
    queryFn: async () => {
      let address = accountAddress
      if (address === undefined) {
        const ecdsaProvider = await ECDSAProvider.init({
          projectId: env.NEXT_PUBLIC_ZERODEV_PROJECT_ID,
          owner: getRPCProviderOwner(web3AuthSigner),
        })

        address = await ecdsaProvider.getAddress()
        setAccountAddress(address)
        console.log("address-->", address)
      }

      // Get balances
      const [rawMaticBalance, tokenBalances] = await Promise.all([
        alchemy.core.getBalance(address),
        alchemy.core.getTokensForOwner(address, {
          contractAddresses: [WETH_TOKEN_ADDRESS],
        }),
      ])

      const rawWethBalance =
        tokenBalances.tokens.find(
          (token) => token.contractAddress === WETH_TOKEN_ADDRESS,
        )?.balance ?? "0"

      // Parsed balances
      const maticBalance = +formatEther(rawMaticBalance.toBigInt())
      const wethBalance = +rawWethBalance
      const totalBalance = maticBalance + wethBalance * 131.62

      return {
        address,
        maticBalance,
        wethBalance,
        totalBalance,
      }
    },
  })

  return data
}

@vjgee

i am remove @alchemy/aa-core and @zerodevapp/sdk dependency from my package.json .after i am removed node_modules than install and than again install all packages solve the error but new error show

Our Dev team will have to review this and will get back with an update.