Using getTokenBalances() with avalanche?

Is this supported?

     const options = { chain: 'avalanche' };
    const balances = await Moralis.Web3API.account.getTokenBalances(options);

When I run this code I get back:

asyncToGenerator.js?1da1:6 Uncaught (in promise) {code: 141, error: 'Invalid chain'}

Yep, it should be just tried it on my end.
Ran this snippet:

   const b = await Moralis.Web3API.account.getTokenBalances({
                chain: "avalanche",

To use the .account make sure you are first signed in. It could also be the version. Are you connecting via URL to SDK, or are you using a npm library, maybe the downloaded library needs to be updated.



Thanks this is working now. Iā€™m not sure what was wrong before but my code is working ok today.

1 Like