Moralis.Web3Api.Account.GetNFTsForContract stopped working after switching from 1 dapp (free account) to a paid one. The only change in the Unity app was Moralis credentials.
Android logcat:
- 2022.06.16 15:05:04.235 28505 28524 Error Unity Error: HTTP/1.1 400 Bad Request 2022.06.16 15:05:04.235 28505 28524 Error Unity {“code”:141,“error”:“Invalid function: “getNFTsForContract””} 2022.06.16 15:05:04.235 28505 28524 Error Unity MoralisUnity.Web3Api.d__7:MoveNext() 2022.06.16 15:05:04.235 28505 28524 Error Unity UnityEngine.AsyncOperation:InvokeCompletionEvent() 2022.06.16 15:05:04.235 28505 28524 Error Unity 2022.06.16 15:05:04.240 28505 28524 Error Unity Error calling GetNFTsForContract: {“code”:141,“error”:“Invalid function: “getNFTsForContract””}
Unity code:
public static async Task<NFTProfile[]> GetNftsByAddressForContract(string address, string contract)
{
try
{
#if UNITY_WEBGL
NftOwnerCollection noc =
await Moralis.Web3Api.Account.GetNFTsForContract(address.ToLower(),
contract,
ChainList.eth);
#else
NftOwnerCollection noc =
await Moralis.Web3Api.Account.GetNFTsForContract(address.ToLower(),
contract,
ChainList.eth); //org ChainList.mumbai --> did not yield correct results!
#endif
PrintNftOwnerCollectionResult(noc.Result);
NFTProfile[] nftProfiles = new NFTProfile[noc.Result.Count];
if (noc.Result == null || noc.Result.Count == 0)
{
return null;
}
for (int i = 0; i < noc.Result.Count; i++)
{
nftProfiles[i] = NftOwnerToNFTProfile(noc.Result[i]);
}
return nftProfiles;
}
catch (Exception exp)
{
Debug.LogError(exp.Message);
}
return null;
}