accountBalanceGet on AccountAPI returns error 500

Hello, I downloaded the Moralis API client (Typescript fetch version) and I am trying to get account balances:

const apiConfig = new Configuration({ apiKey: "xxx", });
const accountService = new AccountApi(apiConfig);
const balance = await accountService.accountBalanceGet(account.value, undefined, "kovan");

GET request:

https://deep-index.moralis.io/api/account/balance?chain_name=kovan&address=0xEA8A39bfAB9E059Ec5f4F878862D0Ba52841725C

However this call returns me 500 error. I think it should not be a problem in the api config, as for example TokenApi method tokenErc20MetadataGet works without problems with this api config. Error looks like following:

Response { type: "cors", url: "https://deep-index.moralis.io/api/account/balance?chain_name=kovan&address=0xEA8A39bfAB9E059Ec5f4F878862D0Ba52841725C", redirected: false, status: 500, ok: false, statusText: "Internal Server Error", headers: Headers, body: ReadableStream, bodyUsed: false }

Do you have any ideas, what am I doing wrong?
Thank you for your help!:slight_smile:

1 Like

Hey @microHoffman

Could you please check this on anouther chain?

Hello @Yomoo ,
I’ve tried it on mainnet and it works without any problems. However I’ve tried it once more on Kovan and it works now, so AccountAPI works fine right now. Unfortunately, NFTApi does not work, for example:

    const token = await nftService.nftContractTokenAddressTokenTokenIdGet(
      tokenAddress,
      tokenId.toString(),
      undefined,
      "kovan"
    );

returns me this:

Response { type: "cors", url: "https://deep-index.moralis.io/api/nft/contract/0x5cA1abD4dAF35952432ADe93619D86a0dE0E9603/token/26?chain_name=kovan", redirected: false, status: 500, ok: false, statusText: "Internal Server Error", headers: Headers, body: ReadableStream, bodyUsed: false }

When I try this function on mainnet, it works without any problems. Do you have any idea why is that happening and what I can do with this error?

Thank you!

Yes, we do not support Kovan for the NFT api right now. You can see all the available networks for each api call over here - https://deep-index.moralis.io/api-docs/#/account/getTokenBalances

Hope this helps.

Thank you, I found the supported chains info on each endpoint too, but for example /account/balance endpoint works on Kovan fine, even though it’s not in the list of available values on chain_name parameter. Do you plan adding a full support on kovan soon, or it’s not in your roadmap? :slight_smile:

Although there are some endpoints that work on networks not mentioned in the docs, it’s always a safe scenario to use the ones that are explicitly mentioned because they are production ready. We are adding support for more chains one by one. You will see a lot of progress in the coming months.

Thank you for your support! :raised_hands: