[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);
  console.log(wrldhorse);
  }
  useEffect(() => {
    if (isInitialized) {
        fetchNFTsForContract()
    }
}, [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",
    address:"0x1e699dd390607a8dc54cdbd64d1a97775901a06f",
  });
  console.log(testnetNFTs);

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