Moralis.web3API getTokenMetadata not working when specifying chainId

Hi,

As stipulated in the docs here https://docs.moralis.io/moralis-server/web3-sdk/token, when passing the parameter chain it should fetch token metadata on the specified chainId but the request is failing when it’s not eth passed:

      const metadata = await Moralis.Web3API.token.getTokenMetadata({
        addresses: [tokenAddress],
        chain: chainId === '0x7a69' ? '0x539' : chainId,
      });

Capture d’écran 2021-10-21 à 16.55.54 Capture d’écran 2021-10-21 à 16.55.57 Capture d’écran 2021-10-21 à 16.56.01

Because my token is on my local dev chain, the result is empty when eth is automatically passed.

Hi @SachaH

If you don’t specify chain it will will automatically select eth.

This web3API endpoint doesn’t work for local ganache chain

Hey,

But it is specified within the docs that hardhat and ganache or 0x539 are accepted as values in chain field

At this moment Web3API doesn’t work with local devchain.

Ok thanks for the info !

Do you know when will it be available ?

We don’t know exactly, and when it worked it didn’t work for all the Web3API functions, only for few of them.

1 Like

you should pass eth address because is required