GetTokenMetaData error 141

Im trying to run the following 2 lines of code

const options = { address: “0x918e8776743aaa9e04ea2fb6bb50baa11ee4c28b”, chain: “rinkeby” };
const tokenMetadata = await Moralis.Web3API.token.getTokenMetadata(options);

but receive this error in the Moralis server log

and this error in my console.log(tokenMetadata)
12

I minted the NFT by using admin-moralis-cli to upload the images and json files to moralis. Then using truffle I uploaded the erc1155 contract ( with the link to the 2 NFTS with metadata) to rinkeby.

1 Like

Hi @elijahsb777

For getting NFT metadata you need to use:
https://docs.moralis.io/moralis-server/web3-sdk/token#getnftmetadata
https://docs.moralis.io/moralis-server/web3-sdk/token#gettokenidmetadata

1 Like

hmm not the metadata i hoped for (the data in the json file)

this is the log of the moralis server. I cannot copy the image due to it being long and extending past the screen

2021-10-11T19:30:36.954Z - Ran cloud function getNFTMetadata for user uTdk4oKTUEKgjwfrmcFtHvr7 with:
Input: {“address”:“0x918e8776743aaa9e04ea2fb6bb50baa11ee4c28b”,“chain”:“rinkeby”}
Result: {“token_address”:“0x918e8776743aaa9e04ea2fb6bb50baa11ee4c28b”,“name”:null,“symbol”:null,“abi”:null,“contract_type”:“ERC1155”,“supports_token_uri”:null,“synced_at”:null}

edit: Thanks Yomoo for the support. This is resolved. I can fetch the metadata using a function the takes the response.json() and then put the nft.metadata = res.result which works fine. The two functions you stated provides the chain metadata of the tokens as opposed to the json file which served as the metadata of the image. Thanks again.

1 Like

you can also try this:

x = await Moralis.Web3API.token.getAllTokenIds({address: ‘0x918e8776743aaa9e04ea2fb6bb50baa11ee4c28b’, chain: ‘rinkeby’})

2 Likes