Hello to whomever is reading this, I need some help with the syncNFTContract and the getNFTOwners API Calls.
First off, I would like to give some backstory as to some problems I overcame getting to where I am at now. I am running node v16.15.0, I learned about moralis about a week ago and thought it would be good for what I was looking to accomplish. In the process of trying to setup moralis in node JS on VSCode, I kept running into the problem of TypeError: Moralis.start is not a function. I came across this forum post: https://forum.moralis.io/t/solved-moralis-v2-typeerror-moralis-start-is-not-a-function/19090 and saw the recommendation to another forum post within the replies by a moderator, that said to change:
import Moralis from “moralis”
const Moralis2 = Moralis.default
“and then use Moralis2 instead of Moralis”
This worked for me as far as I know as it seemed to “partially” fix the problem but may be leading to some other problems I am having which is why I gave this backstory.
Anyways so I will show what my code and folder format looks like:
The Address and API are correct on my end I just changed it for the screenshots. When I ran the syncNFTContract on a rinkeby NFT contract I have deployed for testing, I got the terminal response of “{ success: true }”, yet my NFT collection did not update to the new metadata (From one test image to a new IPFS link of another set of test images). I have also noticed and I don’t know if this is relevant but on my usage tab on my moralis account, it claims I have 0 CU or API Calls from my Web3API key. Am I supposed to be using a different API key than the Web3 one and is this a sign that something is wrong?
Regarding the issue I am having with getNFTOwners, when I call it, I get a response like this for each individual NFT in the collection:
There is more with each NFT but I cut it out from screenshot. Anyways, what I am attempting to accomplish with this is to get a full list of NFT owners of an NFT, as well as how many they own. Why is it that for ownerOf: returns [EvmAddress] and not the address of the owner. I have noticed in the v1 docs it says “Make sure to include a sort parm on a column like token_id for consistent pagination results”, as well as an (options) section. Is there anyways that I can limit it so that it only tells me the ownerOf each address? Is there anyway through these options, to make it do what I am looking for? Ex. if address 0x05 owns 7 then it lists 7? I’d assume this isn’t possible and I will have to write some sort of other code based off of the output to the terminal to sort through and make the list I am looking for.
I am sorry that this is such a long list of questions, any help would be greatly appreciated as Moralis clearly is a powerful tool for developers! Thanks in advance.