For some reason, my getNFTsForContract
web3API call keeps returning 400s, but I can't tell why. Here is what I'm using to make the call:
const { fetch, data, error, isLoading } = useMoralisWeb3ApiCall(
Web3Api.account.getNFTsForContract,
{
chain: networkId,
address: user,
token_address: retroCatsAddress,
}
)
And it looks like in my browser inspect tools that the request body of the API call is ok. I also have setup the MoralisProvider like so:
ReactDOM.render(
<MoralisProvider
appId={process.env.REACT_APP_MORALIS_APP_ID}
serverUrl={process.env.REACT_APP_MORALIS_SERVER_URL}
>
<App />
</MoralisProvider>,
document.getElementById('root')
)
But am wondering if I'm missing something. The parameters i'm passing are:
address
: 0x643315C9Be056cDEA171F4e7b2222a4ddaB9F88D
chain
: 4
token_address
: 0xc8d8B5a3ED2aA35Df8F1781F2B06A14Fb0411bc8
And I've verified that the address in question has NFTs on the token_address.
So what am I missing?
You need to provide the chain as a string and in hex form:
const { fetch, data, error, isLoading } = useMoralisWeb3ApiCall(
Web3Api.account.getNFTsForContract,
{
chain: "0x4",
address: user,
token_address: retroCatsAddress,
}
)