Get NFTs owned solution / React

Please share the error message and server subdomain :raised_hands:

Error below. what is a server subdomain?

Lower one uses outdated syntax, you need to migrate to Moralis.Web3API from Moralis.Web3

the lower one works though.

the web3api line does not.

I copied both directly from the moralis documentation.

that address parameter that you send there in address: address, are you sure it is set?

yes, works perfectly in the lower function.

the only thing that doesn’t work is the Web3API section.

I don’t know how you call those functions. I don’t know what is in that address variable.
Can you paste server app id and server url?

What you get if you run console.log(Moralis.CoreManager.get("VERSION"))

ok, this means that you are using latest Moralis SDK version

none of the web3API functions work.

ok, you can go to https://admin.moralis.io/web3Api and try to run an api from there.
It may be something related to your server, but we can not copy text from your images in order to check.

how do i know if it “worked”?

you click on first api, then you click on try it out, then you enter a small random block number and then you click on execute and you’ll get to something like:

curl -X 'GET' \
  'https://deep-index.moralis.io/api/v2/block/3124124?chain=eth' \
  -H 'accept: application/json' \
  -H 'X-API-Key: API_KEY'

in the “chain” dropdown on https://admin.moralis.io/web3Api , there is no “matic” option, only “polygon” which works. but “matic” works in the non-API code. Why are these different?

ok… you’ll have to use “polygon” instead of “matic”, that is the name that Moralis uses for that network.

but matic works in the non-api function? does moralis have some reason for this or is it broken on their end?

Moralise.Web3 will be deprecated, I don’t know the exact reason, Matic was renamed/rebranded to Polygon this year. Maybe old code has Matic name.

well, I guess solved for now. Can I ask you another question? I am trying to extract some information from the specific NFT item that the user owns, but they are like LOOT where the contract generated SVG code as the image. Can I extract the text that is written in the SVG code? or somehow grab it directly from the contract’s functions?

You can start a separate forum thread for this question, and maybe also with an exact example of how you got to that svg. I don’t know the answer now. Maybe you can parse that svg like an xml in order to extract those text items.