[SOLVED] getNfts (Cannot read properties of undefined (reading 'account'))

Looks like a typo, you can try with it only once

Thanks… I’m still getting the error however

What version of packages are you using?

Not really sure - what packages should I check?

I’d assume the latest but I’d need to run a check

Try this:

thanks - would I simply need to run an install of those previous packages to go back?

I don’t know exactly, you may have to uninstall previous version and somehow to specify what version to install.

You can also test directly in codesamdvox

thanks - did it successfully but still facing the same issue

what is the code that you use now?

you can also look here on how to post code on forum:

  const {Web3Api} = useMoralisWeb3Api();
  const {isInitialized} = useMoralis()

  const fetchNFTsForContract = async () => {
    const options = {
      chain: "rinkeby",
      token_address: "0xf4DEd30B6ca5a6A40f56D9Fe066A9951571C6E3C",
  const wrldhorse = await Web3Api.account.getNFTsForContract(options);
  useEffect(() => {
    if (isInitialized) {
}, [isInitialized])

what do you get if you use console.log(Moralis.CoreManager.get("VERSION")) ?
after you import Moralis from useMoralis probably

const Web3Api = useMoralisWeb3Api();

const fetchNFTs = async () => {

  // get testnet NFTs for user
  const testnetNFTs = await Web3Api.account.getNFTs({
    chain: "rinkeby",

js1.11.0 - this is what I get

for me it looks like you are using the right syntax:

js1.11.0 this is what I get

what exactly does the account represent in this context? I understand it is somehow getting the logged in account but I assume its not in address format or it would easily be replaceable… My question is directed at trying to troubleshoot where I’ve gone wrong (be it a package or somewhere else)

try to check if that account from Web3Api is defined or not

this still doesn’t work?

Still getting undefined