Hello, I have followed all of the Troubleshooting with fixing all of the issues related to setup and authenticating with Moralis in Unity using a self hosted server. After succeeded in the above, now I canât continue to retrieve NFTs as it used to be with the old server approach. How to get NFTs with the self hosted server? It should be the same with your Unity SDK, or else why didnât you update it? Thank you
what happens, what doesnât work?
you can create a cloud function and call it as an alternative
Getting NFTs is what doesnât work. This function that used to work on the non-self hosted server: âNftOwnerCollection noc =
await Moralis.GetClient().Web3Api.Account.GetNFTsForContract(playerAddress.ToLower(),tokenAddress,
_deployedChain);â
is not retrieving anything and the function is falling back to the catch error area with object null
there is a new function now for that getNFTs by wallet, I donât know the name for unity, is this one
Thank you, but this does not work for Unity. This is related to the back-end side. I am using Moralisâs Latest Unity SDK and this is the function that gets the NFTs and it is not working with the self hosted server that was created using Moralisâs Documentations and Videos.
there has to be another function with a similar name, in the past there were 2 functions with the same functionality and we deprecated one of them
This is the exact error after calling this function:
{âcodeâ:141,âerrorâ:"[C0005] Request contains unknown parameter: tokenAddress. This operation supports the following parameters: address, chain, format, limit, tokenAddresses, cursor, normalizeMetadata, disableTotal"}
try to use tokenAddresses instead of tokenAddress
And how is that possible? Moralis SDK is using tokenAddress value as url path in the API, How would I inject an array of addresses in it?
try with a single element initially, without an array, it should also work
So I only rename the token_address key in the body to token_addresses? is that what you are implying?
yes, try like that initially to see if it works
As expected, this doesnât work.
In the newest documentation, it is stating that we should give one tokenAddress, which was the case since forever, but now suddenly it is not working! I donât mind changing, but at least update documentation and/or SDK!
The error is as follows now, nothing changed since last error:
{âcodeâ:141,âerrorâ:"_a.map is not a function"}
Here is the Body sent by Moralis SDK to the GetTokenByContract Function:
{âaddressâ:â0xc123123123123123123123123123â,âtoken_addressâ:â0xac123123123123123123123123123â,âcursorâ:"",âchainâ:â0x89â}"
And here is the Response:
{âcodeâ:141,âerrorâ:"[C0005] Request contains unknown parameter: tokenAddress. This operation supports the following parameters: address, chain, format, limit, tokenAddresses, cursor, normalizeMetadata, disableTotal"}
What is the error when you use tokenAddresses?
Here is the Result:
Body: â{âaddressâ:â123123123123123â,âtoken_addressesâ:â0x123123123123123123â,âcursorâ:â",âchainâ:â0x89â}"
Response
{âcodeâ:141,âerrorâ:"_a.map is not a function"}
Try to send and array then, with [0x12455]
This worked, but it required manipulating the Code of the SDK. This should be updated in the SDK to send the following in the body:
{âaddressâ:â0xc08c9c87b3a01f4e37cb1159c66e35ad58980715â,âtokenAddressesâ:[â0xac14d20ec4b3f1a8cb91b9ebecdc0133e89e42a4â],âcursorâ:"",âchainâ:â0x89â}
It should replace âtoken_addressâ param with âtokenAddressesâ to follow the new Back-End requirement and replace the string value with an array of strings.
Thank You for your prompt responses on this thread!
Hello @bassel.l can I ask how you manage to make it work? I tried to do it myself with your discussions above, but Iâm still having errors