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

The same syntax as in vanilla js

Something like Moralis.web3api.account. This is not the exact syntax

const testnetNFTs = await Moralis.Web3API.account.getNFTs({ chain: "goerli" });

? what imports would be required in this instance?

Same import that you used for getting the version before

Error: required param address not provided

required param address not provided

const {isInitialized, Moralis} = useMoralis()
  

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

You have to also provide address parameter, if the user is not authenticated

thanks that seemed to do the trick!!

1 Like